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 class
static class
static class
static class
static enum
static 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 String
static ProjectResource
static ProjectResourceId
newCreateOp
(ProjectResource resource) Create a newChangeOperation.CreateResourceOperation
for newly createdresource
.newDeleteOp
(ResourceSignature resourceSignature) Create a newChangeOperation.DeleteResourceOperation
for the resource identified byresourceSignature
.newManifestChangeOp
(String projectName, ProjectManifest manifest) Create a newChangeOperation.ManifestChangeOperation
for the project identified byprojectName
.newManifestChangeOp
(String projectName, ProjectManifest manifest, int baseHashCode) Create a newChangeOperation.ManifestChangeOperation
for the project identified byprojectName
.newModifyOp
(ProjectResource resource, ResourceSignature baseSignature) Create a newChangeOperation.ModifyResourceOperation
for aresource
that 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.CreateResourceOperation
for newly createdresource
.- Parameters:
resource
- theProjectResource
that was created. Not null.- Returns:
- a
ChangeOperation.CreateResourceOperation
forresource
. Not null.
-
newModifyOp
public static ChangeOperation.ModifyResourceOperation newModifyOp(ProjectResource resource, ResourceSignature baseSignature) Create a newChangeOperation.ModifyResourceOperation
for aresource
that has been modified.Modify operations are expressed relative to a base
ResourceSignature
.- Parameters:
resource
- the modifiedProjectResource
.baseSignature
- the baseResourceSignature
.- Returns:
- a
ChangeOperation.ModifyResourceOperation
forresource
.
-
newDeleteOp
public static ChangeOperation.DeleteResourceOperation newDeleteOp(ResourceSignature resourceSignature) Create a newChangeOperation.DeleteResourceOperation
for the resource identified byresourceSignature
.- Parameters:
resourceSignature
- theResourceSignature
.- Returns:
- a
ChangeOperation.DeleteResourceOperation
forresourceId
.
-
newManifestChangeOp
public static ChangeOperation.ManifestChangeOperation newManifestChangeOp(String projectName, ProjectManifest manifest) Create a newChangeOperation.ManifestChangeOperation
for the project identified byprojectName
.- Parameters:
projectName
- the name of the project with an updated manifest.- Returns:
- a
ChangeOperation.ManifestChangeOperation
forprojectName
.
-
newManifestChangeOp
public static ChangeOperation.ManifestChangeOperation newManifestChangeOp(String projectName, ProjectManifest manifest, int baseHashCode) Create a newChangeOperation.ManifestChangeOperation
for 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.ManifestChangeOperation
forprojectName
.
-
getResourceIdFromChange
- Returns:
- the
ProjectResourceId
ofop
if it is aChangeOperation.ResourceChangeOperation
, otherwisenull
.
-
getResourceFromChange
- Returns:
- the resource from the op if it is a
ChangeOperation.CreateResourceOperation
orChangeOperation.ModifyResourceOperation
, otherwise null
-
changeOpsToIdSet
Grabs all the project resource ids for the given changes and returns them as a set.
-