public SaveODocumentCommand( ICommandsSupportComponent<ODocument> component, IModel<DisplayMode> displayModeModel, IModel<ODocument> model) { super(component, displayModeModel, model); setIcon(FAIconType.save); setBootstrapType(BootstrapType.PRIMARY); }
@Override public void detachModels() { super.detachModels(); taskModel.detach(); }
@Override public RequiredOrientResource[] getRequiredResources() { return getRequiredResources(getModelObject()); }
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { ODocument doc = getModelObject(); if(doc.getIdentity().isNew()) realizeMandatory(doc); doc.save(); if(forceCommit) { ODatabaseDocument db = getDatabase(); boolean active = db.getTransaction().isActive(); db.commit(); if(active) db.begin(); } super.onClick(targetOptional); }
@Override protected void onConfigure() { super.onConfigure(); /* Hide if there is no extra properties IModel<? extends List<? extends OProperty>> propertiesModel = propertiesStructureTable.getCriteriesModel(); List<? extends OProperty> properties = propertiesModel.getObject(); setVisible(properties!=null && !properties.isEmpty());*/ if(DisplayMode.EDIT.equals(getModeObject())) { saveODocumentCommand.configure(); if(!saveODocumentCommand.determineVisibility()) { setModeObject(DisplayMode.VIEW); } } }
@Override protected void onInitialize() { super.onInitialize(); propertiesStructureTable.addCommand(new EditODocumentCommand(propertiesStructureTable, getModeModel())); propertiesStructureTable.addCommand(new SaveODocumentCommand(propertiesStructureTable, getModeModel()){ @Override protected void onInitialize() { super.onInitialize(); setLabelModel(new ResourceModel("command.saveAndStart")); }; @Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { super.onClick(targetOptional); ODocument doc = formDocumentModel.getObject(); Map<String, Object> variables = new HashMap<>(); variables.put(formKey.getVariableName(), doc.getIdentity().toString()); BpmPlatform.getDefaultProcessEngine().getRuntimeService() .startProcessInstanceById((String)ProcessDefinitionFormWidget.this.getModelObject().field("id"), variables); setResponsePage(new ODocumentPage(doc)); }; }.setForceCommit(true).setBootstrapType(BootstrapType.SUCCESS)); }
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { super.onClick(targetOptional); associateTaskWithDocument(); }; }.setForceCommit(true));
@Override protected void onInitialize() { super.onInitialize(); propertiesStructureTable.addCommand(new EditODocumentCommand(propertiesStructureTable, getModeModel())); propertiesStructureTable.addCommand(saveODocumentCommand = new SaveODocumentCommand(propertiesStructureTable, getModeModel())); }
@Override protected void onConfigure() { super.onConfigure(); setVisible(getModelObject().getIdentity().isPersistent() || getModeObject().canModify()); }
@Override protected void onConfigure() { super.onConfigure(); IModel<? extends List<? extends OProperty>> propertiesModel = propertiesStructureTable.getCriteriesModel(); List<? extends OProperty> properties = propertiesModel.getObject(); setVisible((properties!=null && !properties.isEmpty()) ||getModel().getObject().getIdentity().isNew()); if(DisplayMode.EDIT.equals(getModeObject())) { saveODocumentCommand.configure(); if(!saveODocumentCommand.determineVisibility()) { setModeObject(DisplayMode.VIEW); } } }
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { super.onClick(targetOptional); ODocument doc = formDocumentModel.getObject(); Map<String, Object> variables = new HashMap<>(); variables.put(formKey.getVariableName(), doc.getIdentity().toString()); BpmPlatform.getDefaultProcessEngine().getRuntimeService() .startProcessInstanceById((String)ProcessDefinitionFormWidget.this.getModelObject().field("id"), variables); setResponsePage(new ODocumentPage(doc)); }; }.setForceCommit(true).setBootstrapType(BootstrapType.SUCCESS));
@Override protected void onInitialize() { super.onInitialize(); propertiesStructureTable.addCommand(new EditODocumentCommand(propertiesStructureTable, getModeModel())); propertiesStructureTable.addCommand(saveODocumentCommand = new SaveODocumentCommand(propertiesStructureTable, getModeModel())); }
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { super.onClick(targetOptional); ODocument doc = getModelObject(); ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine(); TaskService taskService = processEngine.getTaskService(); String taskId = taskModel.getObject().field("id"); String var = formKey.getVariableName(); taskService.complete(taskId, CommonUtils.<String, Object>toMap(var, doc.getIdentity().toString())); setResponsePage(new ODocumentPage(doc)); sendActionPerformed(); }
structureTable.addCommand(new SaveODocumentCommand(structureTable, getModeModel()));
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { ODocument resource = getModelObject(); if(resource.getIdentity().isNew()) { ODocument pd = BpmnPanel.this.pdModel.getObject(); String resourceName = pd.field("resourceName"); if(Strings.isEmpty(resourceName)) { resourceName = pd.field("name")+".bpmn"; pd.field("resourceName", resourceName); pd.save(); } resource.field("name", resourceName); resource.field("deployment", (Object) pd.field("deployment")); } super.onClick(targetOptional); } });