/** * @param extendedType the extended artifact type of the artifact to create (cannot be <code>null</code> or empty) * @return the created artifact (never <code>null</code>) */ private static BaseArtifactType create( final TeiidExtendedType extendedType ) { final ExtendedArtifactType artifact = new ExtendedArtifactType(); artifact.setArtifactType(BaseArtifactEnum.EXTENDED_ARTIFACT_TYPE); artifact.setExtendedType(extendedType.extendedType()); artifact.setUuid(UUID.randomUUID().toString()); return artifact; }
/** * Creates a new extended artifact type for a SwitchYard artifact. * @param name */ private static final ExtendedArtifactType newArtifact(String switchYardType, String name) { ExtendedArtifactType artifact = new ExtendedArtifactType(); artifact.setArtifactType(BaseArtifactEnum.EXTENDED_ARTIFACT_TYPE); artifact.setExtendedType(switchYardType); artifact.setUuid(UUID.randomUUID().toString()); artifact.setName(name); return artifact; }
name = componentSvc.getAttribute("name"); //$NON-NLS-1$ ExtendedArtifactType componentServiceArtifact = SwitchYardModel.newComponentServiceArtifact(name); componentServiceArtifact.setUuid(UUID.randomUUID().toString()); derivedArtifacts.add(componentServiceArtifact); SrampModelUtils.addGenericRelationship(componentArtifact, SwitchYardModel.REL_OFFERS, componentServiceArtifact.getUuid());
/** * @param derivedArtifacts * @param artifact * @param rootElement * @param xpath * @throws XPathExpressionException */ private void processRoot(Collection<BaseArtifactType> derivedArtifacts, BaseArtifactType artifact, Element rootElement, XPath xpath) throws XPathExpressionException { NodeList nodes = (NodeList) this.query(xpath, rootElement, "./credit", XPathConstants.NODESET); //$NON-NLS-1$ for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); ExtendedArtifactType credit = new ExtendedArtifactType(); credit.setArtifactType(BaseArtifactEnum.EXTENDED_ARTIFACT_TYPE); credit.setUuid(UUID.randomUUID().toString()); String type = node.getAttribute("type"); //$NON-NLS-1$ String name = node.getAttribute("name"); //$NON-NLS-1$ String part = node.getAttribute("part"); //$NON-NLS-1$ String year = node.getAttribute("year"); //$NON-NLS-1$ credit.setExtendedType(StringUtils.capitalize(type) + "Credit"); //$NON-NLS-1$ credit.setName(name); SrampModelUtils.setCustomProperty(credit, "part", part); //$NON-NLS-1$ SrampModelUtils.setCustomProperty(credit, "year", year); //$NON-NLS-1$ derivedArtifacts.add(credit); // Set a relationship from original artifact to the listener credit.setUuid(UUID.randomUUID().toString()); SrampModelUtils.addGenericRelationship(artifact, "hasCredit", credit.getUuid()); //$NON-NLS-1$ } }
extendedArtifact.setExtendedType("FooArtifactType"); //$NON-NLS-1$ extendedArtifact.setName("MyExtendedArtifact"); //$NON-NLS-1$ extendedArtifact.setUuid("12345"); //$NON-NLS-1$ try { persistenceManager.persistArtifact(document, pdf);