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.Serializable
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChangeOperation.CreateResourceOperation
static class
ChangeOperation.DeleteResourceOperation
static class
ChangeOperation.ManifestChangeOperation
static class
ChangeOperation.ModifyResourceOperation
static class
ChangeOperation.OperationType
static class
ChangeOperation.ResourceChangeOperation
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<ChangeOperation>
CHANGE_SORT
Comparator 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.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(java.lang.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(java.lang.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
@Nullable public static ProjectResourceId getResourceIdFromChange(ChangeOperation op)
- Returns:
- the
ProjectResourceId
ofop
if it is aChangeOperation.ResourceChangeOperation
, otherwisenull
.
-
getResourceFromChange
@Nullable public static ProjectResource getResourceFromChange(ChangeOperation op)
- Returns:
- the resource from the op if it is a
ChangeOperation.CreateResourceOperation
orChangeOperation.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.
-
-