/** * Updates the basic s-ramp meta data. * @param srampArtifact * @throws Exception */ private void updateArtifactMetaData(BaseArtifactType srampArtifact) throws Exception { artificerArtifact.setUuid(srampArtifact.getUuid()); artificerArtifact.setModel(artifactType.getModel()); // may have already been set... if (StringUtils.isBlank(artificerArtifact.getType())) { artificerArtifact.setType(artifactType.getType()); } ArtificerUser createdBy = HibernateEntityFactory.user(srampArtifact.getCreatedBy(), srampArtifact.getCreatedTimestamp()); artificerArtifact.setCreatedBy(createdBy); ArtificerUser modifiedBy = HibernateEntityFactory.user(srampArtifact.getLastModifiedBy(), srampArtifact.getLastModifiedTimestamp()); artificerArtifact.setModifiedBy(modifiedBy); if (srampArtifact.getName() != null) artificerArtifact.setName(srampArtifact.getName()); else artificerArtifact.setName(srampArtifact.getClass().getSimpleName()); artificerArtifact.setDescription(srampArtifact.getDescription()); artificerArtifact.setVersion(srampArtifact.getVersion()); }
translatorArtifact.setName(name); translatorArtifact.setDescription(description); LOGGER.debug("VdbManifestDeriver:translator name '{}'", translatorArtifact.getName()); //$NON-NLS-1$ LOGGER.debug("VdbManifestDeriver:translator description '{}'", translatorArtifact.getDescription()); //$NON-NLS-1$
vdbImportArtifact.setName(name); LOGGER.debug("VdbManifestDeriver:Import VDB name '{}'", vdbImportArtifact.getName()); //$NON-NLS-1$ LOGGER.debug("VdbManifestDeriver:Import VDB version '{}'", vdbImportArtifact.getVersion()); //$NON-NLS-1$ for (final Property prop : vdbImportArtifact.getProperty()) { LOGGER.debug("VdbManifestDeriver:Import VDB property '{}' with value '{}'", //$NON-NLS-1$ prop.getPropertyName(),
/** * @see java.util.LinkedList#add(java.lang.Object) */ @Override public boolean add(BaseArtifactType artifact) { // Pre-set the UUIDs for all the derived artifacts. This is useful // if something downstream needs to reference them. if (StringUtils.isBlank(artifact.getUuid())) { artifact.setUuid(UUID.randomUUID().toString()); } indexArtifact(artifact); return super.add(artifact); }
/** * Sets a property on the artifact. * @param artifact * @param propName * @param propValue */ private void setProperty(BaseArtifactType artifact, String propName, String propValue) { String propNameLC = propName.toLowerCase(); if (CORE_PROPERTIES.contains(propNameLC)) { if (propNameLC.equals("name")) { artifact.setName(propValue); } else if (propNameLC.equals("description")) { artifact.setDescription(propValue); } else if (propNameLC.equals("version")) { artifact.setVersion(propValue); } } else { ArtificerModelUtils.setCustomProperty(artifact, propName, propValue); } }
/** * Updates the basic s-ramp meta data. * @param artifact * @throws Exception */ private void updateArtifactMetaData(BaseArtifactType artifact) throws Exception { if (artifact.getName() != null) setProperty("sramp:name", artifact.getName()); //$NON-NLS-1$ else setProperty("sramp:name", artifact.getClass().getSimpleName()); //$NON-NLS-1$ if (artifact.getDescription() != null) setProperty("sramp:description", artifact.getDescription()); //$NON-NLS-1$ if (artifact.getVersion() != null) setProperty("version", artifact.getVersion()); //$NON-NLS-1$ setProperty("sramp:derived", this.artifactType.isDerived()); //$NON-NLS-1$ }
printProperty(Messages.i18n.format("PrintArtifact.Type"), artifactType.getArtifactType().getType()); printProperty(Messages.i18n.format("PrintArtifact.Model"), artifactType.getArtifactType().getModel()); printProperty(Messages.i18n.format("PrintArtifact.UUID"), artifact.getUuid()); printProperty(Messages.i18n.format("PrintArtifact.Name"), artifact.getName()); printProperty(Messages.i18n.format("PrintArtifact.Version"), artifact.getVersion()); printProperty(Messages.i18n.format("PrintArtifact.Derived"), String.valueOf(artifactType.isDerived())); String archiveUuid = artifact.getOtherAttributes().get(ArtificerConstants.ARTIFICER_EXPANDED_FROM_ARCHIVE_UUID_QNAME); if (StringUtils.isNotBlank(archiveUuid)) { printProperty(Messages.i18n.format("PrintArtifact.ExpandedFromArchive"), archiveUuid); printProperty(Messages.i18n.format("PrintArtifact.CreatedBy"), artifact.getCreatedBy()); if (artifact.getCreatedTimestamp() != null) printProperty(Messages.i18n.format("PrintArtifact.CreatedOn"), artifact.getCreatedTimestamp().toXMLFormat()); printProperty(Messages.i18n.format("PrintArtifact.ModifiedBy"), artifact.getLastModifiedBy()); if (artifact.getLastModifiedTimestamp() != null) printProperty(Messages.i18n.format("PrintArtifact.ModifiedOn"), artifact.getLastModifiedTimestamp().toXMLFormat()); if (artifact.getDescription() != null) { commandInvocation.getShell().out().println(Messages.i18n.format("PrintArtifact.DescriptionHeading")); commandInvocation.getShell().out().println(artifact.getDescription()); if (artifact.getClassifiedBy().size() > 0) { commandInvocation.getShell().out().println(Messages.i18n.format("PrintArtifact.ClassifiersHeading")); for (String classification : artifact.getClassifiedBy()) { printProperty(Messages.i18n.format("PrintArtifact.ClassifiedBy"), classification); if (artifact.getProperty().size() > 0) { commandInvocation.getShell().out().println(Messages.i18n.format("PrintArtifact.CustomPropsHeading")); for (Property property : artifact.getProperty()) { printProperty(property.getPropertyName(), property.getPropertyValue());
if (artifact.getDescription()==null) artifact.setDescription(project.getDescription()); if (artifact.getName()==null) artifact.setName(project.getName()); if (artifact.getVersion()==null) artifact.setVersion(project.getVersion());
srampArtifact.setDescription(artificerArtifact.getDescription()); srampArtifact.setArtifactType(artifactType.getArtifactType().getApiType()); srampArtifact.setCreatedBy(artificerArtifact.getCreatedBy().getUsername()); XMLGregorianCalendar createdTimestamp = HibernateEntityFactory.calendar(artificerArtifact.getCreatedBy().getLastActionTime()); srampArtifact.setCreatedTimestamp(createdTimestamp); srampArtifact.setLastModifiedBy(artificerArtifact.getModifiedBy().getUsername()); XMLGregorianCalendar modifiedTimestamp = HibernateEntityFactory.calendar(artificerArtifact.getModifiedBy().getLastActionTime()); srampArtifact.setLastModifiedTimestamp(modifiedTimestamp); srampArtifact.setName(artificerArtifact.getName()); srampArtifact.setUuid(artificerArtifact.getUuid()); srampArtifact.setVersion(artificerArtifact.getVersion()); srampProp.setPropertyName(artificerProperty.getKey()); srampProp.setPropertyValue(artificerProperty.getValue()); srampArtifact.getProperty().add(srampProp); srampArtifact.getOtherAttributes().put(ArtificerConstants.ARTIFICER_EXPANDED_FROM_ARCHIVE_UUID_QNAME, artificerArtifact.getExpandedFrom().getUuid()); srampArtifact.getOtherAttributes().put(ArtificerConstants.ARTIFICER_EXPANDED_FROM_ARCHIVE_PATH_QNAME, artificerArtifact.getExpandedFromArchivePath()); srampArtifact.getClassifiedBy().add(uri);
@Override protected CommandResult doExecute(CommandInvocation commandInvocation) throws Exception { if (CollectionUtils.isEmpty(arguments) || arguments.size() < 1) { return doHelp(commandInvocation); } String text = arguments.get(0); ArtificerAtomApiClient client = client(commandInvocation); BaseArtifactType artifact = currentArtifact(commandInvocation); try { client.addComment(artifact.getUuid(), ArtifactType.valueOf(artifact), text); commandInvocation.getShell().out().println(Messages.i18n.format("AddComment.Success", artifact.getName())); } catch (Exception e) { commandInvocation.getShell().out().println(Messages.i18n.format("AddComment.Failure")); commandInvocation.getShell().out().println("\t" + e.getMessage()); return CommandResult.FAILURE; } return CommandResult.SUCCESS; }
if (artifact.getUuid() != null) entry.setId(new URI(artifact.getUuid())); if (artifact.getLastModifiedTimestamp() != null) entry.setUpdated(artifact.getLastModifiedTimestamp().toGregorianCalendar().getTime()); if (artifact.getName() != null) entry.setTitle(artifact.getName()); if (artifact.getCreatedTimestamp() != null) entry.setPublished(artifact.getCreatedTimestamp().toGregorianCalendar().getTime()); if (artifact.getCreatedBy() != null) entry.getAuthors().add(new Person(artifact.getCreatedBy())); if (artifact.getDescription() != null) entry.setSummary(artifact.getDescription());
final String artifactName = derivedArtifact.getName(); assertThat(importVdb.getName(), is("x")); assertThat(importVdb.getVersion(), is("2")); assertPropertyValue(importVdb, VdbImport.PropertyId.VERSION, "2"); assertPropertyValue(importVdb, VdbImport.PropertyId.IMPORT_DATA_POLICIES, "true"); assertThat(importVdb.getProperty().size(), is(2)); // version, import data policies final List<Relationship> relationships = derivedArtifact.getRelationship(); assertThat(relationships.size(), is(1)); derivedArtifact.getUuid()); } else if (!foundTranslator && isExtendedType(derivedArtifact, VdbTranslator.ARTIFACT_TYPE)) { foundTranslator = true; assertThat(artifactName, is("oracleOverride")); assertThat(derivedArtifact.getDescription(), is("hello world")); assertThat(derivedArtifact.getProperty().size(), is(2)); assertPropertyValue(derivedArtifact, VdbTranslator.PropertyId.TYPE, "oracle"); assertPropertyValue(derivedArtifact, "my-property", "my-value"); final List<Relationship> relationships = derivedArtifact.getRelationship(); assertThat(relationships.size(), is(1)); derivedArtifact.getUuid()); } else if (isExtendedType(derivedArtifact, VdbEntry.ARTIFACT_TYPE)) { if (!foundEntry1 && "/path-one".equals(artifactName)) { foundEntry1 = true; assertThat(derivedArtifact.getDescription(), is("path one description")); assertPropertyValue(derivedArtifact, "entryone", "1");
/** * Creates a one way relationship. Creates the relationship instance if necessary. * * @param sourceArtifact the artifact where the relationship starts (cannot be <code>null</code>) * @param targetArtifact the artifact where the relationship ends (cannot be <code>null</code>) * @param relationshipType the relationship type (cannot be <code>null</code> or empty) */ public static void addRelationship( final BaseArtifactType sourceArtifact, final BaseArtifactType targetArtifact, final TeiidRelationshipType relationshipType ) { SrampModelUtils.addGenericRelationship(sourceArtifact, relationshipType.relationshipType(), targetArtifact.getUuid()); }
/** * Tests updating an artifact. * @throws Exception */ public void testUpdateArtifactMetaData() throws Exception { SrampAtomApiClient client = new SrampAtomApiClient(generateURL("/s-ramp")); //$NON-NLS-1$ String uuid = null; XsdDocument xsdDoc = null; // First, upload an artifact so we have some content to update String artifactFileName = "PO.xsd"; //$NON-NLS-1$ InputStream is = this.getClass().getResourceAsStream("/sample-files/xsd/" + artifactFileName); //$NON-NLS-1$ try { BaseArtifactType artifact = client.uploadArtifact(ArtifactType.XsdDocument(), is, artifactFileName); Assert.assertNotNull(artifact); Assert.assertEquals(artifactFileName, artifact.getName()); uuid = artifact.getUuid(); xsdDoc = (XsdDocument) artifact; } finally { IOUtils.closeQuietly(is); } // Now update the description xsdDoc.setDescription("** DESCRIPTION UPDATED **"); //$NON-NLS-1$ client.updateArtifactMetaData(xsdDoc); // Now verify BaseArtifactType artifact = client.getArtifactMetaData(ArtifactType.XsdDocument(), uuid.toString()); Assert.assertEquals("** DESCRIPTION UPDATED **", artifact.getDescription()); //$NON-NLS-1$ }
metaData.setName(propValArg); } else if ("description".equals(propNameArg)) { metaData.setDescription(propValArg); } else if ("version".equals(propNameArg)) { metaData.setVersion(propValArg); } else if ("createdBy".equals(propNameArg)) { metaData.setCreatedBy(propValArg); } else if ("lastModifiedBy".equals(propNameArg)) { metaData.setLastModifiedBy(propValArg); } else if ("uuid".equals(propNameArg)) { metaData.setUuid(propValArg); } else if ("createdTimestamp".equals(propNameArg)) { } else if ("lastModifiedTimestamp".equals(propNameArg)) {
dataPolicyArtifact.setName(name); LOGGER.debug("VdbManifestDeriver:processing '{}' mapped role names for data policy '{}'", //$NON-NLS-1$ roleNames.getLength(), dataPolicyArtifact.getName()); LOGGER.debug("VdbManifestDeriver:found mapped role name '{}' for data policy '{}'", dataPolicyArtifact.getName()); //$NON-NLS-1$ LOGGER.debug("VdbManifestDeriver:data policy name '{}'", dataPolicyArtifact.getName()); //$NON-NLS-1$ LOGGER.debug("VdbManifestDeriver:data policy description '{}'", dataPolicyArtifact.getDescription()); //$NON-NLS-1$ for (final Property prop : dataPolicyArtifact.getProperty()) { LOGGER.debug("VdbManifestDeriver:data policy property '{}' with value '{}'", //$NON-NLS-1$ prop.getPropertyName(), LOGGER.debug("VdbManifestDeriver:processing '{}' data permissions for data policy '{}'", //$NON-NLS-1$ permissions.getLength(), dataPolicyArtifact.getName()); XPathConstants.NODE); final String resourceName = element.getTextContent(); permissionArtifact.setName(resourceName); LOGGER.debug("VdbManifestDeriver:permission resource name '{}'", permissionArtifact.getName()); //$NON-NLS-1$ for (final Property prop : permissionArtifact.getProperty()) { LOGGER.debug("VdbManifestDeriver:Source property '{}' with value '{}'", //$NON-NLS-1$ prop.getPropertyName(),
/** * Tests the query manager. * @throws Exception */ @Test public void testQueryManager() throws Exception { // First, store an artifact. BaseArtifactType artifact = createDocument(1); log.info("persisted to JCR, returned artifact uuid=" + artifact.getUuid()); //$NON-NLS-1$ // Now query for it SrampQuery query = queryManager.createQuery("/s-ramp/core/Document"); //$NON-NLS-1$ ArtifactSet artifactSet = query.executeQuery(); Assert.assertNotNull(artifactSet); Assert.assertEquals(1, artifactSet.size()); BaseArtifactType found = artifactSet.iterator().next(); Assert.assertNotNull("Expected artifact not found in artifact set.", found); //$NON-NLS-1$ Assert.assertEquals(artifact.getUuid(), found.getUuid()); Assert.assertEquals(artifact.getName(), found.getName()); Assert.assertEquals(artifact.getDescription(), found.getDescription()); Assert.assertEquals(artifact.getLastModifiedBy(), found.getLastModifiedBy()); }
entryArtifact.setName(path); LOGGER.debug("VdbManifestDeriver:entry path '{}'", entryArtifact.getName()); //$NON-NLS-1$ LOGGER.debug("VdbManifestDeriver:entry description '{}'", entryArtifact.getDescription()); //$NON-NLS-1$
LOGGER.debug("VdbManifestDeriver:processing '{}' validation errors for schema '{}'", errors.getLength(), schemaArtifact.getName()); //$NON-NLS-1$ errorArtifact.setName(path); new Object[] {schemaArtifact.getName(), SrampModelUtils.getCustomProperty(errorArtifact, VdbValidationError.PropertyId.SEVERITY), errorArtifact.getName(), SrampModelUtils.getCustomProperty(errorArtifact, VdbValidationError.PropertyId.MESSAGE)});
LOGGER.debug("VdbManifestDeriver:processing '{}' sources for schema '{}'", sources.getLength(), schemaArtifact.getName()); //$NON-NLS-1$ sourceArtifact.setName(name); LOGGER.debug("VdbManifestDeriver:schema source name '{}'", sourceArtifact.getName()); //$NON-NLS-1$ for (final Property prop : sourceArtifact.getProperty()) { LOGGER.debug("VdbManifestDeriver:Source property '{}' with value '{}'", //$NON-NLS-1$ prop.getPropertyName(),