/** * Returns true if the archive is 1.) in the Extended model and 2.) of the given extended type. * * @param archiveExtendedType * @return boolean */ public boolean isExtendedTypeArchive(String archiveExtendedType) { if (archiveArtifactType != null) { return archiveArtifactType.isExtendedType() && archiveArtifactType.getExtendedType().equalsIgnoreCase(archiveExtendedType); } return false; }
/** * @return the artifact type */ public String getType() { if (getArtifactType() == ArtifactTypeEnum.ExtendedArtifactType || getArtifactType() == ArtifactTypeEnum.ExtendedDocument) { return getExtendedType(); } else { return getArtifactType().getType(); } }
String artifactModel = type.getArtifactType().getModel(); String artifactType = type.getArtifactType().getType(); if ("ext".equals(type.getArtifactType().getModel()) && type.getExtendedType()!=null) { artifactType = type.getExtendedType();
/** * Instantiates an S-RAMP artifact of the correct type, and populates the artifactType and the * contentType. * @param artifactType */ public BaseArtifactType newArtifactInstance() { try { BaseArtifactType baseArtifactType = getArtifactType().getTypeClass().newInstance(); baseArtifactType.setArtifactType(getArtifactType().getApiType()); if (DocumentArtifactType.class.isAssignableFrom(baseArtifactType.getClass())) { ((DocumentArtifactType) baseArtifactType).setContentType(getMimeType()); } if (getArtifactType() == ArtifactTypeEnum.ExtendedArtifactType) { baseArtifactType.getOtherAttributes().put(ArtificerConstants.SRAMP_CONTENT_TYPE_QNAME, getMimeType()); ((ExtendedArtifactType) baseArtifactType).setExtendedType(getExtendedType()); } if (getArtifactType() == ArtifactTypeEnum.ExtendedDocument) { baseArtifactType.getOtherAttributes().put(ArtificerConstants.SRAMP_CONTENT_TYPE_QNAME, getMimeType()); ((ExtendedDocument) baseArtifactType).setExtendedType(getExtendedType()); } return baseArtifactType; } catch (Exception e) { throw new RuntimeException(Messages.i18n.format("ARTIFACT_INSTANTIATION_ERROR", getArtifactType().getTypeClass()), e); } }
artifactType = ArtifactType.valueOf(type); if (artifactType.isExtendedType()) { artifactType = ArtifactType.ExtendedDocument(artifactType.getExtendedType());
public BaseArtifactType addComment(String uuid, ArtifactType type, String text) throws ArtificerClientException, ArtificerServerException { assertFeatureEnabled(type); ClientResponse<Entry> response = null; try { String artifactModel = type.getArtifactType().getModel(); String artifactType = type.getArtifactType().getType(); if ("ext".equals(type.getArtifactType().getModel()) && type.getExtendedType() != null) { artifactType = type.getExtendedType(); } String atomUrl = String.format("%1$s/%2$s/%3$s/%4$s/comment", srampEndpoint, artifactModel, artifactType, uuid); ClientRequest request = createClientRequest(atomUrl); request.body(MediaType.TEXT_PLAIN, text); response = request.post(Entry.class); Entry entry = response.getEntity(); return ArtificerAtomUtils.unwrapSrampArtifact(type, entry); } catch (ArtificerServerException e) { throw e; } catch (Throwable e) { throw new ArtificerClientException(e); } finally { closeQuietly(response); } }
ArtifactType type = summary.getArtifactType(); String displayType = type.getArtifactType().getType().toString(); if (type.isExtendedType() && type.getExtendedType() != null) { displayType = type.getExtendedType();
public static BaseArtifactType visit(ArtificerArtifact artificerArtifact, ArtifactType artifactType, boolean includeAssociations) throws Exception { if (artifactType.isExtendedType() && artificerArtifact.isDocument()) { artifactType = ArtifactType.ExtendedDocument(artifactType.getExtendedType()); } BaseArtifactType srampArtifact = artifactType.newArtifactInstance(); HibernateEntityToSrampVisitor visitor = new HibernateEntityToSrampVisitor(artificerArtifact, artifactType, includeAssociations); ArtifactVisitorHelper.visitArtifact(visitor, srampArtifact); visitor.throwError(); return srampArtifact; }
ArtifactType type = summary.getArtifactType(); String displayType = type.getArtifactType().getType().toString(); if (type.isExtendedType() && type.getExtendedType() != null) { displayType = type.getExtendedType();
String artifactModel = type.getArtifactType().getModel(); String artifactType = type.getArtifactType().getType(); if ("ext".equals(type.getArtifactType().getModel()) && type.getExtendedType()!=null) { artifactType = type.getExtendedType();
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; }
artifactType = ArtifactType.valueOf(type); if (artifactType.isExtendedType()) { artifactType = ArtifactType.ExtendedDocument(artifactType.getExtendedType());
commandInvocation.getShell().out().println(Messages.i18n.format("PrintArtifact.CoreHeading")); if (artifactType.isExtendedType()) printProperty(Messages.i18n.format("PrintArtifact.Type"), artifactType.getExtendedType()); else printProperty(Messages.i18n.format("PrintArtifact.Type"), artifactType.getArtifactType().getType());