org.opencms.ade.publish
Class CmsPublish

java.lang.Object
  extended by org.opencms.ade.publish.CmsPublish

public class CmsPublish
extends Object

ADE publishing features.

Since:
8.0.0

Field Summary
protected static int GROUP_DAYS_NUMBER
          The number of day groups.
protected static int GROUP_SESSIONS_GAP
          The gap between session groups.
protected static int GROUP_SESSIONS_NUMBER
          The number of session groups.
 
Constructor Summary
CmsPublish(CmsObject cms)
          Constructor with default options.
CmsPublish(CmsObject cms, CmsPublishOptions options)
          Constructor with options.
 
Method Summary
protected  Set<CmsResource> getAlreadyPublishedResources()
          Returns already published resources.
protected  org.opencms.ade.publish.CmsPublish.ResourcesAndRelated getBlockingLockedResources(Set<CmsResource> exclude)
          Returns locked resources that do not belong to the current user.
 List<CmsPublishResource> getBrokenResources(List<CmsResource> pubResources)
          Checks for possible broken links when the given list of resources would be published.
 List<CmsProjectBean> getManageableProjects()
          Returns the current user's manageable projects.
 CmsPublishOptions getOptions()
          Returns the options.
protected  String getOuAwareName(String name)
          Returns the simple name if the ou is the same as the current user's ou.
 List<CmsPublishGroup> getPublishGroups()
          Returns the list of publish groups with resources that can be published.
protected  org.opencms.ade.publish.CmsPublish.ResourcesAndRelated getPublishResources()
          Returns the resources stored in the user's publish list.
protected  List<CmsPublishResource> getRelatedResources(CmsResource resource, Set<CmsResource> resources, Set<CmsResource> published, org.opencms.ade.publish.CmsPublish.ResourcesAndRelated permissions, org.opencms.ade.publish.CmsPublish.ResourcesAndRelated locked)
          Returns a string with a list of related resources in the publish list.
protected  CmsPublishResourceInfo getResourceInfo(CmsResource resource, Set<CmsResource> published, org.opencms.ade.publish.CmsPublish.ResourcesAndRelated permissions, org.opencms.ade.publish.CmsPublish.ResourcesAndRelated locked)
          Returns the additional info for the given resource.
protected  String getResourceName(String rootPath, String siteRoot)
          Formats the given resource path depending on the site root.
protected  org.opencms.ade.publish.CmsPublish.ResourcesAndRelated getResourcesWithoutPermissions(Set<CmsResource> exclude)
          Returns the sublist of the publish list with resources without publish permissions.
 void publishResources(List<CmsResource> resources)
          Publishes the given list of resources.
 CmsPublishResource relationToBean(CmsRelation relation)
          Creates a publish resource bean from the target information of a relation object.
 void removeResourcesFromPublishList(Collection<CmsUUID> idsToRemove)
          Removes the given resources from the user's publish list.
protected  CmsPublishResource resourceToBean(CmsResource resource, CmsPublishResourceInfo info, boolean removable, List<CmsPublishResource> related)
          Creates a publish resource bean instance from the given parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_DAYS_NUMBER

protected static final int GROUP_DAYS_NUMBER
The number of day groups.

See Also:
Constant Field Values

GROUP_SESSIONS_GAP

protected static final int GROUP_SESSIONS_GAP
The gap between session groups.

See Also:
Constant Field Values

GROUP_SESSIONS_NUMBER

protected static final int GROUP_SESSIONS_NUMBER
The number of session groups.

See Also:
Constant Field Values
Constructor Detail

CmsPublish

public CmsPublish(CmsObject cms)
Constructor with default options.

Parameters:
cms - the current cms context

CmsPublish

public CmsPublish(CmsObject cms,
                  CmsPublishOptions options)
Constructor with options.

Parameters:
cms - the current cms context
options - the options to use
Method Detail

getBrokenResources

public List<CmsPublishResource> getBrokenResources(List<CmsResource> pubResources)
Checks for possible broken links when the given list of resources would be published.

Parameters:
pubResources - list of resources to be published
Returns:
a list of resources that would produce broken links when published

getManageableProjects

public List<CmsProjectBean> getManageableProjects()
Returns the current user's manageable projects.

Returns:
the current user's manageable projects

getOptions

public CmsPublishOptions getOptions()
Returns the options.

Returns:
the options

getPublishGroups

public List<CmsPublishGroup> getPublishGroups()
Returns the list of publish groups with resources that can be published.

Returns:
the list of publish groups with resources that can be published

publishResources

public void publishResources(List<CmsResource> resources)
                      throws CmsException
Publishes the given list of resources.

Parameters:
resources - list of resources to publish
Throws:
CmsException - if something goes wrong

relationToBean

public CmsPublishResource relationToBean(CmsRelation relation)
Creates a publish resource bean from the target information of a relation object.

Parameters:
relation - the relation to use
Returns:
the publish resource bean for the relation target

removeResourcesFromPublishList

public void removeResourcesFromPublishList(Collection<CmsUUID> idsToRemove)
                                    throws CmsException
Removes the given resources from the user's publish list.

Parameters:
idsToRemove - list of structure ids identifying the resources to be removed
Throws:
CmsException - if something goes wrong

getAlreadyPublishedResources

protected Set<CmsResource> getAlreadyPublishedResources()
Returns already published resources.

Returns:
already published resources

getBlockingLockedResources

protected org.opencms.ade.publish.CmsPublish.ResourcesAndRelated getBlockingLockedResources(Set<CmsResource> exclude)
Returns locked resources that do not belong to the current user.

Parameters:
exclude - the resources to exclude
Returns:
the locked and related resources
See Also:
CmsLock.getBlockingLockedResources()

getOuAwareName

protected String getOuAwareName(String name)
Returns the simple name if the ou is the same as the current user's ou.

Parameters:
name - the fully qualified name to check
Returns:
the simple name if the ou is the same as the current user's ou

getPublishResources

protected org.opencms.ade.publish.CmsPublish.ResourcesAndRelated getPublishResources()
Returns the resources stored in the user's publish list.

Returns:
the resources stored in the user's publish list

getRelatedResources

protected List<CmsPublishResource> getRelatedResources(CmsResource resource,
                                                       Set<CmsResource> resources,
                                                       Set<CmsResource> published,
                                                       org.opencms.ade.publish.CmsPublish.ResourcesAndRelated permissions,
                                                       org.opencms.ade.publish.CmsPublish.ResourcesAndRelated locked)
Returns a string with a list of related resources in the publish list.

Parameters:
resource - the resource to use
resources - the resources the user can really publish
published - the already published resources
permissions - the resource the current user does not have publish permissions for
locked - the locked resources
Returns:
a string with a list of related resources in the publish list, or null if none

getResourceInfo

protected CmsPublishResourceInfo getResourceInfo(CmsResource resource,
                                                 Set<CmsResource> published,
                                                 org.opencms.ade.publish.CmsPublish.ResourcesAndRelated permissions,
                                                 org.opencms.ade.publish.CmsPublish.ResourcesAndRelated locked)
Returns the additional info for the given resource.

Parameters:
resource - the resource to use
published - the already published resources
permissions - the resource the current user does not have publish permissions for
locked - the locked resources
Returns:
the additional info for the given resource

getResourceName

protected String getResourceName(String rootPath,
                                 String siteRoot)
Formats the given resource path depending on the site root.

Parameters:
rootPath - the resource path to format
siteRoot - the site root
Returns:
the formatted resource path

getResourcesWithoutPermissions

protected org.opencms.ade.publish.CmsPublish.ResourcesAndRelated getResourcesWithoutPermissions(Set<CmsResource> exclude)
Returns the sublist of the publish list with resources without publish permissions.

Parameters:
exclude - the resources to exclude
Returns:
the list with resources without publish permissions

resourceToBean

protected CmsPublishResource resourceToBean(CmsResource resource,
                                            CmsPublishResourceInfo info,
                                            boolean removable,
                                            List<CmsPublishResource> related)
Creates a publish resource bean instance from the given parameters.

Parameters:
resource - the resource
info - the publish information, if any
removable - if removable
related - the list of related resources
Returns:
the publish resource bean