All Superinterfaces:
Serializable
All Known Subinterfaces:
DesignableProject
All Known Implementing Classes:
AbstractProject, DesignerProjectTreeImpl, RuntimeProject

public interface Project extends Serializable
  • Field Details

    • PROJECT_NAME_PATTERN

      static final 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:
    • GLOBAL_PROJECT_NAME

      static final String GLOBAL_PROJECT_NAME
      The name given to the project created to hold "global" resources on upgrade to 8.0.
      See Also:
    • PIPELINE_PROJECT_NAME

      static final String PIPELINE_PROJECT_NAME
      The name given to the project created to hold Alarm Pipelines on upgrade to 8.0.
      See Also:
    • SFC_PROJECT_NAME

      static final String SFC_PROJECT_NAME
      The name given to the project created to hold run-always SFCs on upgrade to 8.0.
      See Also:
  • Method Details

    • getName

      String getName()
      Returns:
      the name of this Project.
    • getManifest

      ProjectManifest getManifest()
      Get the ProjectManifest for this Project.
      Returns:
      the ProjectManifest for this Project.
    • getTitle

      default String getTitle()
      Returns:
      the title of this Project, or the name of the project if the title is not set.
    • getDescription

      default String getDescription()
      Returns:
      the description of this Project.
    • getParent

      default Optional<String> getParent()
      Returns:
      the name of the parent Project, if one exists.
    • isEnabled

      default boolean isEnabled()
      Returns:
      true if this Project is enabled.
    • isInheritable

      default boolean isInheritable()
      Returns:
      true if this Project is inheritable.
    • isRunnable

      default boolean isRunnable()
      Returns:
      true if this Project is "runnable", i.e. it's enabled and not inheritable (abstract).
    • getResource

      default 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

      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 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

      List<ProjectResource> getResources()
      Get the effective ProjectResources 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 ResourceFilter used 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

      List<ProjectResource> getResourcesOfType(ResourceType type)
      Get all non-folder ProjectResources of type type belonging to the module identified by moduleId.

      Resource types belonging to the Ignition platform are identified by module id "ignition".

      Parameters:
      type - the resource type.
      Returns:
      all non-folder ProjectResources of type type belonging to the module identified by moduleId.
      See Also:
    • hasResourcesOfType

      boolean hasResourcesOfType(ResourceType type)
      Short-circuiting evaluation of whether project has any resources of given type.
      Parameters:
      type - the resource type.
      Returns:
      true if the project contains at least one resource of the given type.

      See also: ProjectLifecycleFactory#getProjectFilter()

      See Also:
    • 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 ResourceFilter used to load it.

      Returns:
      all the resources belonging to this project instance, including resources from parent projects.
    • getProjectInheritanceStructure

      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

      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

      Optional<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 - the ProjectResourceListener to add.
    • removeProjectResourceListener

      void removeProjectResourceListener(ProjectResourceListener listener)
      Removes an existing listener. If not added, no-op.
      Parameters:
      listener - the ProjectResourceListener to remove.