private String getTitle(final BPMNDiagram diagram) { final String title = diagram != null ? diagram.getDiagramSet().getName().getValue() : null; return title != null && title.trim().length() > 0 ? title : "-- Untitled diagram --"; }
public BPMNGeneralSet(final String name, final String documentation) { this.name = new Name(name); this.documentation = new Documentation(documentation); }
protected void updateDiagramProperties(final String name, final Node<Definition<BPMNDiagram>, ?> diagramNode, final M metadata) { // Default initializations. final Optional<DiagramSet> diagramSet = Optional.ofNullable(diagramNode) .map(Node::<Definition<BPMNDiagram>>getContent) .map(Definition::getDefinition) .map(BPMNDiagram::getDiagramSet); diagramSet .map(DiagramSet::getId) .filter(id -> Objects.isNull(id.getValue())) .ifPresent(id -> id.setValue(metadata.getTitle())); diagramSet .map(DiagramSet::getName) .filter(attr -> Objects.isNull(attr.getValue())) .ifPresent(attr -> attr.setValue(name)); }
@Override public ServiceTask build() { final ServiceTask serviceTask = newInstance(); final String name = workItemDefinition.getName(); setProperties(workItemDefinition, serviceTask); serviceTask.getExecutionSet().getTaskName().setValue(name); serviceTask.getGeneral().getName().setValue(workItemDefinition.getDisplayName()); serviceTask.getGeneral().getDocumentation().setValue(workItemDefinition.getDocumentation()); serviceTask.setDescription(workItemDefinition.getDescription()); serviceTask.getDataIOSet() .getAssignmentsinfo() .setValue(workItemDefinition.getParameters() + workItemDefinition.getResults()); return serviceTask; }
@Override public boolean equals(Object o) { if (o instanceof TaskGeneralSet) { TaskGeneralSet other = (TaskGeneralSet) o; return name.equals(other.name) && documentation.equals(other.documentation); } return false; } }
@Override public int hashCode() { return HashUtil.combineHashCodes(name.hashCode(), documentation.hashCode()); }
@Override public boolean equals(Object o) { if (o instanceof DiagramSet) { DiagramSet other = (DiagramSet) o; return name.equals(other.name) && documentation.equals(other.documentation) && id.equals(other.id) && packageProperty.equals(other.packageProperty) && version.equals(other.version) && adHoc.equals(other.adHoc) && processInstanceDescription.equals(other.processInstanceDescription) && executable.equals(other.executable); } return false; } }
@Override public int hashCode() { return HashUtil.combineHashCodes(name.hashCode(), documentation.hashCode(), id.hashCode(), packageProperty.hashCode(), version.hashCode(), adHoc.hashCode(), processInstanceDescription.hashCode(), executable.hashCode()); }
protected String getTaskName() { String taskName = "Task"; if (bpmnModel != null && bpmnModel instanceof BaseTask) { BaseTask task = (BaseTask) bpmnModel; if (task.getGeneral() != null && task.getGeneral().getName() != null && task.getGeneral().getName().getValue() != null && task.getGeneral().getName().getValue().length() > 0) { taskName = task.getGeneral().getName().getValue(); } } return taskName; }
public BPMNGeneralSet() { this(new Name(""), new Documentation()); }
@Test @SuppressWarnings("unchecked") public void testBuildWithAttributesSet() { final String id2 = "id"; final String name2 = "name2"; this.id.setValue(id2); name.setValue(name2); ProjectDiagram pdiagram = tested.build(NAME, metadata, graph); assertEquals(id2, this.id.getValue()); assertEquals(name2, name.getValue()); }
private static Pair<Object, String> buildPair(final String uuid, final BPMNDefinition definition) { String name = definition.getGeneral().getName().getValue(); return new Pair<>(uuid, isEmpty(name) ? uuid : name); } }
public TaskGeneralSet() { this(new Name(""), new Documentation()); }
private void updateDiagramProperties( final String name, final Graph<DefinitionSet, ?> graph, final ProjectMetadata metadata) { final Node<Definition<BPMNDiagram>, ?> diagramNode = getFirstDiagramNode( graph ); if ( null == diagramNode ) { throw new IllegalStateException( "A BPMN Diagram is expected to be present on BPMN Diagram graphs." ); } final BPMNDiagram diagram = diagramNode.getContent().getDefinition(); final String id = diagram.getDiagramSet().getId().getValue(); final String projectName = null != metadata.getProjectName() ? metadata.getProjectName() + "." : ""; if ( null == id || diagram.getDiagramSet().getId().getDefaultValue().equals( id ) ) { diagram.getDiagramSet().getId().setValue( projectName + name ); } final String p = diagram.getDiagramSet().getPackageProperty().getValue(); if ( null == p ) { String metadataPackage = metadata.getProjectPackage(); if ( metadataPackage == null || metadataPackage.isEmpty() ) { diagram.getDiagramSet().getPackageProperty().setValue( diagram.getDiagramSet().getPackageProperty().DEFAULT_PACKAGE ); } else { diagram.getDiagramSet().getPackageProperty().setValue( metadata.getProjectPackage() ); } } final String diagramName = diagram.getGeneral().getName().getValue(); if ( null == diagramName || diagramName.isEmpty() ) { diagram.getGeneral().getName().setValue( name ); } }
void assertGeneralSet(BPMNGeneralSet generalSet, String nodeName, String documentation) { assertThat(generalSet).isNotNull(); assertThat(generalSet.getName()).isNotNull(); assertThat(generalSet.getDocumentation()).isNotNull(); assertThat(generalSet.getName().getValue()).isEqualTo(nodeName); assertThat(generalSet.getDocumentation().getValue()).isEqualTo(documentation); }
public BPMNGeneralSet(String name) { this.name = new Name(name); this.documentation = new Documentation(); }
private void assertGeneralSet(BPMNGeneralSet generalSet, String nodeName, String documentation) { assertThat(generalSet).isNotNull(); assertThat(generalSet.getName()).isNotNull(); assertThat(generalSet.getDocumentation()).isNotNull(); assertThat(generalSet.getName().getValue()).isEqualTo(nodeName); assertThat(generalSet.getDocumentation().getValue()).isEqualTo(documentation); }
@Test public void testNameValid() { Name name = new Name(NAME_VALID); Set<ConstraintViolation<Name>> violations = this.validator.validate(name); assertTrue(violations.isEmpty()); }
void assertGeneralSet(BPMNGeneralSet generalSet, String nodeName, String documentation) { assertThat(generalSet).isNotNull(); assertThat(generalSet.getName()).isNotNull(); assertThat(generalSet.getDocumentation()).isNotNull(); assertThat(generalSet.getName().getValue()).isEqualTo(nodeName); assertThat(generalSet.getDocumentation().getValue()).isEqualTo(documentation); }
@Test public void testNameEmpty() { Name name = new Name(""); Set<ConstraintViolation<Name>> violations = this.validator.validate(name); assertEquals(1, violations.size()); }