/** * @return true if the artifact is a document artifact */ public boolean isDocument() { if (isDerived()) { return false; } else { return getArtifactType().isDocument(); } }
private static ArtifactSummary summary(Entry entry) { ArtifactSummary summary = new ArtifactSummary(); summary.setUuid(entry.getId().toString().replace("urn:uuid:", "")); summary.setName(entry.getTitle()); summary.setDescription(entry.getSummary()); ArtifactType artifactType = ArtificerAtomUtils.getArtifactType(entry); summary.setModel(artifactType.getModel()); summary.setType(artifactType.getType()); summary.setDerived(artifactType.isDerived()); summary.setExtensionAttributes(entry.getExtensionAttributes()); if (entry.getPublished() != null) { Calendar published = Calendar.getInstance(); published.setTime(entry.getPublished()); summary.setCreatedTimestamp(published); } if (entry.getAuthors() != null && entry.getAuthors().size() > 0) { summary.setCreatedBy(entry.getAuthors().get(0).getName()); } if (entry.getUpdated() != null) { Calendar updated = Calendar.getInstance(); updated.setTime(entry.getUpdated()); summary.setLastModifiedTimestamp(updated); } summary.setExpandedFromArchive("true".equals(entry.getExtensionAttributes().get(ArtificerConstants.ARTIFICER_EXPANDED_FROM_ARCHIVE_QNAME))); return summary; } }
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; }
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)) {