Class DesignerProjectTreeImpl
java.lang.Object
com.inductiveautomation.ignition.common.resourcecollection.AbstractResourceCollection
com.inductiveautomation.ignition.designer.project.DesignerProjectTreeImpl
- All Implemented Interfaces:
ResourceCollection
,DesignableProject
public class DesignerProjectTreeImpl
extends AbstractResourceCollection
implements DesignableProject
-
Field Summary
Fields inherited from interface com.inductiveautomation.ignition.common.resourcecollection.ResourceCollection
GLOBAL_PROJECT_NAME, PIPELINE_PROJECT_NAME, PROJECT_NAME_PATTERN, SFC_PROJECT_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyChange
(ProjectChange change) Apply a set of changes, pulled from the gateway, to this project.browse
(ResourcePath path) void
createResource
(Resource resource) Create a new resource.void
deleteResource
(ResourcePath path) Delete the resource at a given path.boolean
discardChanges
(ResourcePath path) Discards any local changes for a path.void
discardOverrides
(ResourcePath path) Discards changes made to overridden resourcesGet a List of all resources in this project and all parent projects.getConflicts
(Collection<ChangeOperation> changes) Return the project name where the given ResourcePath is actually defined.Get theResourceCollectionManifest
for this Project.getName()
getResource
(ResourcePath path) Finds the resource at the given path, using an effective view of the resources in this project chain.Gets the snapshots from the effective resource collection, in reverse order of inheritance (leaf collection first)boolean
isChanged
(ResourcePath path) boolean
isConflict
(ResourcePath path) boolean
isInherited
(ResourcePath path) boolean
isLocal
(ResourcePath path) boolean
isOverridable
(ResourcePath path) boolean
isOverridden
(ResourcePath path) void
modifyResource
(Resource resource) Modify an existing resource.void
notifyPushComplete
(List<ChangeOperation> changesPushed) Notify that a push was completed.void
Removes allResourceListener
s.void
renameResource
(ResourcePath sourcePath, String newName) Rename a resource at the given path.protected ResourceCollectionDiff.EffectiveDiff
Call this after one or more resources or manifests have been changed.Methods inherited from class com.inductiveautomation.ignition.common.resourcecollection.AbstractResourceCollection
addResourceListener, getEffectiveResources, getListeners, getResources, getResourcesOfType, hasResourcesOfType, removeResourceListener, updateEffectiveState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inductiveautomation.ignition.designer.project.DesignableProject
createOrModify, createOrModify, createResourceSafe, createResourceSafe, deleteResource, getLocalResource, getLocalResource, isProtected, modifyResource, modifyResourceIfLocal, renameResource, setProtected
Methods inherited from interface com.inductiveautomation.ignition.common.resourcecollection.ResourceCollection
addResourceListener, getDescription, getParent, getResource, getResources, getResourcesOfType, getSingletonResource, getTitle, hasResourcesOfType, isEnabled, isInheritable, isRunnable, removeResourceListener
-
Constructor Details
-
DesignerProjectTreeImpl
-
-
Method Details
-
updateEffectiveState
Description copied from class:AbstractResourceCollection
Call this after one or more resources or manifests have been changed. This will calculate the effective change to the resources and notify listeners.- Overrides:
updateEffectiveState
in classAbstractResourceCollection
-
getResource
Description copied from interface:ResourceCollection
Finds the resource at the given path, using an effective view of the resources in this project chain.- Specified by:
getResource
in interfaceResourceCollection
- Parameters:
path
- Not null- Returns:
- The matching project resource or empty if not found.
-
browse
- Specified by:
browse
in interfaceResourceCollection
- Parameters:
path
- the resourcePath of the folder to browse- Returns:
- an empty optional if the given path was not found or is not browseable, otherwise its direct children
-
modifyResource
Description copied from interface:DesignableProject
Modify an existing resource. Must already exist as a local resource, otherwise this will throw anResourceNotFoundException
- Specified by:
modifyResource
in interfaceDesignableProject
- Throws:
ResourceNotFoundException
-
createResource
Description copied from interface:DesignableProject
Create a new resource.Will also create any folders needed along the new resource's path.
- Specified by:
createResource
in interfaceDesignableProject
- Throws:
NameInUseException
- if the resource's name is is already in use by a local sibling.ResourceNamingException
-
deleteResource
Description copied from interface:DesignableProject
Delete the resource at a given path.- Specified by:
deleteResource
in interfaceDesignableProject
- Throws:
ResourceNotFoundException
-
renameResource
Description copied from interface:DesignableProject
Rename a resource at the given path.- Specified by:
renameResource
in interfaceDesignableProject
- Throws:
ResourceNamingException
-
discardChanges
Description copied from interface:DesignableProject
Discards any local changes for a path.- Specified by:
discardChanges
in interfaceDesignableProject
- Returns:
- true if there were changes to discard, false if there were no changes in the first place.
-
discardOverrides
Description copied from interface:DesignableProject
Discards changes made to overridden resources- Specified by:
discardOverrides
in interfaceDesignableProject
-
isLocal
- Specified by:
isLocal
in interfaceDesignableProject
- Returns:
- True if there is a project resource at the given path that defined in the local project.
-
isChanged
- Specified by:
isChanged
in interfaceDesignableProject
- Returns:
- True if there is a resource at the given path that has been locally altered.
-
isInherited
- Specified by:
isInherited
in interfaceDesignableProject
- Returns:
- True if there is a resource at the given path that is inherited from a parent project
-
isOverridable
- Specified by:
isOverridable
in interfaceDesignableProject
- Returns:
- False if there is an inherited resource that does not allow overrides. True otherwise.
-
isOverridden
- Specified by:
isOverridden
in interfaceDesignableProject
- Returns:
- True if there is a resource at the given path defined in this project that is overriding a resource from a parent project at the same path.
-
isConflict
- Specified by:
isConflict
in interfaceDesignableProject
- Returns:
- True if there is a resource with a conflicting (but differently cased) name at the given path - see
NameCollisionException
-
getDefiningProject
Description copied from interface:DesignableProject
Return the project name where the given ResourcePath is actually defined.- Specified by:
getDefiningProject
in interfaceDesignableProject
-
getName
- Specified by:
getName
in interfaceResourceCollection
- Returns:
- the name of this Project.
-
getManifest
Description copied from interface:ResourceCollection
Get theResourceCollectionManifest
for this Project.- Specified by:
getManifest
in interfaceResourceCollection
- Returns:
- the
ResourceCollectionManifest
for this Project.
-
getInheritanceStructure
- Specified by:
getInheritanceStructure
in interfaceResourceCollection
- Returns:
- A list of all the resource collection manifests that comprise the inheritance chain of this collection. This list is ordered in ascending inheritance order, from leaf first to super-most collection last.
-
getAllResources
Description copied from interface:ResourceCollection
Get a List of all resources in this project and all parent projects.This includes resources belonging to parent projects in the inheritance chain if this is a "stack" of projects. This means that there may be multiple resources for any given
ResourcePath
.This project instance may not contain all resources that exist for the project on disk, depending on the
ResourceFilter
used to load it.- Specified by:
getAllResources
in interfaceResourceCollection
- Returns:
- all the resources belonging to this project instance, including resources from parent projects.
-
getSnapshots
Description copied from interface:ResourceCollection
Gets the snapshots from the effective resource collection, in reverse order of inheritance (leaf collection first)- Specified by:
getSnapshots
in interfaceResourceCollection
- Returns:
- A list of Snapshots, one per resource collection represented in the effective project.
-
getChanges
- Specified by:
getChanges
in interfaceDesignableProject
- Returns:
- The change operations that have occurred on this project since loaded or since the last applyChanges
-
getConflicts
- Specified by:
getConflicts
in interfaceDesignableProject
- Parameters:
changes
- Diff operations applicable to the local project- Returns:
- a collection of the change operations that conflict with local changes
-
applyChange
Apply a set of changes, pulled from the gateway, to this project. For local resources, this will update the "local" reference of the ResourceTreeNode so that further calls to get snapshots will reflect these changes.- Parameters:
change
- The change collection to apply.
-
notifyPushComplete
Notify that a push was completed. This is a signal to the project that some resources may no longer be considered modified.- Parameters:
changesPushed
- A list of the changes that were pushed, which may be a subset of those retrieved viagetChanges()
-
removeAllProjectResourceListeners
public void removeAllProjectResourceListeners()Removes allResourceListener
s. This should only be used when shutting down a designer instance or switching the projects in the designer.
-