Package org.opencms.workflow
Class CmsDefaultPublishResourceFormatter
- java.lang.Object
-
- org.opencms.workflow.CmsDefaultPublishResourceFormatter
-
- All Implemented Interfaces:
I_CmsPublishResourceFormatter
- Direct Known Subclasses:
CmsExtendedPublishResourceFormatter
public class CmsDefaultPublishResourceFormatter extends java.lang.Object implements I_CmsPublishResourceFormatter
Default formatter class for publish resources.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CmsDefaultPublishResourceFormatter.AlreadyPublishedValidator
Excludes resources which have already been published.class
CmsDefaultPublishResourceFormatter.BlockingLockedValidator
Validator which checks if resources are locked by someone else.static class
CmsDefaultPublishResourceFormatter.DefaultComparator
Compares publish resources by their sort date.static interface
CmsDefaultPublishResourceFormatter.I_PublishResourceValidator
Validator which can exclude some resources from publishing and supplies a status object for the excluded resources.class
CmsDefaultPublishResourceFormatter.NoPermissionsValidator
Validator which excludes resources for which the user has no publish permissions.class
CmsDefaultPublishResourceFormatter.PublishPermissionFilter
Predicate which checks whether the current user has publish permissions for a resource.
-
Field Summary
Fields Modifier and Type Field Description protected CmsPublishOptions
m_options
The publish options.
-
Constructor Summary
Constructors Constructor Description CmsDefaultPublishResourceFormatter(CmsObject cms)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<CmsUUID,CmsPublishResourceInfo>
computeWarnings()
Creates the publish resource warnings.protected CmsPublishResource
createPublishResource(CmsResource resource)
Creates a publish resource bean from a resource.protected java.util.Locale
getLocale()
Gets the workplace locale for the currently used CMS context.static java.lang.String
getOuAwareName(CmsObject cms, java.lang.String name)
Returns the simple name if the ou is the same as the current user's ou.java.util.List<CmsPublishResource>
getPublishResources()
Gets the publish resource beans created by this formatter.protected com.google.common.base.Predicate<CmsResource>
getResourceMapFilter()
Gets the resource map filter.protected java.util.List<CmsDefaultPublishResourceFormatter.I_PublishResourceValidator>
getValidators()
Gets the list of publish resource validators.void
initialize(CmsPublishOptions options, CmsPublishRelationFinder.ResourceMap resources)
Initializes the formatter.protected void
sortResult(java.util.List<CmsPublishResource> publishResources)
Sorts the result publish resource list.
-
-
-
Field Detail
-
m_options
protected CmsPublishOptions m_options
The publish options.
-
-
Constructor Detail
-
CmsDefaultPublishResourceFormatter
public CmsDefaultPublishResourceFormatter(CmsObject cms)
Constructor.- Parameters:
cms
- the CMS context to use
-
-
Method Detail
-
getOuAwareName
public static java.lang.String getOuAwareName(CmsObject cms, java.lang.String name)
Returns the simple name if the ou is the same as the current user's ou.- Parameters:
cms
- the CMS contextname
- the fully qualified name to check- Returns:
- the simple name if the ou is the same as the current user's ou
-
getPublishResources
public java.util.List<CmsPublishResource> getPublishResources()
Description copied from interface:I_CmsPublishResourceFormatter
Gets the publish resource beans created by this formatter.- Specified by:
getPublishResources
in interfaceI_CmsPublishResourceFormatter
- Returns:
- the publish resource beans
- See Also:
I_CmsPublishResourceFormatter.getPublishResources()
-
initialize
public void initialize(CmsPublishOptions options, CmsPublishRelationFinder.ResourceMap resources) throws CmsException
Description copied from interface:I_CmsPublishResourceFormatter
Initializes the formatter.- Specified by:
initialize
in interfaceI_CmsPublishResourceFormatter
- Parameters:
options
- the publish optionsresources
- the publish resources- Throws:
CmsException
- in case something goes wrong- See Also:
I_CmsPublishResourceFormatter.initialize(org.opencms.ade.publish.shared.CmsPublishOptions, org.opencms.ade.publish.CmsPublishRelationFinder.ResourceMap)
-
computeWarnings
protected java.util.Map<CmsUUID,CmsPublishResourceInfo> computeWarnings()
Creates the publish resource warnings.- Returns:
- a map from structure ids to the warnings for the corresponding resources
-
createPublishResource
protected CmsPublishResource createPublishResource(CmsResource resource) throws CmsException
Creates a publish resource bean from a resource.- Parameters:
resource
- the resource- Returns:
- the publish resource bean
- Throws:
CmsException
- if something goes wrong
-
getLocale
protected java.util.Locale getLocale()
Gets the workplace locale for the currently used CMS context.- Returns:
- the workplace locale
-
getResourceMapFilter
protected com.google.common.base.Predicate<CmsResource> getResourceMapFilter()
Gets the resource map filter.This can be used to remove resources which shouldn't be displayed.
- Returns:
- a predicate whose
-
getValidators
protected java.util.List<CmsDefaultPublishResourceFormatter.I_PublishResourceValidator> getValidators()
Gets the list of publish resource validators.- Returns:
- the list of publish resource validators
-
sortResult
protected void sortResult(java.util.List<CmsPublishResource> publishResources)
Sorts the result publish resource list.- Parameters:
publishResources
- the list to sort
-
-