Class ChangeOperation
java.lang.Object
com.inductiveautomation.ignition.common.project.ChangeOperation
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ChangeOperation.ManifestChangeOperation,ChangeOperation.ResourceChangeOperation
Modifications 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<ChangeOperation>Comparator that orders ChangeOperations in the correct order to submit to a push -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<ProjectResourceId>changeOpsToIdSet(List<ChangeOperation> changes) Grabs all the project resource ids for the given changes and returns them as a set.abstract Stringstatic ProjectResourcestatic ProjectResourceIdnewCreateOp(ProjectResource resource) Create a newChangeOperation.CreateResourceOperationfor newly createdresource.newDeleteOp(ResourceSignature resourceSignature) Create a newChangeOperation.DeleteResourceOperationfor the resource identified byresourceSignature.newManifestChangeOp(String projectName, ProjectManifest manifest) Create a newChangeOperation.ManifestChangeOperationfor the project identified byprojectName.newManifestChangeOp(String projectName, ProjectManifest manifest, int baseHashCode) Create a newChangeOperation.ManifestChangeOperationfor the project identified byprojectName.newModifyOp(ProjectResource resource, ResourceSignature baseSignature) Create a newChangeOperation.ModifyResourceOperationfor aresourcethat has been modified.
-
Field Details
-
CHANGE_SORT
Comparator that orders ChangeOperations in the correct order to submit to a push
-
-
Method Details
-
getOperationType
- Returns:
- the
ChangeOperation.OperationType.
-
getProjectName
- Returns:
- the name of the project the target of this operation belongs to.
-
newCreateOp
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(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(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
- Returns:
- the
ProjectResourceIdofopif it is aChangeOperation.ResourceChangeOperation, otherwisenull.
-
getResourceFromChange
- Returns:
- the resource from the op if it is a
ChangeOperation.CreateResourceOperationorChangeOperation.ModifyResourceOperation, otherwise null
-
changeOpsToIdSet
Grabs all the project resource ids for the given changes and returns them as a set.
-