/** * @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; } }
if (derivedArtifact instanceof DerivedArtifactType) { DerivedArtifactType dat = (DerivedArtifactType) derivedArtifact; if (dat.getRelatedDocument() == null) { 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); } }
Assert.assertEquals("findRequest", artifact.getName()); //$NON-NLS-1$ Assert.assertEquals("findRequest", ((Message) artifact).getNCName()); //$NON-NLS-1$ Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl", ((Message) artifact).getNamespace()); //$NON-NLS-1$ Assert.assertEquals("findResponse", artifact.getName()); //$NON-NLS-1$ Assert.assertEquals("findResponse", ((ElementDeclaration) artifact).getNCName()); //$NON-NLS-1$ Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl/types", ((ElementDeclaration) artifact).getNamespace()); //$NON-NLS-1$ Assert.assertEquals("keywordType", artifact.getName()); //$NON-NLS-1$ Assert.assertEquals("keywordType", ((SimpleTypeDeclaration) artifact).getNCName()); //$NON-NLS-1$ Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl/types", ((SimpleTypeDeclaration) artifact).getNamespace()); //$NON-NLS-1$ String typeUuid = artifact.getUuid(); Assert.assertEquals("keyword", artifact.getName()); //$NON-NLS-1$ Part part = (Part) artifact; Assert.assertEquals("keyword", part.getNCName()); //$NON-NLS-1$ Assert.assertEquals("SamplePortType", artifact.getName()); //$NON-NLS-1$ Assert.assertEquals("SamplePortType", ((PortType) artifact).getNCName()); //$NON-NLS-1$ Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl", ((PortType) artifact).getNamespace()); //$NON-NLS-1$ Assert.assertEquals("find", artifact.getName()); //$NON-NLS-1$ Operation operation = (Operation) artifact; Assert.assertEquals("find", operation.getNCName()); //$NON-NLS-1$ Assert.assertEquals("findRequest", artifact.getName()); //$NON-NLS-1$ OperationInput operationInput = (OperationInput) artifact; Assert.assertEquals("findRequest", operationInput.getNCName()); //$NON-NLS-1$
if (derivedArtifact instanceof DerivedArtifactType) { DerivedArtifactType dat = (DerivedArtifactType) derivedArtifact; if (dat.getRelatedDocument() == null) { DocumentArtifactTarget related = new DocumentArtifactTarget(); related.setValue(primaryArtifact.getUuid()); related.setArtifactType(DocumentArtifactEnum.fromValue(primaryArtifact.getArtifactType())); dat.setRelatedDocument(related);
@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); } }
/** * @see HierarchicalArtifactVisitor#visitDerived(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.DerivedArtifactType) */ @Override protected void visitDerived(DerivedArtifactType artifact) { DocumentArtifactTarget relatedDocument = artifact.getRelatedDocument(); visitRelationship("relatedDocument", relatedDocument, false); super.visitDerived(artifact); }
/** * @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) { DocumentArtifactTarget relatedDocument = artifact.getRelatedDocument(); visitRelationship("relatedDocument", relatedDocument); //$NON-NLS-1$ super.visitDerived(artifact); }
/** * @see org.artificer.common.visitors.HierarchicalArtifactVisitor#visitDerived(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.DerivedArtifactType) */ @Override protected void visitDerived(DerivedArtifactType artifact) { commandInvocation.getShell().out().println(Messages.i18n.format("PrintArtifact.DerivedArtifactInfoHeading")); DocumentArtifactTarget relatedDocument = artifact.getRelatedDocument(); printRelationship(Messages.i18n.format("PrintArtifact.RelatedDoc"), relatedDocument); }
for (BaseArtifactType derivedArtifact : derivedArtifacts) { DerivedArtifactType dat = (DerivedArtifactType) derivedArtifact; Assert.assertEquals(testSrcArtifact.getUuid(), dat.getRelatedDocument().getValue()); Assert.assertEquals(DocumentArtifactEnum.XSD_DOCUMENT, dat.getRelatedDocument().getArtifactType());