@Override public boolean equals(Object o) { if (o instanceof DiagramImpl) { DiagramImpl other = (DiagramImpl) o; return ((null != getGraph()) ? getGraph().equals(other.getGraph()) : null == other.getGraph()) && ((null != getMetadata()) ? getMetadata().equals(other.getMetadata()) : null == other.getMetadata()) && ((null != getName()) ? getName().equals(other.getName()) : null == other.getName()); } else { return false; } } }
@Override public int hashCode() { int graphHash = (null != getGraph()) ? getGraph().hashCode() : 0; int metadataHash = (null != getMetadata()) ? getMetadata().hashCode() : 0; int nameHash = (null != getName()) ? getName().hashCode() : 0; return HashUtil.combineHashCodes(graphHash, metadataHash, nameHash); }
private Diagram<Graph, Metadata> unmarshall(InputStream is) throws Exception { Metadata metadata = new MetadataImpl.MetadataImplBuilder(BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class)).build(); DiagramImpl result = new DiagramImpl(org.kie.workbench.common.stunner.core.util.UUID.uuid(), metadata); Graph graph = tested.unmarshall(metadata, is); result.setGraph(graph); // Update diagram's metadata attributes. tested.updateRootUUID(result.getMetadata(), graph); tested.updateTitle(result.getMetadata(), graph); return result; }