public static DocumentArtifactEnum fromValue(BaseArtifactEnum v) { for (DocumentArtifactEnum c: DocumentArtifactEnum.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v.toString()); }
@Override protected void visitServiceImplementation(ServiceImplementationModelType artifact) { super.visitServiceImplementation(artifact); try { List<String> targetTypes = new ArrayList<String>(); for (DocumentArtifactTarget documentation : artifact.getDocumentation()) { targetTypes.add(documentation.getArtifactType().toString()); } setRelationships("documentation", RelationshipType.MODELED, artifact.getDocumentation()); } catch (Exception e) { error = e; } }
DocumentArtifactTarget related = new DocumentArtifactTarget(); related.setValue(artifact.getUuid()); related.setArtifactType(DocumentArtifactEnum.fromValue(artifact.getArtifactType())); dat.setRelatedDocument(related);
/** * @see org.overlord.sramp.common.visitors.HierarchicalArtifactVisitorAdapter#visitDerived(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.DerivedArtifactType) */ @Override protected void visitDerived(DerivedArtifactType artifact) { try { // Pull out the 'relatedDocument' relationship, if one exists (it should!) if (this.jcrNode.hasNode("sramp-relationships:relatedDocument")) { //$NON-NLS-1$ Node relatedDocNode = this.jcrNode.getNode("sramp-relationships:relatedDocument"); //$NON-NLS-1$ String targetType = getProperty(relatedDocNode, "sramp:targetType"); //$NON-NLS-1$ Property property = relatedDocNode.getProperty("sramp:relationshipTarget"); //$NON-NLS-1$ Value[] values = property.getValues(); if (values.length > 1) { throw new Exception(Messages.i18n.format("MAX_CARDINALITY_FAILED", values.length)); //$NON-NLS-1$ } Value value = values[0]; String targetUUID = referenceResolver.resolveReference(value); DocumentArtifactTarget target = new DocumentArtifactTarget(); target.setValue(targetUUID); if (targetType != null) { target.setArtifactType(DocumentArtifactEnum.valueOf(targetType)); } artifact.setRelatedDocument(target); } } catch (Exception e) { throw new RuntimeException(e); } }
@Override protected void visitSoa(SoaModelType artifact) { super.visitSoa(artifact); try { List<String> targetTypes = new ArrayList<String>(); for (DocumentArtifactTarget documentation : artifact.getDocumentation()) { targetTypes.add(documentation.getArtifactType().toString()); } setRelationships("documentation", RelationshipType.MODELED, artifact.getDocumentation()); } catch (Exception e) { error = e; } }
DocumentArtifactTarget related = new DocumentArtifactTarget(); related.setValue(primaryArtifact.getUuid()); related.setArtifactType(DocumentArtifactEnum.fromValue(primaryArtifact.getArtifactType())); dat.setRelatedDocument(related);
/** * @see org.overlord.sramp.common.visitors.HierarchicalArtifactVisitorAdapter#visitDerived(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.DerivedArtifactType) */ @Override protected void visitDerived(DerivedArtifactType artifact) { try { setRelationship("relatedDocument", 1, 1, artifact.getRelatedDocument().getArtifactType().toString(), //$NON-NLS-1$ false, artifact.getRelatedDocument()); } catch (Exception e) { error = e; } }
@Override protected void visitDerived(DerivedArtifactType srampArtifact) { super.visitDerived(srampArtifact); try { if (includeAssociations) { ArtificerArtifact derivedFrom = artificerArtifact.getDerivedFrom(); if (derivedFrom != null) { DocumentArtifactTarget target = new DocumentArtifactTarget(); ArtifactType derivedFromType = ArtifactType.valueOf(derivedFrom.getType(), derivedFrom.isDocument()); DocumentArtifactEnum documentArtifactEnum = DocumentArtifactEnum.fromValue(derivedFromType.getArtifactType().getApiType()); target.setArtifactType(documentArtifactEnum); target.setValue(derivedFrom.getUuid()); srampArtifact.setRelatedDocument(target); } } } catch (Exception e) { throw new RuntimeException(e); } }
public static DocumentArtifactEnum fromValue(BaseArtifactEnum v) { for (DocumentArtifactEnum c: DocumentArtifactEnum.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v.toString()); }