Interface DesignableProject

  • All Superinterfaces:
    Project, java.io.Serializable
    All Known Implementing Classes:
    DesignerProjectTreeImpl

    public interface DesignableProject
    extends Project
    Extension of Project with additional functionality to support the Designer's need to model the project as a tree of resources which can be mutated and staged for push and pull operations.
    • Method Detail

      • getLocalResource

        default java.util.Optional<ProjectResource> getLocalResource​(ProjectResourceId id)
        Get a resource, but only if it is a locally defined resource.
      • getLocalResource

        default java.util.Optional<ProjectResource> getLocalResource​(ResourcePath path)
        Get a resource, but only if it is a locally defined resource.
      • createResourceSafe

        default ProjectResource createResourceSafe​(ResourcePath path,
                                                   java.util.function.Consumer<ProjectResourceBuilder> builderConsumer)
        Create a new resource and add it at the given path. If there is already a resource at the given path, then the new resource will be given a new name like "OriginalName (1)"
        Parameters:
        path - The desired path for the new resource. Any needed folders along the path will be created.
        builderConsumer - Callback for setting the details of the new resource. The correct project name and resource path will already be set automatically.
        Returns:
        The resource that was created
      • createResourceSafe

        default ProjectResource createResourceSafe​(ResourcePath path,
                                                   java.util.function.Consumer<ProjectResourceBuilder> builderConsumer,
                                                   java.lang.String nameFormat)
        Create a new resource and add it at the given path. If there is already a resource at the given path, then the new resource will be given a new name.
        Parameters:
        path - The desired path for the new resource
        builderConsumer - Callback for setting the details of the new resource. The correct project name and resource path will already be set automatically.
        nameFormat - String format for appending a number to the end of the existing name, like " (%s)"
        Returns:
        The resource that was created
      • createOrModify

        default void createOrModify​(ProjectResource resource)
        Create the given resource if one doesn't already exist, otherwise, modify it.
      • createOrModify

        default void createOrModify​(ResourcePath path,
                                    java.util.function.Consumer<ProjectResourceBuilder> builderConsumer)
        Create the given resource if one doesn't already exist, otherwise, modify it.
      • discardChanges

        boolean discardChanges​(ResourcePath path)
        Discards any local changes for a path.
        Returns:
        true if there were changes to discard, false if there were no changes in the first place.
      • isLocal

        boolean isLocal​(ResourcePath path)
        Returns:
        True if there is a project resource at the given path that defined in the local project.
      • isChanged

        boolean isChanged​(ResourcePath path)
        Returns:
        True if there is a resource at the given path that has been locally altered.
      • isInherited

        boolean isInherited​(ResourcePath path)
        Returns:
        True if there is a resource at the given path that is inherited from a parent project
      • isOverridable

        boolean isOverridable​(ResourcePath path)
        Returns:
        False if there is an inherited resource that does not allow overrides. True otherwise.
      • isOverridden

        boolean isOverridden​(ResourcePath path)
        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

        boolean isConflict​(ResourcePath path)
        Returns:
        True if there is a resource with a conflicting (but differently cased) name at the given path - see NameCollisionException
      • getDefiningProject

        java.lang.String getDefiningProject​(ResourcePath path)
        Return the project name where the given ResourcePath is actually defined.
      • getChanges

        java.util.List<ChangeOperation> getChanges()
        Returns:
        The change operations that have occurred on this project since loaded or since the last applyChanges
      • getConflicts

        java.util.Collection<ChangeOperation> getConflicts​(java.util.Collection<ChangeOperation> changes)
        Parameters:
        changes - Diff operations applicable to the local project
        Returns:
        a collection of the change operations from diff that conflict with local changes