/** * Fetches the given artifact on the registry. * * @param artifactId the identifier of the artifact. * * @return the artifact. * @throws GovernanceException if the operation failed. */ public GovernanceArtifact getGovernanceArtifact(String artifactId) throws GovernanceException { return GovernanceUtils.retrieveGovernanceArtifactById(registry, artifactId); }
/** * Fetches the given policy artifact on the registry. * * @param policyId the identifier of the policy artifact. * * @return the policy artifact. * @throws GovernanceException if the operation failed. */ public Policy getPolicy(String policyId) throws GovernanceException { GovernanceArtifact artifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, policyId); if (artifact != null && !(artifact instanceof Policy)) { String msg = "The artifact request is not a policy. id: " + policyId + "."; log.error(msg); throw new GovernanceException(msg); } return (Policy) artifact; }
/** * Fetches the given endpoint artifact on the registry. * * @param endpointId the identifier of the endpoint artifact. * * @return the endpoint artifact. * @throws GovernanceException if the operation failed. */ public Endpoint getEndpoint(String endpointId) throws GovernanceException { GovernanceArtifact artifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, endpointId); if (artifact != null && !(artifact instanceof Endpoint)) { String msg = "The artifact request is not an endpoint. id: " + endpointId + "."; log.error(msg); throw new GovernanceException(msg); } return (Endpoint) artifact; }
/** * Fetches the given schema artifact on the registry. * * @param schemaId the identifier of the schema artifact. * * @return the schema artifact. * @throws GovernanceException if the operation failed. */ public Schema getSchema(String schemaId) throws GovernanceException { GovernanceArtifact artifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, schemaId); if (artifact != null && !(artifact instanceof Schema)) { String msg = "The artifact request is not a Schema. id: " + schemaId + "."; log.error(msg); throw new GovernanceException(msg); } return (Schema) artifact; }
/** * Fetches the given WSDL artifact on the registry. * * @param wsdlId the identifier of the WSDL artifact. * * @return the WSDL artifact. * @throws GovernanceException if the operation failed. */ public Wsdl getWsdl(String wsdlId) throws GovernanceException { GovernanceArtifact artifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, wsdlId); if (artifact != null && !(artifact instanceof Wsdl)) { String msg = "The artifact request is not a Wsdl. id: " + wsdlId + "."; log.error(msg); throw new GovernanceException(msg); } return (Wsdl) artifact; }
@Override public LCStateBean getLifeCycleStateBean(String artifactId, String artifactLC) throws LifeCycleException { try { UserRegistry registry = (UserRegistry) getGovernanceUserRegistry(); UserRealm userRealm = registry.getUserRealm(); String[] roleNames = userRealm.getUserStoreManager().getRoleListOfUser(registry.getUserName()); String path = GovernanceUtils.getArtifactPath(registry, artifactId); if (path != null) { removeCache(registry, path); Resource resource = registry.get(path); LCStateBean lifeCycleStateBean = getCheckListItems(resource, artifactLC, roleNames, registry); GovernanceArtifact governanceArtifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, artifactId); Map<String, String> currentStateDurationData = governanceArtifact .getCurrentStateDuration(artifactId, artifactLC); if (currentStateDurationData != null && !currentStateDurationData.isEmpty()) { lifeCycleStateBean .setLifeCycleCurrentStateDuration(currentStateDurationData.get("currentStateDuration")); lifeCycleStateBean .setLifeCycleCurrentStateDurationColour(currentStateDurationData.get("durationColour")); } return lifeCycleStateBean; } else { throw new LifeCycleException("Unable to find the artifact " + artifactId); } } catch (UserStoreException | RegistryException e) { throw new LifeCycleException(e); } }