Interface Project
-
- All Superinterfaces:
java.io.Serializable
- All Known Subinterfaces:
DesignableProject
- All Known Implementing Classes:
AbstractProject,DesignerProjectTreeImpl,RuntimeProject
public interface Project extends java.io.Serializable
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGLOBAL_PROJECT_NAMEThe name given to the project created to hold "global" resources on upgrade to 8.0.static java.lang.StringPIPELINE_PROJECT_NAMEThe name given to the project created to hold Alarm Pipelines on upgrade to 8.0.static java.lang.StringPROJECT_NAME_PATTERNA regex representing a valid project name.static java.lang.StringSFC_PROJECT_NAMEThe name given to the project created to hold run-always SFCs on upgrade to 8.0.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddProjectResourceListener(ProjectResourceListener listener)Adds a listener for specific types of project resource changes.java.util.Optional<java.util.List<ProjectResource>>browse(ResourcePath path)java.util.Map<ProjectResourceId,ProjectResource>getAllResources()Get a List of all resources in this project and all parent projects.default java.lang.StringgetDescription()ProjectManifestgetManifest()Get theProjectManifestfor this Project.java.lang.StringgetName()default java.util.Optional<java.lang.String>getParent()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)default java.util.Optional<ProjectResource>getResource(ProjectResourceId id)Finds the resource at the given id.java.util.Optional<ProjectResource>getResource(ResourcePath id)Finds the resource at the given path, using an effective view of the resources in this project chain.java.util.List<ProjectResource>getResources()Get the effectiveProjectResources for this project.java.util.List<ProjectResource>getResourcesOfType(ResourceType type)default java.util.Optional<ProjectResource>getSingletonResource(ResourceType type)Convenience method to find a "singleton" project resource, which is a project resource that has no name or path, of which there can only exist zero or one in any given project.default java.lang.StringgetTitle()booleanhasResourcesOfType(ResourceType type)Short-circuiting evaluation of whether project has any resources of given type.default booleanisEnabled()default booleanisInheritable()default booleanisRunnable()voidremoveProjectResourceListener(ProjectResourceListener listener)Removes an existing listener.
-
-
-
Field Detail
-
PROJECT_NAME_PATTERN
static final java.lang.String PROJECT_NAME_PATTERN
A regex representing a valid project name.Note: this pattern is only used to validate project names created via UI. It does not mean projects will always have a name that matches this pattern. A project can technically have any name that is valid on the filesystem, including spaces, special characters, unicode, etc...
- See Also:
- Constant Field Values
-
GLOBAL_PROJECT_NAME
static final java.lang.String GLOBAL_PROJECT_NAME
The name given to the project created to hold "global" resources on upgrade to 8.0.- See Also:
- Constant Field Values
-
PIPELINE_PROJECT_NAME
static final java.lang.String PIPELINE_PROJECT_NAME
The name given to the project created to hold Alarm Pipelines on upgrade to 8.0.- See Also:
- Constant Field Values
-
SFC_PROJECT_NAME
static final java.lang.String SFC_PROJECT_NAME
The name given to the project created to hold run-always SFCs on upgrade to 8.0.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
- Returns:
- the name of this Project.
-
getManifest
ProjectManifest getManifest()
Get theProjectManifestfor this Project.- Returns:
- the
ProjectManifestfor this Project.
-
getTitle
default java.lang.String getTitle()
- Returns:
- the title of this Project, or the name of the project if the title is not set.
-
getDescription
default java.lang.String getDescription()
- Returns:
- the description of this Project.
-
getParent
default java.util.Optional<java.lang.String> getParent()
- Returns:
- the name of the parent Project, if one exists.
-
isEnabled
default boolean isEnabled()
- Returns:
trueif this Project is enabled.
-
isInheritable
default boolean isInheritable()
- Returns:
trueif this Project is inheritable.
-
isRunnable
default boolean isRunnable()
- Returns:
trueif this Project is "runnable", i.e. it's enabled and not inheritable (abstract).
-
getResource
default java.util.Optional<ProjectResource> getResource(ProjectResourceId id)
Finds the resource at the given id.- Parameters:
id- Not null- Returns:
- The matching project resource or empty if not found.
-
getResource
java.util.Optional<ProjectResource> getResource(ResourcePath id)
Finds the resource at the given path, using an effective view of the resources in this project chain.- Parameters:
id- Not null- Returns:
- The matching project resource or empty if not found.
-
getSingletonResource
default java.util.Optional<ProjectResource> getSingletonResource(ResourceType type)
Convenience method to find a "singleton" project resource, which is a project resource that has no name or path, of which there can only exist zero or one in any given project. Shortcut for getResource(new ProjectResourceId(type, null, getName()))
-
getResources
java.util.List<ProjectResource> getResources()
Get the effectiveProjectResources for this project.This includes inherited resources from parent projects, recursively, except where resources in child projects override resources by the same name from parent projects. In other words, for any given
ResourcePath, only the resource "closest" to this project in the inheritance chain will be included in this list.Note that depending on the
ResourceFilterused to load this project instance, this may not include all resource types that are actually part of this project.- Returns:
- the effective
ProjectResources for this project.
-
getResourcesOfType
java.util.List<ProjectResource> getResourcesOfType(ResourceType type)
Get all non-folderProjectResources of typetypebelonging to the module identified bymoduleId.Resource types belonging to the Ignition platform are identified by module id "ignition".
- Parameters:
type- the resource type.- Returns:
- all non-folder
ProjectResources of typetypebelonging to the module identified bymoduleId. - See Also:
getResources(),ProjectResource.PLATFORM_MODULE_ID
-
hasResourcesOfType
boolean hasResourcesOfType(ResourceType type)
Short-circuiting evaluation of whether project has any resources of given type.- Parameters:
type- the resource type.- Returns:
trueif the project contains at least one resource of the given type.See also:
ProjectLifecycleFactory#getProjectFilter()- See Also:
getResourcesOfType(ResourceType)
-
getAllResources
java.util.Map<ProjectResourceId,ProjectResource> getAllResources()
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
ResourceFilterused to load it.- Returns:
- all the resources belonging to this project instance, including resources from parent projects.
-
getProjectInheritanceStructure
java.util.List<NamedManifest> getProjectInheritanceStructure()
- 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.
-
getProjectSnapshots
java.util.List<ProjectSnapshot> getProjectSnapshots()
Gets the snapshots from the effective project, in order of project inheritance (leaf project last)- Returns:
- A list of ProjectSnapshots, one per project represented in the effective project.
-
browse
java.util.Optional<java.util.List<ProjectResource>> browse(@Nonnull ResourcePath path)
- 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
-
addProjectResourceListener
void addProjectResourceListener(ProjectResourceListener listener)
Adds a listener for specific types of project resource changes.- Parameters:
listener- theProjectResourceListenerto add.
-
removeProjectResourceListener
void removeProjectResourceListener(ProjectResourceListener listener)
Removes an existing listener. If not added, no-op.- Parameters:
listener- theProjectResourceListenerto remove.
-
-