Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java96
1 files changed, 50 insertions, 46 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index fea3ca464f8..99085eace75 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -61,6 +61,7 @@ import org.eclipse.osee.framework.core.model.event.IBasicGuidArtifact;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.model.type.RelationType;
+import org.eclipse.osee.framework.core.services.IAccessControlService;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
import org.eclipse.osee.framework.database.core.DbTransaction;
import org.eclipse.osee.framework.database.core.OseeConnection;
@@ -78,7 +79,6 @@ import org.eclipse.osee.framework.messaging.event.skynet.event.SkynetAttributeCh
import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
import org.eclipse.osee.framework.skynet.core.User;
import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.access.AccessControlManager;
import org.eclipse.osee.framework.skynet.core.artifact.annotation.ArtifactAnnotation;
import org.eclipse.osee.framework.skynet.core.artifact.annotation.AttributeAnnotationManager;
import org.eclipse.osee.framework.skynet.core.artifact.annotation.IArtifactAnnotation;
@@ -145,7 +145,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* A historical artifact always corresponds to a fixed revision of an artifact
- *
+ *
* @return whether this artifact represents a fixed revision
*/
public boolean isHistorical() {
@@ -172,7 +172,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* All the artifacts related to this artifact by relations of type relationTypeName are returned in a list order
* based on the stored relation order
- *
+ *
* @param relationTypeName
* @return the artifacts related to this artifact by relations of type relationTypeName
* @throws ArtifactDoesNotExist
@@ -225,7 +225,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Check if artifacts are related to each other by relation type
- *
+ *
* @param relationEnum
* @param other artifact to check
* @return whether they are related
@@ -239,7 +239,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Get the exactly one artifact related to this artifact by relations of type relationType are returned in a list
* order based on
- *
+ *
* @param relationType
* @return the related artifact
* @throws ArtifactDoesNotExist
@@ -330,7 +330,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Determines if this artifact type equals, or is a sub-type of, the artifact type specified by the
* <code>otherType</code> parameter.
- *
+ *
* @param artifactTypeName
* @return whether this artifact's type or any of its super-types (any ancestor type) are the specified type
* @throws OseeDataStoreException
@@ -343,7 +343,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Determines if this artifact type equals, or is a sub-type of, the artifact type specified by the
* <code>otherType</code> parameter.
- *
+ *
* @param oseeType
* @return
* @throws OseeCoreException
@@ -480,7 +480,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Creates an instance of <code>Attribute</code> of the given attribute type. This method should not be called by
* applications. Use addAttribute() instead
- *
+ *
* @param <T>
* @param attributeType
* @return new Attribute
@@ -525,7 +525,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -543,7 +543,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -555,7 +555,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @return attributes All attributes including deleted and artifact deleted
* @throws OseeCoreException
*/
@@ -565,7 +565,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @return attributes All attributes of the specified type name including deleted and artifact deleted
* @throws OseeCoreException
*/
@@ -575,7 +575,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @return attributes
* @throws OseeCoreException
*/
@@ -595,7 +595,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @param <T>
* @param attributeTypeName
* @throws OseeCoreException
@@ -641,7 +641,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Deletes all attributes of the given type, if any
- *
+ *
* @param attributeTypeName
* @throws OseeCoreException
*/
@@ -653,7 +653,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Deletes all attributes of the given type, if any
- *
+ *
* @param attributeTypeName
* @throws OseeCoreException
*/
@@ -724,7 +724,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* invalid.<br>
* <br>
* Used for quick access to attribute value that should only have 0 or 1 instances of the attribute.
- *
+ *
* @param <T>
* @param attributeTypeName
* @return sole attribute value
@@ -760,7 +760,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* defaultReturnValue.<br>
* <br>
* Used for display purposes where toString() of attribute is to be displayed.
- *
+ *
* @param attributeTypeName
* @param defaultReturnValue return value if attribute instance does not exist
* @return attribute value
@@ -795,7 +795,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* defaultReturnValue.<br>
* <br>
* Used for purposes where attribute value of specified type is desired.
- *
+ *
* @param <T>
* @param attributeTypeName
* @param defaultReturnValue
@@ -836,7 +836,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* NOTE: Use only for inline calls. This method returns identical data as
* getSoleTAttributeValue(attributeTypeName,defaultReturnValue) but provides an extra parameter that allows it to be
* called within another method call because it specifically defines the return type as clazz
- *
+ *
* @param <T>
* @param attributeTypeName
* @param defaultReturnValue
@@ -852,7 +852,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Delete attribute if exactly one exists. Does nothing if attribute does not exist and throw MultipleAttributesExist
* is more than one instance of the attribute type exsits for this artifact
- *
+ *
* @param attributeTypeName
* @throws OseeCoreException
*/
@@ -886,7 +886,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Used on attribute types with no more than one instance. If the attribute exists, it's value is changed, otherwise
* a new attribute is added and its value set.
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -939,7 +939,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* All existing attributes matching a new value will be left untouched. Then for any remaining values, other existing
* attributes will be changed to match or if need be new attributes will be added to stored these values. Finally any
* excess attributes will be deleted.
- *
+ *
* @param attributeType
* @param newValues
* @throws OseeCoreException
@@ -952,7 +952,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* All existing attributes matching a new value will be left untouched. Then for any remaining values, other existing
* attributes will be changed to match or if need be new attributes will be added to stored these values. Finally any
* excess attributes will be deleted.
- *
+ *
* @param attributeTypeName
* @param newValues
* @throws OseeCoreException
@@ -997,7 +997,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -1009,7 +1009,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
+ *
* @param <T>
* @param attributeType
* @param value
@@ -1022,7 +1022,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName. The attribute is set to the default value for its type,
* if any.
- *
+ *
* @param attributeType
* @throws OseeCoreException
*/
@@ -1033,7 +1033,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName. The attribute is set to the default value for its type,
* if any.
- *
+ *
* @param attributeType
* @throws OseeCoreException
*/
@@ -1043,7 +1043,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
+ *
* @param attributeTypeName
* @param value
* @throws OseeCoreException
@@ -1056,7 +1056,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* we do not what duplicated enumerated values so this method silently returns if the specified attribute type is
* enumerated and value is already present
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -1125,7 +1125,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* This is used to mark that the artifact deleted.
- *
+ *
* @throws OseeCoreException
*/
public void internalSetDeleted() throws OseeCoreException {
@@ -1194,10 +1194,14 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
return hasDirtyAttributes() || hasDirtyRelations() || hasDirtyArtifactType();
}
+ private IAccessControlService getAccessControlService() throws OseeCoreException {
+ return Activator.getInstance().getAccessControlService();
+ }
+
public boolean isReadOnly() {
try {
- return isDeleted() || isHistorical() || !getBranch().isEditable() || !AccessControlManager.hasPermission(this,
- PermissionEnum.WRITE);
+ return isDeleted() || isHistorical() || !getBranch().isEditable() || !getAccessControlService().hasPermission(
+ this, PermissionEnum.WRITE);
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
return true;
@@ -1217,7 +1221,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Reloads this artifact's attributes and relations back to the last state saved. This will have no effect if the
* artifact has never been saved.
- *
+ *
* @throws OseeCoreException
*/
public void reloadAttributesAndRelations() throws OseeCoreException {
@@ -1236,7 +1240,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
}
private final void persistAttributes(SkynetTransaction transaction) throws OseeCoreException {
- if (!UserManager.duringMainUserCreation() && !AccessControlManager.hasPermission(getBranch(),
+ if (!UserManager.duringMainUserCreation() && !getAccessControlService().hasPermission(getBranch(),
PermissionEnum.WRITE)) {
throw new OseeArgumentException(
"No write permissions for the branch that this artifact belongs to:" + getBranch());
@@ -1278,7 +1282,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Returns all of the descendants through the primary decomposition tree that have a particular human readable id.
* This will not return the called upon node if the name matches since it can not be a descendant of itself.
- *
+ *
* @param humanReadableId The human readable id text to match against.
* @param caseSensitive Whether to use case sensitive matching.
* @return <code>Collection</code> of <code>Artifact</code>'s that match.
@@ -1302,7 +1306,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* Starting from this artifact, walks down the child hierarchy based on the list of child names provided and returns
* the child of the last name provided. ArtifactDoesNotExist exception is thrown ff any child along the path does not
* exist.
- *
+ *
* @param names
* @return child at the leaf (bottom) of the specified hierarchy.
* @throws OseeCoreException
@@ -1344,7 +1348,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Remove artifact from a specific branch in the database
- *
+ *
* @throws OseeCoreException
*/
public void purgeFromBranch() throws OseeCoreException {
@@ -1429,7 +1433,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Creates new relations that don't already exist and removes relations to artifacts that are not in collection
- *
+ *
* @param relationSide
* @param artifacts
* @throws OseeCoreException
@@ -1518,7 +1522,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Return true if this artifact any of it's links specified or any of the artifacts on the other side of the links
* are dirty
- *
+ *
* @param links
*/
public String isRelationsAndArtifactsDirty(Set<IRelationEnumeration> links) {
@@ -1555,7 +1559,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Creates a new artifact and duplicates all of its attribute data.
- *
+ *
* @throws OseeCoreException
*/
public Artifact duplicate(Branch branch) throws OseeCoreException {
@@ -1582,7 +1586,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* An artifact reflected about its own branch returns itself. Otherwise a new artifact is introduced on the
* destinationBranch
- *
+ *
* @param destinationBranch
* @return the newly created artifact or this artifact if the destinationBranch is this artifact's branch
* @throws OseeCoreException
@@ -1698,7 +1702,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Changes the artifact type.
- *
+ *
* @param artifactType
* @throws OseeDataStoreException
*/
@@ -1725,7 +1729,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Since artifact names are free text it is important to reformat the name to ensure it is suitable as an element
* name
- *
+ *
* @return artifact name in a form that is valid as an XML element
*/
public String getSafeName() {
@@ -1886,7 +1890,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Return relations that exist between artifacts
- *
+ *
* @throws ArtifactDoesNotExist
*/
public ArrayList<RelationLink> internalGetRelations(Artifact artifact) throws OseeCoreException {
@@ -1909,7 +1913,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Return relations that exist between artifacts of type side
- *
+ *
* @throws OseeCoreException
*/
@Deprecated

Back to the top