Class GovernanceArtifactImpl
java.lang.Object
org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl
- All Implemented Interfaces:
GovernanceArtifact
- Direct Known Subclasses:
EndpointImpl,GenericArtifactImpl,PolicyImpl,SchemaImpl,ServiceImpl,WsdlImpl
Governance Artifact abstract class, This is overwritten by Endpoint, Policy, Schema, Service,
WSDL, People classes. This keeps common methods shared by all the governance artifacts
-
Field Summary
FieldsModifier and TypeFieldDescriptionMap of attributes associated with this governance artifact.Map of properties associated with this governance artifact. -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstruct a governance artifact.Construct a governance artifact object from the path and the id.GovernanceArtifactImpl(String id, org.apache.axiom.om.OMElement contentElement) Constructor accepting resource identifier and the XML content.GovernanceArtifactImpl(String id, org.apache.axiom.om.OMElement contentElement, List<String> uniqueAttributes) protectedGovernanceArtifactImpl(GovernanceArtifactImpl artifact) Copy constructor used for cloning.protectedGovernanceArtifactImpl(GovernanceArtifactImpl artifact, List<String> uniqueAttributes) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAssociation(String associationType, String artifactId) voidaddAssociation(String associationType, GovernanceArtifact attachedToArtifact) voidaddAttribute(String key, String value) Adding an attribute to the artifact.voidaddBidirectionalAssociation(String forwardType, String backwardType, GovernanceArtifact attachedToArtifact) voidvoidvoidassociateRegistry(org.wso2.carbon.registry.core.Registry registry) Associate a registry, this is mostly used by the artifact manager when creating the artifact.voidvoidattach(GovernanceArtifact attachedToArtifact) Attach the current artifact to an another artifact.voidattachLifecycle(String name) Associates the named lifecycle with the artifactvoidcheckLCItem(int order, String aspectName) Check the checklist itemprotected voidValidate the resource is associated with a registrybooleancompareTo(GovernanceArtifact artifact) static GovernanceArtifactImplstatic GovernanceArtifactImplcreate(org.wso2.carbon.registry.core.Registry registry, String artifactId, List<String> uniqueAttributes) static GovernanceArtifactImplcreate(org.wso2.carbon.registry.core.Registry registry, String artifactId, org.apache.axiom.om.OMElement content) static GovernanceArtifactImplcreate(org.wso2.carbon.registry.core.Registry registry, String artifactId, org.apache.axiom.om.OMElement content, List<String> uniqueAttributes) voidCreate a version of the artifact.voidDetach the current artifact from the provided artifact.voiddetachLifecycle(String lifecycleName) De-associate lifecycle associated with the artifactbooleanString[]getAllCheckListItemNames(String aspectName) Retrieve name set of the checklist itemsString[]getAllLifecycleActions(String lifeCycleName) Get all lifecycle actions for the current state of the lifecycleString[]Retrieve action set which need votes.String[]getAllVotingItems(String aspectName) Retrieve action set which need votes.protected org.wso2.carbon.registry.core.RegistryReturns the associated registry to the artifact.getAttribute(String key) Returns the attribute of a given key.String[]Returns the available attribute keysString[]getAttributes(String key) Returns the attribute values for a key.getCurrentStateDuration(String artifactID, String lcName) This method is used to get a lifecycle's current state duration information.Get dependencies of an artifacts.Get dependents of an artifact.getId()Returns the id of the artifactReturns the name of the lifecycle associated with this artifact.String[]Returns the name of the lifecycle associated with this artifact.Returns the state of the lifecycle associated with this artifact.getLifecycleState(String lifeCycleName) Returns the state of the lifecycle associated with this artifact.Returns the media type of the artifact.getPath()Returns the path of the artifact, need to save the artifact before getting the path.String[]Returns the available attribute keysvoidinvokeAction(String action, String aspectName) Invoke lifecycle actionvoidInvoke lifecycle actionbooleanisLCItemChecked(int order, String aspectName) Check whether the given ordered lifecycle checklist item is checked or notbooleanbooleanisVoted(int order) Check whether the current user voted for given order event.booleanCheck whether the current user voted for given order eventlistTags()voidremoveAssociation(String artifactId) voidremoveAssociation(String associationType, String artifactId) voidremoveAttribute(String key) Remove attribute with the given key.voidvoidremoveTags(List<String> tags) voidsetArtifactPath(String artifactPath) voidsetAttribute(String key, String newValue) Set/Update an attribute with a single value.voidsetAttributes(String key, String[] newValues) Set/Update an attribute with multiple values.voidSet the idvoidvoidsetLcState(String lcState) voidsetUniqueAttributes(List<String> uniqueAttributes) toString()voiduncheckLCItem(int order, String aspectName) Un-check the checklist itembooleanuniqueTo(GovernanceArtifact artifact) voidunvote(int order) Unvote for an action.voidUnvote for an actionvoidupdate the path after moving the resource.voidupdatePath(String artifactId) update the path after moving the resource.voidvote(int order) Vote for an action.voidVote for an action.Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifact
getQName, setQName
-
Field Details
-
attributes
Map of attributes associated with this governance artifact. -
properties
Map of properties associated with this governance artifact.
-
-
Constructor Details
-
GovernanceArtifactImpl
Construct a governance artifact object from the path and the id.- Parameters:
id- the id
-
GovernanceArtifactImpl
public GovernanceArtifactImpl()Construct a governance artifact. The default constructor. -
GovernanceArtifactImpl
Copy constructor used for cloning.- Parameters:
artifact- the object to be copied.
-
GovernanceArtifactImpl
-
GovernanceArtifactImpl
public GovernanceArtifactImpl(String id, org.apache.axiom.om.OMElement contentElement) throws GovernanceException Constructor accepting resource identifier and the XML content.- Parameters:
id- the resource identifier.contentElement- an XML element containing the content.- Throws:
GovernanceException- if the construction fails.
-
GovernanceArtifactImpl
public GovernanceArtifactImpl(String id, org.apache.axiom.om.OMElement contentElement, List<String> uniqueAttributes) throws GovernanceException - Throws:
GovernanceException
-
-
Method Details
-
getUniqueAttributes
-
setUniqueAttributes
-
getLcName
-
setLcName
-
getLcState
-
setLcState
-
getArtifactPath
-
setArtifactPath
-
create
public static GovernanceArtifactImpl create(org.wso2.carbon.registry.core.Registry registry, String artifactId) throws GovernanceException - Throws:
GovernanceException
-
create
public static GovernanceArtifactImpl create(org.wso2.carbon.registry.core.Registry registry, String artifactId, org.apache.axiom.om.OMElement content) throws GovernanceException - Throws:
GovernanceException
-
create
public static GovernanceArtifactImpl create(org.wso2.carbon.registry.core.Registry registry, String artifactId, List<String> uniqueAttributes) throws GovernanceException - Throws:
GovernanceException
-
create
public static GovernanceArtifactImpl create(org.wso2.carbon.registry.core.Registry registry, String artifactId, org.apache.axiom.om.OMElement content, List<String> uniqueAttributes) throws GovernanceException - Throws:
GovernanceException
-
getId
Returns the id of the artifact- Specified by:
getIdin interfaceGovernanceArtifact- Returns:
- the id
-
setId
Set the id- Specified by:
setIdin interfaceGovernanceArtifact- Parameters:
id- the id
-
getPath
Returns the path of the artifact, need to save the artifact before getting the path.- Specified by:
getPathin interfaceGovernanceArtifact- Returns:
- here we return the path of the artifact.
- Throws:
GovernanceException- if an error occurred.
-
getMediaType
Description copied from interface:GovernanceArtifactReturns the media type of the artifact.- Specified by:
getMediaTypein interfaceGovernanceArtifact- Returns:
- the media type of the artifact
-
getLifecycleName
Returns the name of the lifecycle associated with this artifact.- Specified by:
getLifecycleNamein interfaceGovernanceArtifact- Returns:
- the name of the lifecycle associated with this artifact.
- Throws:
GovernanceException- if an error occurred.
-
getLifecycleNames
Returns the name of the lifecycle associated with this artifact.- Specified by:
getLifecycleNamesin interfaceGovernanceArtifact- Returns:
- the name of the lifecycle associated with this artifact.
- Throws:
GovernanceException- if an error occurred.
-
attachLifecycle
Associates the named lifecycle with the artifact- Specified by:
attachLifecyclein interfaceGovernanceArtifact- Parameters:
name- the name of the lifecycle to be associated with this artifact.- Throws:
GovernanceException- if an error occurred.
-
detachLifecycle
De-associate lifecycle associated with the artifact- Throws:
GovernanceException- if an error occurred.
-
getLifecycleState
Returns the state of the lifecycle associated with this artifact.- Specified by:
getLifecycleStatein interfaceGovernanceArtifact- Returns:
- the state of the lifecycle associated with this artifact.
- Throws:
GovernanceException- if an error occurred.
-
getLifecycleState
Returns the state of the lifecycle associated with this artifact.- Specified by:
getLifecycleStatein interfaceGovernanceArtifact- Parameters:
lifeCycleName- the name of the lifecycle of which the state is required- Returns:
- the state of the lifecycle associated with this artifact.
- Throws:
GovernanceException- if an error occurred.
-
updatePath
update the path after moving the resource.- Throws:
GovernanceException- if an error occurred.
-
updatePath
update the path after moving the resource.- Parameters:
artifactId- id of the artifact- Throws:
GovernanceException- if an error occurred.
-
createVersion
Create a version of the artifact.- Throws:
GovernanceException- throws if the operation failed.
-
associateRegistry
public void associateRegistry(org.wso2.carbon.registry.core.Registry registry) throws GovernanceException Associate a registry, this is mostly used by the artifact manager when creating the artifact.- Parameters:
registry- the registry.- Throws:
GovernanceException- throws if the operation failed.
-
addAttribute
Adding an attribute to the artifact. The artifact should be saved to get effect the change. In the case of a single-valued attribute, this method will set or replace the existing attribute with the provided value. In the case of a multi-valued attribute, this method will append the provided value to the existing list.- Specified by:
addAttributein interfaceGovernanceArtifact- Parameters:
key- the key.value- the value.- Throws:
GovernanceException- throws if the operation failed.
-
setAttributes
Set/Update an attribute with multiple values. The artifact should be saved to get effect the change.- Specified by:
setAttributesin interfaceGovernanceArtifact- Parameters:
key- the keynewValues- the value- Throws:
GovernanceException- throws if the operation failed.
-
setAttribute
Set/Update an attribute with a single value. The artifact should be saved to get effect the change. This method will replace the existing attribute with the provided value. In the case of a multi-valued attribute this will remove all existing values. If you want to append the provided value to a list values of a multi-valued attribute, use the addAttribute method instead.- Specified by:
setAttributein interfaceGovernanceArtifact- Parameters:
key- the keynewValue- the value- Throws:
GovernanceException- throws if the operation failed.
-
getAttribute
Returns the attribute of a given key.- Specified by:
getAttributein interfaceGovernanceArtifact- Parameters:
key- the key- Returns:
- the value of the attribute, if there are more than one attribute for the key this returns the first value.
- Throws:
GovernanceException- throws if the operation failed.
-
getAttributeKeys
Returns the available attribute keys- Specified by:
getAttributeKeysin interfaceGovernanceArtifact- Returns:
- an array of attribute keys.
- Throws:
GovernanceException- throws if the operation failed.
-
getAttributes
Returns the attribute values for a key.- Specified by:
getAttributesin interfaceGovernanceArtifact- Parameters:
key- the key.- Returns:
- attribute values for the key.
- Throws:
GovernanceException- throws if the operation failed.
-
removeAttribute
Remove attribute with the given key. The artifact should be saved to get effect the change.- Specified by:
removeAttributein interfaceGovernanceArtifact- Parameters:
key- the key- Throws:
GovernanceException- throws if the operation failed.
-
getDependencies
Get dependencies of an artifacts. The artifacts should be saved, before calling this method.- Specified by:
getDependenciesin interfaceGovernanceArtifact- Returns:
- an array of dependencies of this artifact.
- Throws:
GovernanceException- throws if the operation failed.
-
getDependents
Get dependents of an artifact. The artifacts should be saved, before calling this method.- Specified by:
getDependentsin interfaceGovernanceArtifact- Returns:
- an array of artifacts that is dependent on this artifact.
- Throws:
GovernanceException- throws if the operation failed.
-
getAllLifecycleActions
Get all lifecycle actions for the current state of the lifecycle- Specified by:
getAllLifecycleActionsin interfaceGovernanceArtifact- Parameters:
lifeCycleName- lifecycle name of which actions are needed- Returns:
- Action set which can be invoked
- Throws:
GovernanceException- throws if the operation failed.
-
invokeAction
Invoke lifecycle action- Specified by:
invokeActionin interfaceGovernanceArtifact- Parameters:
action- lifecycle action tobe invokedaspectName- aspect name of which the action need to be invoked- Throws:
GovernanceException- throws if the operation failed.
-
invokeAction
public void invokeAction(String action, Map<String, String> parameters, String aspectName) throws GovernanceExceptionInvoke lifecycle action- Specified by:
invokeActionin interfaceGovernanceArtifact- Parameters:
action- lifecycle action tobe invokedparameters- extra parameters needed when promotingaspectName- aspect name of which the action need to be invoked- Throws:
GovernanceException- throws if the operation failed.
-
getAllCheckListItemNames
Retrieve name set of the checklist items- Specified by:
getAllCheckListItemNamesin interfaceGovernanceArtifact- Parameters:
aspectName- lifecycle name of which action to be invoked- Returns:
- Checklist item name set
- Throws:
GovernanceException- throws if the operation failed.
-
checkLCItem
Check the checklist item- Specified by:
checkLCItemin interfaceGovernanceArtifact- Parameters:
order- order of the checklist item need to checkedaspectName- lifecycle name of which action to be invoked- Throws:
GovernanceException- throws if the operation failed.
-
isLCItemChecked
Check whether the given ordered lifecycle checklist item is checked or not- Specified by:
isLCItemCheckedin interfaceGovernanceArtifact- Parameters:
order- order of the checklist item need to uncheckedaspectName- lifecycle name of which action to be invoked- Returns:
- whether the given ordered lifecycle checklist item is checked or not
- Throws:
GovernanceException- throws if the operation failed.
-
uncheckLCItem
Un-check the checklist item- Specified by:
uncheckLCItemin interfaceGovernanceArtifact- Parameters:
order- order of the checklist item need to uncheckedaspectName- lifecycle name of which action to be invoked- Throws:
GovernanceException- throws if the operation failed.
-
getAllVotingItems
Retrieve action set which need votes.- Specified by:
getAllVotingItemsin interfaceGovernanceArtifact- Parameters:
aspectName- Lifecycle name- Returns:
- Action set which can vote
- Throws:
GovernanceException- throws if the operation failed.
-
getAllVotingItems
Retrieve action set which need votes.- Specified by:
getAllVotingItemsin interfaceGovernanceArtifact- Returns:
- Action set which can vote
- Throws:
GovernanceException- throws if the operation failed.
-
vote
Vote for an action.- Specified by:
votein interfaceGovernanceArtifact- Parameters:
order- order of the action which need to be votedaspectName- Lifecycle name- Throws:
GovernanceException- throws if the operation failed.
-
vote
Vote for an action.- Specified by:
votein interfaceGovernanceArtifact- Parameters:
order- order of the action which need to be voted- Throws:
GovernanceException- throws if the operation failed.
-
isVoted
Check whether the current user voted for given order event- Specified by:
isVotedin interfaceGovernanceArtifact- Parameters:
order- order of the action which need to be votedaspectName- Lifecycle name- Returns:
- whether the current user voted for the given order event
- Throws:
GovernanceException- throws if the operation failed.
-
isVoted
Check whether the current user voted for given order event.- Specified by:
isVotedin interfaceGovernanceArtifact- Parameters:
order- order of the action which need to be voted- Returns:
- whether the current user voted for the given order event
- Throws:
GovernanceException- throws if the operation failed.
-
unvote
Unvote for an action- Specified by:
unvotein interfaceGovernanceArtifact- Parameters:
order- order of the action which need to be unvotedaspectName- Lifecycle name- Throws:
GovernanceException- throws if the operation failed.
-
unvote
Unvote for an action.- Specified by:
unvotein interfaceGovernanceArtifact- Parameters:
order- order of the action which need to be un voted- Throws:
GovernanceException- throws if the operation failed.
-
attach
Attach the current artifact to an another artifact. Both the artifacts should be saved, before calling this method. This method will two generic artifact types. There are specific methods- Specified by:
attachin interfaceGovernanceArtifact- Parameters:
attachedToArtifact- the artifact the current artifact is attached to- Throws:
GovernanceException- throws if the operation failed.
-
detach
Detach the current artifact from the provided artifact. Both the artifacts should be saved, before calling this method.- Specified by:
detachin interfaceGovernanceArtifact- Parameters:
artifactId- the artifact id of the attached artifact- Throws:
GovernanceException- throws if the operation failed.
-
checkRegistryResourceAssociation
Validate the resource is associated with a registry- Throws:
GovernanceException- if the resource is not associated with a registry.
-
getAssociatedRegistry
protected org.wso2.carbon.registry.core.Registry getAssociatedRegistry()Returns the associated registry to the artifact.- Returns:
- the associated registry
-
getPropertyKeys
Returns the available attribute keys- Specified by:
getPropertyKeysin interfaceGovernanceArtifact- Returns:
- an array of attribute keys.
- Throws:
GovernanceException- throws if the operation failed.
-
equals
-
attach
- Specified by:
attachin interfaceGovernanceArtifact- Throws:
GovernanceException
-
addAssociation
public void addAssociation(String associationType, GovernanceArtifact attachedToArtifact) throws GovernanceException - Specified by:
addAssociationin interfaceGovernanceArtifact- Throws:
GovernanceException
-
addAssociation
- Specified by:
addAssociationin interfaceGovernanceArtifact- Throws:
GovernanceException
-
addBidirectionalAssociation
public void addBidirectionalAssociation(String forwardType, String backwardType, GovernanceArtifact attachedToArtifact) throws GovernanceException - Specified by:
addBidirectionalAssociationin interfaceGovernanceArtifact- Throws:
GovernanceException
-
removeAssociation
- Specified by:
removeAssociationin interfaceGovernanceArtifact- Throws:
GovernanceException
-
removeAssociation
- Specified by:
removeAssociationin interfaceGovernanceArtifact- Throws:
GovernanceException
-
getAssociations
- Specified by:
getAssociationsin interfaceGovernanceArtifact- Throws:
GovernanceException
-
getAssociatedArtifactIds
- Specified by:
getAssociatedArtifactIdsin interfaceGovernanceArtifact- Throws:
GovernanceException
-
isRegistryAwareArtifact
public boolean isRegistryAwareArtifact()- Specified by:
isRegistryAwareArtifactin interfaceGovernanceArtifact
-
addTag
- Specified by:
addTagin interfaceGovernanceArtifact- Throws:
GovernanceException
-
addTags
- Specified by:
addTagsin interfaceGovernanceArtifact- Throws:
GovernanceException
-
listTags
- Specified by:
listTagsin interfaceGovernanceArtifact- Throws:
GovernanceException
-
removeTag
- Specified by:
removeTagin interfaceGovernanceArtifact- Throws:
GovernanceException
-
removeTags
- Specified by:
removeTagsin interfaceGovernanceArtifact- Throws:
GovernanceException
-
toString
-
uniqueTo
- Specified by:
uniqueToin interfaceGovernanceArtifact
-
compareTo
- Specified by:
compareToin interfaceGovernanceArtifact
-
getCurrentStateDuration
public Map<String,String> getCurrentStateDuration(String artifactID, String lcName) throws GovernanceException This method is used to get a lifecycle's current state duration information.- Specified by:
getCurrentStateDurationin interfaceGovernanceArtifact- Parameters:
artifactID- lifecycle associated artifacts id.lcName- lifecycle name.- Returns:
- a map of current lifecycle state duration colour and duration.
- Throws:
GovernanceException
-