Package org.opencms.ade.publish
Class CmsPublish
- java.lang.Object
-
- org.opencms.ade.publish.CmsPublish
-
public class CmsPublish extends java.lang.Object
ADE publishing features.- Since:
- 8.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CmsPublish.ResourcesAndRelated
Just for passing around resources and their related together but not mixed up.
-
Field Summary
Fields Modifier and Type Field Description 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.protected CmsObject
m_cms
The current cms context.protected CmsPublishOptions
m_options
The options.protected java.util.Locale
m_workplaceLocale
The current user workplace locale.
-
Constructor Summary
Constructors Constructor Description CmsPublish(CmsObject cms)
Creates a new instance.CmsPublish(CmsObject cms, java.util.Map<java.lang.String,java.lang.String> params)
Constructor with default options.CmsPublish(CmsObject cms, CmsPublishOptions options)
Constructor with options.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<CmsPublishResource>
getBrokenResources(java.util.List<CmsResource> pubResources)
Checks for possible broken links when the given list of resources would be published.protected 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.CmsRelationPublishValidator
getRelationValidator()
Gets the relation validator instance.void
publishResources(java.util.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(java.util.Collection<CmsUUID> idsToRemove)
Removes the given resources from the user's publish list.protected CmsPublishResource
resourceToBean(CmsResource resource, CmsPublishResourceInfo info, boolean removable, java.util.List<CmsPublishResource> related)
Creates a publish resource bean instance from the given parameters.
-
-
-
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
-
m_options
protected final CmsPublishOptions m_options
The options.
-
m_workplaceLocale
protected final java.util.Locale m_workplaceLocale
The current user workplace locale.
-
-
Constructor Detail
-
CmsPublish
public CmsPublish(CmsObject cms)
Creates a new instance.- Parameters:
cms
- the CMS context to use
-
CmsPublish
public CmsPublish(CmsObject cms, CmsPublishOptions options)
Constructor with options.- Parameters:
cms
- the current cms contextoptions
- the options to use
-
CmsPublish
public CmsPublish(CmsObject cms, java.util.Map<java.lang.String,java.lang.String> params)
Constructor with default options.- Parameters:
cms
- the current cms contextparams
- the additional publish parameters
-
-
Method Detail
-
getOuAwareName
protected 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
-
getBrokenResources
public java.util.List<CmsPublishResource> getBrokenResources(java.util.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
-
getRelationValidator
public CmsRelationPublishValidator getRelationValidator()
Gets the relation validator instance.- Returns:
- the relation validator
-
publishResources
public void publishResources(java.util.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(java.util.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
-
resourceToBean
protected CmsPublishResource resourceToBean(CmsResource resource, CmsPublishResourceInfo info, boolean removable, java.util.List<CmsPublishResource> related) throws CmsException
Creates a publish resource bean instance from the given parameters.- Parameters:
resource
- the resourceinfo
- the publish information, if anyremovable
- if removablerelated
- the list of related resources- Returns:
- the publish resource bean
- Throws:
CmsException
- if something goes wrong
-
-