Class CmsPublishDataModel


  • public class CmsPublishDataModel
    extends java.lang.Object
    This class contains the data for the publish resources which are displayed in the publish dialog.

    Since:
    8.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsPublishDataModel​(java.util.List<org.opencms.ade.publish.shared.CmsPublishGroup> publishGroups, I_CmsPublishItemStatusUpdateHandler handler)
      Creates and initializes a new publish resource data model from a list of publish groups.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.Integer,​CmsPublishItemStateSummary> computeGroupSelectionStates()
      Collects group selection states.
      int countProblems()
      Counts the resources which have problems.
      int countResources​(CmsPublishDataModel.I_CmsPublishResourceCheck check)
      Counts the resources which pass a given check.
      int countResourcesInGroup​(CmsPublishDataModel.I_CmsPublishResourceCheck check, java.util.List<org.opencms.ade.publish.shared.CmsPublishResource> group)
      Counts the resources of a group which pass a given check.
      java.util.List<org.opencms.ade.publish.shared.CmsPublishGroup> getGroups()
      Gets the list of publish groups.
      java.util.List<org.opencms.util.CmsUUID> getIdsForGroup​(int groupNum)
      Gets the ids for a given publish group.
      java.util.List<org.opencms.util.CmsUUID> getIdsOfAlreadyPublishedResources()
      Returns the id's of all already published resources.
      java.util.Set<org.opencms.util.CmsUUID> getPublishIds()
      Returns the ids of publish resources which should be published.
      java.util.Map<org.opencms.util.CmsUUID,​org.opencms.ade.publish.shared.CmsPublishResource> getPublishResources()
      Returns the list of all publish resources.
      java.util.Map<java.lang.String,​org.opencms.ade.publish.shared.CmsPublishResource> getPublishResourcesByPath()
      Returns the map of publish resources by path.
      java.util.List<org.opencms.util.CmsUUID> getRemoveIds()
      Returns the ids of publish resources which should be removed.
      CmsPublishItemStatus getStatus​(org.opencms.util.CmsUUID id)
      Returns the status for a given publish resource id.
      static boolean hasProblems​(org.opencms.ade.publish.shared.CmsPublishResource publishResource)
      Returns if the given publish resource has problems preventing it from being published.
      boolean hasSingleGroup()
      Checks if there is only a single group of resources.
      boolean isEmpty()
      Checks if there are any publish resources.
      void setSelectionChangeAction​(java.lang.Runnable action)
      Sets the action which should be executed when the selection changes.
      void signal​(org.opencms.ade.publish.client.CmsPublishItemStatus.Signal signal, org.opencms.util.CmsUUID id)
      Sends a signal to a publish item status bean with the given id.
      void signalAll​(org.opencms.ade.publish.client.CmsPublishItemStatus.Signal signal)
      Sends a signal to all publish item status beans.
      void signalGroup​(org.opencms.ade.publish.client.CmsPublishItemStatus.Signal signal, int groupNum)
      Sends a signal to all publish items in a given group.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CmsPublishDataModel

        public CmsPublishDataModel​(java.util.List<org.opencms.ade.publish.shared.CmsPublishGroup> publishGroups,
                                   I_CmsPublishItemStatusUpdateHandler handler)
        Creates and initializes a new publish resource data model from a list of publish groups.

        Parameters:
        publishGroups - the original publish groups
        handler - the handler which should be notified of state changes
    • Method Detail

      • hasProblems

        public static boolean hasProblems​(org.opencms.ade.publish.shared.CmsPublishResource publishResource)
        Returns if the given publish resource has problems preventing it from being published.

        Parameters:
        publishResource - the publish resource
        Returns:
        true if the publish resource has problems
      • countProblems

        public int countProblems()
        Counts the resources which have problems.

        Returns:
        the number of resources which have problems
      • countResourcesInGroup

        public int countResourcesInGroup​(CmsPublishDataModel.I_CmsPublishResourceCheck check,
                                         java.util.List<org.opencms.ade.publish.shared.CmsPublishResource> group)
        Counts the resources of a group which pass a given check.

        Parameters:
        check - the check to apply
        group - the group of publish resources
        Returns:
        the number of resources in that group which passed the check
      • getGroups

        public java.util.List<org.opencms.ade.publish.shared.CmsPublishGroup> getGroups()
        Gets the list of publish groups.

        Returns:
        the list of publish groups
      • getIdsForGroup

        public java.util.List<org.opencms.util.CmsUUID> getIdsForGroup​(int groupNum)
        Gets the ids for a given publish group.

        Parameters:
        groupNum - the index of the group
        Returns:
        the UUIDs for that group
      • getIdsOfAlreadyPublishedResources

        public java.util.List<org.opencms.util.CmsUUID> getIdsOfAlreadyPublishedResources()
        Returns the id's of all already published resources.

        Returns:
        the id's of the already published resources
      • getPublishIds

        public java.util.Set<org.opencms.util.CmsUUID> getPublishIds()
        Returns the ids of publish resources which should be published.

        Returns:
        the ids of publish resources which should be published
      • getPublishResources

        public java.util.Map<org.opencms.util.CmsUUID,​org.opencms.ade.publish.shared.CmsPublishResource> getPublishResources()
        Returns the list of all publish resources.

        Returns:
        the list of all publish resources
      • getPublishResourcesByPath

        public java.util.Map<java.lang.String,​org.opencms.ade.publish.shared.CmsPublishResource> getPublishResourcesByPath()
        Returns the map of publish resources by path.

        Returns:
        the map of publish resources by path
      • getRemoveIds

        public java.util.List<org.opencms.util.CmsUUID> getRemoveIds()
        Returns the ids of publish resources which should be removed.

        Returns:
        the ids of publish resources which should be removed
      • getStatus

        public CmsPublishItemStatus getStatus​(org.opencms.util.CmsUUID id)
        Returns the status for a given publish resource id.

        Parameters:
        id - the publish resource's structure id
        Returns:
        the status for that publish resource
      • hasSingleGroup

        public boolean hasSingleGroup()
        Checks if there is only a single group of resources.

        Returns:
        true if there is only a single group of resources
      • isEmpty

        public boolean isEmpty()
        Checks if there are any publish resources.

        Returns:
        true if there are no publish resources at all
      • setSelectionChangeAction

        public void setSelectionChangeAction​(java.lang.Runnable action)
        Sets the action which should be executed when the selection changes.

        Parameters:
        action - the action to run when the selection changes
      • signal

        public void signal​(org.opencms.ade.publish.client.CmsPublishItemStatus.Signal signal,
                           org.opencms.util.CmsUUID id)
        Sends a signal to a publish item status bean with the given id.

        Parameters:
        signal - the signal
        id - the structure id
      • signalAll

        public void signalAll​(org.opencms.ade.publish.client.CmsPublishItemStatus.Signal signal)
        Sends a signal to all publish item status beans.

        Parameters:
        signal - the signal
      • signalGroup

        public void signalGroup​(org.opencms.ade.publish.client.CmsPublishItemStatus.Signal signal,
                                int groupNum)
        Sends a signal to all publish items in a given group.

        Parameters:
        signal - the signal to send
        groupNum - the group index