private void setDescriptionFromElementValue( final Element parent, final String elementName, final BaseArtifactType artifact, final XPath xpath ) throws Exception { final Element element = (Element)query(xpath, parent, Utils.getElementQueryString(elementName), XPathConstants.NODE); if (element != null) { final String description = element.getTextContent(); artifact.setDescription(description); } }
/** * 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); } }
translatorArtifact.setDescription(description);
metaData.setName(propValArg); } else if ("description".equals(propNameArg)) { metaData.setDescription(propValArg); } else if ("version".equals(propNameArg)) { metaData.setVersion(propValArg);
artifact.setDescription(description);
XMLGregorianCalendar createdTS = dtFactory.newXMLGregorianCalendar(getProperty(jcrNode, "jcr:created")); //$NON-NLS-1$ artifact.setCreatedTimestamp(createdTS); artifact.setDescription(getProperty(jcrNode, "sramp:description")); //$NON-NLS-1$ artifact.setLastModifiedBy(getProperty(jcrNode, "jcr:lastModifiedBy")); //$NON-NLS-1$ XMLGregorianCalendar modifiedTS = dtFactory.newXMLGregorianCalendar(getProperty(jcrNode, "jcr:lastModified")); //$NON-NLS-1$
protected CommandResult doExecute(CommandInvocation commandInvocation) throws Exception { ArtificerAtomApiClient client = client(commandInvocation); ArtifactType artifactType = ArtifactType.valueOf(type); if (artifactType.isExtendedType()) { artifactType = ArtifactType.ExtendedArtifactType(artifactType.getExtendedType(), false); } if (artifactType.isDerived()) { commandInvocation.getShell().out().println(Messages.i18n.format("ArtifactModel.isDerived")); return CommandResult.FAILURE; } else if (artifactType.isDocument()) { commandInvocation.getShell().out().println(Messages.i18n.format("ArtifactModel.isDocument")); return CommandResult.FAILURE; } else { BaseArtifactType artifact = artifactType.newArtifactInstance(); artifact.setName(name); artifact.setDescription(description); artifact = client.createArtifact(artifact); // Put the artifact in the session as the active artifact context(commandInvocation).setCurrentArtifact(artifact); } commandInvocation.getShell().out().println(Messages.i18n.format("CreateArtifactCommand.Successful", name)); return CommandResult.SUCCESS; }
if (artifact.getDescription()==null) artifact.setDescription(project.getDescription()); if (artifact.getName()==null) artifact.setName(project.getName()); if (artifact.getVersion()==null) artifact.setVersion(project.getVersion());
metaData.setName("PO.xsd"); //$NON-NLS-1$ metaData.setVersion("1.1"); //$NON-NLS-1$ metaData.setDescription("This is a test description (XSD)."); //$NON-NLS-1$ archive.addEntry("schemas/PO.xsd", metaData, is1); //$NON-NLS-1$ metaData.setName("PO.xml"); //$NON-NLS-1$ metaData.setVersion("1.2"); //$NON-NLS-1$ metaData.setDescription("This is a test description (XML)."); //$NON-NLS-1$ archive.addEntry("core/PO.xml", metaData, null); //$NON-NLS-1$ } catch (Exception e) {
metaData.setName("PO.xsd"); //$NON-NLS-1$ metaData.setVersion("1.1"); //$NON-NLS-1$ metaData.setDescription("This is a test description (XSD)."); //$NON-NLS-1$ archive.addEntry("schemas/PO.xsd", metaData, is1); //$NON-NLS-1$ metaData.setName("PO.xml"); //$NON-NLS-1$ metaData.setVersion("1.2"); //$NON-NLS-1$ metaData.setDescription("This is a test description (XML)."); //$NON-NLS-1$ archive.addEntry("core/PO.xml", metaData, is2); //$NON-NLS-1$ } catch (Exception e) {
@Test public void testLastModifiedBy() throws Exception { BaseArtifactType artifact = createArtifact(null); // Now update the artifact as a different user. MockSecurityContext.currentUser = "junituser2"; //$NON-NLS-1$ artifact.setDescription("New description of the artifact."); //$NON-NLS-1$ persistenceManager.updateArtifact(artifact, ArtifactType.Document()); MockSecurityContext.currentUser = "junituser"; //$NON-NLS-1$ artifact = persistenceManager.getArtifact(artifact.getUuid(), ArtifactType.Document()); Assert.assertEquals("junituser", artifact.getCreatedBy()); //$NON-NLS-1$ Assert.assertEquals("junituser2", artifact.getLastModifiedBy()); //$NON-NLS-1$ }
srampArtifact.setDescription(artificerArtifact.getDescription()); srampArtifact.setArtifactType(artifactType.getArtifactType().getApiType()); srampArtifact.setCreatedBy(artificerArtifact.getCreatedBy().getUsername());
artifact.setDescription("A new description of the PO.xsd artifact."); //$NON-NLS-1$ artifact.setVersion("2.0.13"); //$NON-NLS-1$ persistenceManager.updateArtifact(artifact, ArtifactType.XsdDocument());
artifact.setDescription("Sample description."); //$NON-NLS-1$ SrampModelUtils.setCustomProperty(artifact, "foo", "bar"); //$NON-NLS-1$ //$NON-NLS-2$ SrampModelUtils.setCustomProperty(artifact, "hello", null); //$NON-NLS-1$