Class DesignerProjectTreeImpl
- java.lang.Object
-
- com.inductiveautomation.ignition.common.project.AbstractProject
-
- com.inductiveautomation.ignition.designer.project.DesignerProjectTreeImpl
-
- All Implemented Interfaces:
Project
,DesignableProject
,java.io.Serializable
public class DesignerProjectTreeImpl extends AbstractProject implements DesignableProject
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.inductiveautomation.ignition.common.project.Project
EDGE_PROJECT_NAME, GLOBAL_PROJECT_NAME, PIPELINE_PROJECT_NAME, PROJECT_NAME_PATTERN, SFC_PROJECT_NAME
-
-
Constructor Summary
Constructors Constructor Description DesignerProjectTreeImpl(Project project)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyChange(ProjectChange change)
Apply a set of changes, pulled from the gateway, to this project.java.util.Optional<java.util.List<ProjectResource>>
browse(ResourcePath path)
void
createResource(ProjectResource 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.java.util.Map<ProjectResourceId,ProjectResource>
getAllResources()
Get a List of all resources in this project and all parent projects.java.util.List<ChangeOperation>
getChanges()
java.util.Collection<ChangeOperation>
getConflicts(java.util.Collection<ChangeOperation> changes)
ProjectManifest
getManifest()
Get theProjectManifest
for this Project.java.lang.String
getName()
java.util.List<NamedManifest>
getProjectInheritanceStructure()
java.util.List<ProjectSnapshot>
getProjectSnapshots()
Gets the snapshots from the effective project, in order of project inheritance (leaf project last)java.util.Optional<ProjectResource>
getResource(ResourcePath path)
Finds the resource at the given path, using an effective view of the resources in this project chain.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(ProjectResource resource)
Modify an existing resource.void
notifyPushComplete(java.util.List<ChangeOperation> changesPushed)
Notify that a push was completed.void
renameResource(ResourcePath sourcePath, java.lang.String newName)
Rename a resource at the given path.protected ProjectDiff
updateEffectiveState()
Call this after one or more resources or manifests have been changed.-
Methods inherited from class com.inductiveautomation.ignition.common.project.AbstractProject
addProjectResourceListener, getEffectiveResources, getListeners, getResources, getResourcesOfType, hasResourcesOfType, removeProjectResourceListener
-
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, modifyResource, modifyResourceIfLocal, renameResource
-
Methods inherited from interface com.inductiveautomation.ignition.common.project.Project
addProjectResourceListener, getDescription, getParent, getResource, getResources, getResourcesOfType, getSingletonResource, getTitle, hasResourcesOfType, isEnabled, isInheritable, isRunnable, removeProjectResourceListener
-
-
-
-
Constructor Detail
-
DesignerProjectTreeImpl
public DesignerProjectTreeImpl(Project project)
-
-
Method Detail
-
updateEffectiveState
protected ProjectDiff updateEffectiveState()
Description copied from class:AbstractProject
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 classAbstractProject
-
getResource
public java.util.Optional<ProjectResource> getResource(ResourcePath path)
Description copied from interface:Project
Finds the resource at the given path, using an effective view of the resources in this project chain.- Specified by:
getResource
in interfaceProject
- Parameters:
path
- Not null- Returns:
- The matching project resource or empty if not found.
-
browse
public java.util.Optional<java.util.List<ProjectResource>> browse(@Nonnull ResourcePath path)
-
modifyResource
public void modifyResource(ProjectResource resource) throws ResourceNotFoundException
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
public void createResource(ProjectResource resource) throws ResourceNamingException
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
public void deleteResource(ResourcePath path) throws ResourceNotFoundException
Description copied from interface:DesignableProject
Delete the resource at a given path.- Specified by:
deleteResource
in interfaceDesignableProject
- Throws:
ResourceNotFoundException
-
renameResource
public void renameResource(ResourcePath sourcePath, java.lang.String newName) throws ResourceNamingException
Description copied from interface:DesignableProject
Rename a resource at the given path.- Specified by:
renameResource
in interfaceDesignableProject
- Throws:
ResourceNamingException
-
discardChanges
public boolean discardChanges(ResourcePath path)
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.
-
isLocal
public boolean isLocal(ResourcePath path)
- Specified by:
isLocal
in interfaceDesignableProject
- Returns:
- True if there is a project resource at the given path that defined in the local project.
-
isChanged
public boolean isChanged(ResourcePath path)
- Specified by:
isChanged
in interfaceDesignableProject
- Returns:
- True if there is a resource at the given path that has been locally altered.
-
isInherited
public boolean isInherited(ResourcePath path)
- Specified by:
isInherited
in interfaceDesignableProject
- Returns:
- True if there is a resource at the given path that is inherited from a parent project
-
isOverridable
public boolean isOverridable(ResourcePath path)
- Specified by:
isOverridable
in interfaceDesignableProject
- Returns:
- False if there is an inherited resource that does not allow overrides. True otherwise.
-
isOverridden
public boolean isOverridden(ResourcePath path)
- 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
public boolean isConflict(ResourcePath path)
- 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
-
getName
public java.lang.String getName()
-
getManifest
public ProjectManifest getManifest()
Description copied from interface:Project
Get theProjectManifest
for this Project.- Specified by:
getManifest
in interfaceProject
- Returns:
- the
ProjectManifest
for this Project.
-
getProjectInheritanceStructure
public java.util.List<NamedManifest> getProjectInheritanceStructure()
- Specified by:
getProjectInheritanceStructure
in interfaceProject
- Returns:
- A list of all of the projects and their manifests that comprise the inheritance chain of this project. This list is ordered in ascending inheritance order, from leaf project first to super-most project last.
-
getAllResources
public java.util.Map<ProjectResourceId,ProjectResource> getAllResources()
Description copied from interface:Project
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 interfaceProject
- Returns:
- all the resources belonging to this project instance, including resources from parent projects.
-
getProjectSnapshots
public java.util.List<ProjectSnapshot> getProjectSnapshots()
Description copied from interface:Project
Gets the snapshots from the effective project, in order of project inheritance (leaf project last)- Specified by:
getProjectSnapshots
in interfaceProject
- Returns:
- A list of ProjectSnapshots, one per project represented in the effective project.
-
getChanges
public java.util.List<ChangeOperation> getChanges()
- Specified by:
getChanges
in interfaceDesignableProject
- Returns:
- The change operations that have occurred on this project since loaded or since the last applyChanges
-
getConflicts
public java.util.Collection<ChangeOperation> getConflicts(java.util.Collection<ChangeOperation> changes)
- 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
public void applyChange(ProjectChange change) throws NameCollisionException
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.- Throws:
NameCollisionException
-
notifyPushComplete
public void notifyPushComplete(java.util.List<ChangeOperation> changesPushed)
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()
-
-