Class ChangeOperation
- java.lang.Object
-
- com.inductiveautomation.ignition.common.project.ChangeOperation
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ChangeOperation.ManifestChangeOperation,ChangeOperation.ResourceChangeOperation
public abstract class ChangeOperation extends java.lang.Object implements java.io.SerializableModifications to projects are defined as a series of ChangeOperations. The following operations can be performed:- Create - a new resource is added.
- Delete - a resource is deleted
- Modify - a resource is modified.
- Manifest - the project manifest has been modified. The manifest is a description of the project- its name, parent, etc.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChangeOperation.CreateResourceOperationstatic classChangeOperation.DeleteResourceOperationstatic classChangeOperation.ManifestChangeOperationstatic classChangeOperation.ModifyResourceOperationstatic classChangeOperation.OperationTypestatic classChangeOperation.ResourceChangeOperation
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<ChangeOperation>CHANGE_SORTComparator that orders ChangeOperations in the correct order to submit to a push
-
Method Summary
-
-
-
Field Detail
-
CHANGE_SORT
public static final java.util.Comparator<ChangeOperation> CHANGE_SORT
Comparator that orders ChangeOperations in the correct order to submit to a push
-
-
Method Detail
-
getOperationType
@Nonnull public ChangeOperation.OperationType getOperationType()
- Returns:
- the
ChangeOperation.OperationType.
-
getProjectName
public abstract java.lang.String getProjectName()
- Returns:
- the name of the project the target of this operation belongs to.
-
newCreateOp
public static ChangeOperation.CreateResourceOperation newCreateOp(ProjectResource resource)
Create a newChangeOperation.CreateResourceOperationfor newly createdresource.- Parameters:
resource- theProjectResourcethat was created. Not null.- Returns:
- a
ChangeOperation.CreateResourceOperationforresource. Not null.
-
newModifyOp
public static ChangeOperation.ModifyResourceOperation newModifyOp(ProjectResource resource, ResourceSignature baseSignature)
Create a newChangeOperation.ModifyResourceOperationfor aresourcethat has been modified.Modify operations are expressed relative to a base
ResourceSignature.- Parameters:
resource- the modifiedProjectResource.baseSignature- the baseResourceSignature.- Returns:
- a
ChangeOperation.ModifyResourceOperationforresource.
-
newDeleteOp
public static ChangeOperation.DeleteResourceOperation newDeleteOp(ResourceSignature resourceSignature)
Create a newChangeOperation.DeleteResourceOperationfor the resource identified byresourceSignature.- Parameters:
resourceSignature- theResourceSignature.- Returns:
- a
ChangeOperation.DeleteResourceOperationforresourceId.
-
newManifestChangeOp
public static ChangeOperation.ManifestChangeOperation newManifestChangeOp(java.lang.String projectName, ProjectManifest manifest)
Create a newChangeOperation.ManifestChangeOperationfor the project identified byprojectName.- Parameters:
projectName- the name of the project with an updated manifest.- Returns:
- a
ChangeOperation.ManifestChangeOperationforprojectName.
-
newManifestChangeOp
public static ChangeOperation.ManifestChangeOperation newManifestChangeOp(java.lang.String projectName, ProjectManifest manifest, int baseHashCode)
Create a newChangeOperation.ManifestChangeOperationfor the project identified byprojectName.- Parameters:
projectName- the name of the project with an updated manifest.manifest- the updatedProjectManifest.baseHashCode- the hashcode of the originalProjectManifest(i.e. the unmodified manifest from the snapshot)- Returns:
- a
ChangeOperation.ManifestChangeOperationforprojectName.
-
getResourceIdFromChange
@Nullable public static ProjectResourceId getResourceIdFromChange(ChangeOperation op)
- Returns:
- the
ProjectResourceIdofopif it is aChangeOperation.ResourceChangeOperation, otherwisenull.
-
getResourceFromChange
@Nullable public static ProjectResource getResourceFromChange(ChangeOperation op)
- Returns:
- the resource from the op if it is a
ChangeOperation.CreateResourceOperationorChangeOperation.ModifyResourceOperation, otherwise null
-
changeOpsToIdSet
public static java.util.Set<ProjectResourceId> changeOpsToIdSet(java.util.List<ChangeOperation> changes)
Grabs all the project resource ids for the given changes and returns them as a set.
-
-