/// <summary> /// execute all pending commands - create the equivalent local commands and invoke its' execute method /// </summary> /// <param name="sendingInstruction"></param> /// <param name="sessionStage"></param> /// <param name="res"></param> internal override void Execute(SendingInstruction sendingInstruction, SessionStage sessionStage, IResultValue res) { MGDataCollection mgDataTab = MGDataCollection.Instance; // loop on all MGData for (int i = 0; i < mgDataTab.getSize(); i++) { MGData mgd = mgDataTab.getMGData(i); if (mgd != null && !mgd.IsAborting) { CommandsTable commands = mgd.CmdsToServer; // go over all commands while (commands.getSize() > 0) { // extract command from CmdsToServer IClientCommand command = commands.ExtractCommand(0); LocalRunTimeCommandBase localRunTimeCommand = _localRunTimeCommandFactory.CreateLocalRunTimeCommand(command); localRunTimeCommand.Execute(); } Debug.Assert(mgd.CmdsToClient.getSize() == 0, "Not all commands were executed"); } } }
/// <summary> /// execute the command by pass requests to the server /// </summary> /// <param name="command"></param> internal override ReturnResultBase Execute() { CommandsTable cmdsToServer = Task.getMGData().CmdsToServer; cmdsToServer.Add(Command); RemoteCommandsProcessor.GetInstance().Execute(CommandsProcessorBase.SendingInstruction.TASKS_AND_COMMANDS); return(new ReturnResult()); }
/// <summary> /// parse the expression XML tag /// </summary> /// <param name = "tokensVector">the vector of attributes and their values /// </param> // TODO: NEW JDK - tokensVector - use ArrayList instead of Vector private void initElements(List <String> tokensVector) { String expStr; String attribute, valueStr; for (int j = 0; j < tokensVector.Count; j += 2) { attribute = (tokensVector[j]); valueStr = (tokensVector[j + 1]); switch (attribute) { case XMLConstants.MG_ATTR_VALUE: //if we work in hex if (ClientManager.Instance.getEnvironment().GetDebugLevel() > 1) { expStr = valueStr; buildByteArray(expStr); } else { _expBytes = Misc.ToSByteArray(Base64.decodeToByte(valueStr)); } break; case XMLConstants.MG_ATTR_ID: _id = XmlParser.getInt(valueStr); break; case ConstInterface.MG_ATTR_COMPUTE_BY: _computeBy = valueStr[0]; break; default: Logger.Instance.WriteExceptionToLog( "There is no such tag in Expression.initElements class. Insert case to Expression.initElements for " + attribute); break; } } if (!computedByClient()) { _cmdsToServer = _task.getMGData().CmdsToServer; } // add an entry into DNObjectsCollection and store the key reference in �DNObjectsCollectionKey�E _dnObjectCollectionKey = DNManager.getInstance().DNObjectsCollection.CreateEntry(null); }
private bool _timersStarted; // TRUE if the timers have already been started /// <summary> /// CTOR /// </summary> /// <param name = "id">the id of this mgdata object</param> /// <param name = "parent">the parent MGData</param> /// <param name = "isModal">true for modal windows</param> internal MGData(int id, MGData parent, bool isModal) { CmdsToServer = new CommandsTable(); CmdsToClient = new CommandsTable(); _timerHandlers = new HandlersTable(); _expHandlers = new HandlersTable(); _mprgTab = new TasksTable(); _tasksTab = new TasksTable(); _id = id; _parent = parent; if (ClientManager.Instance.EventsManager.getCompMainPrgTab() == null) { var compMainPrgTab = new CompMainPrgTable(); ClientManager.Instance.EventsManager.setCompMainPrgTab(compMainPrgTab); } IsModal = isModal; }
/// <summary> /// execute recompute /// </summary> /// <param name = "rec">the record on which the recompute is executed</param> internal void execute(Record rec) { int i; Field fld; CommandsTable cmdsToServer = Task.getMGData().CmdsToServer; IClientCommand cmd; try { rec.setInRecompute(true); bool allowServerRecompute = _hasServerLinksRecomputes || (Task.getForm().AllowedSubformRecompute&& checkRefreshSubForms()); // SERVER if (RcmpMode != RcmpBy.CLIENT && allowServerRecompute) { bool inClient = _subFormsOnlyRecomp; Task.ExecuteClientSubformRefresh = false; // if the recompute is not only due to sub-forms go to server if (inClient) { inClient = Task.prepareCache(true); //if all sub-form are not update if (inClient) { inClient = Task.testAndSet(true); //try to take dataviews from cache } } if (!inClient) { ((FieldsTable)Task.DataView.GetFieldsTab()).setServerRcmp(true); cmd = CommandFactory.CreateRecomputeCommand(Task.getTaskTag(), OwnerFld.getId(), !Task.getForm().AllowedSubformRecompute); cmdsToServer.Add(cmd); RemoteCommandsProcessor.GetInstance().Execute(CommandsProcessorBase.SendingInstruction.TASKS_AND_COMMANDS); } if (Task.ExecuteClientSubformRefresh) { RefreshSubforms(); } else { if (recPrefixSubForms()) { recSuffixSubForms(); } Task.CleanDoSubformPrefixSuffix(); } } // CLIENT else { try { FlowMonitorQueue.Instance.addRecompute(OwnerFld.getVarName()); // FORM PROPERTIES if (_formProps != null) { _formProps.RefreshDisplay(false, false); } // CTRL PROPERTIES if (_ctrlProps != null) { _ctrlProps.RefreshDisplay(false, false); } //re-cumpute client side fields and links if (_rcmpOrder != null) { for (i = 0; i < _rcmpOrder.Count; i++) { if (_rcmpOrder[i] is Field) { fld = (Field)_rcmpOrder[i]; fldRcmp(fld, true); } else if (_rcmpOrder[i] is DataviewHeaderBase) { var curLnk = (DataviewHeaderBase)_rcmpOrder[i]; curLnk.getLinkedRecord(rec); //if we have recomputed a link we should also start the recompute process on all of its fields List <Field> linkFields = ((FieldsTable)Task.DataView.GetFieldsTab()).getLinkFields(curLnk.Id); rec.setInCompute(true); bool saveInForceUpdate = rec.InForceUpdate; rec.InForceUpdate = false; for (int j = 0; j < linkFields.Count; j++) { fldRcmp(linkFields[j], false); rec.clearFlag((linkFields[j]).getId(), Record.FLAG_UPDATED); rec.clearFlag((linkFields[j]).getId(), Record.FLAG_MODIFIED); rec.clearFlag((linkFields[j]).getId(), Record.FLAG_CRSR_MODIFIED); rec.clearHistoryFlag((linkFields[j]).getId()); } rec.InForceUpdate = saveInForceUpdate; //start recompute process on the ret val of the link Field retFld = curLnk.ReturnField; if (retFld != null) { fldRcmp(retFld, false); } rec.setInCompute(false); rec.setForceSaveOrg(true); } else if (_rcmpOrder[i] is DCValuesRecompute) { ((DCValuesRecompute)_rcmpOrder[i]).Recompute(Task, rec); } } } RefreshSubforms(); } catch (Exception e) { Logger.Instance.WriteExceptionToLog("in Recompute.execute(): " + e.Message); } } // END CLIENT BLOCK } finally { rec.buildLinksPosStr(); rec.setInRecompute(false); } }