public class PageDAO extends AbstractLogEnabled implements Serviceable, Component
Constructor and Description |
---|
PageDAO() |
Modifier and Type | Method and Description |
---|---|
private boolean |
_canCreate(PagesContainer parentPage) |
private boolean |
_canDelete(Page page) |
private Map<String,Object> |
_content2Json(Content content,
Locale locale) |
private Page |
_createPage(PagesContainer parent,
String pageTitle,
String template) |
private List<String> |
_getChildrenPageIds(Page page) |
private AmetysObjectIterable<Content> |
_getIncomingContentReferences(String pageId) |
private AmetysObjectIterable<Page> |
_getIncomingPageReferences(String pageId) |
private Page |
_getPageRedirection(Page page) |
private boolean |
_hasRight(ContentType contentType,
Page page) |
private boolean |
_hasRight(Service service,
Page page) |
private boolean |
_isInfiniteRedirection(Page page,
List<String> pagesSequence) |
private boolean |
_isLocked(Content content) |
private boolean |
_isNew(Content content) |
private boolean |
_isPageExist(String id) |
private boolean |
_isParentInvisible(Page page)
Check each parent and return true if one of them is invisible
|
private boolean |
_isPreviewable(Page page)
Determine if this page is previewable
|
private boolean |
_isReferenced(Content content) |
boolean |
_isTagValid(Page page,
String tagName)
Test if a tag is valid for a specific page
|
private Map<String,Object> |
_page2Json(Page page) |
private Map<String,Object> |
_publication2Json(Page page) |
private void |
_removeOldZones(ModifiablePage page,
String templateName) |
private void |
_updateContentsAfterCopy(Page createdPage) |
private Map<String,Object> |
_zone2json(Zone zone) |
private Map<String,Object> |
_zoneitem2json(ZoneItem zoneItem) |
Map<String,String> |
copyPage(String id,
String target,
boolean keepReferences)
Copy a page
|
Map<String,Object> |
createPage(String parentId,
String title,
String longTitle)
Create a new page
|
Map<String,Object> |
deletePage(ModifiablePage page,
boolean deleteBelongingContents)
Delete a page and its sub-pages.
|
Map<String,Object> |
deletePage(String pageId,
boolean deleteBelongingContents)
Delete a page and its sub-pages.
|
Map<String,Object> |
getAttachmentsRootNode(String id)
Returns the page's attachments root node
|
List<Map<String,Object>> |
getAvailableContentTypes(String pageId,
String zoneName)
Get available content types for specified page
|
List<Map<String,Object>> |
getAvailableContentTypesForCreation(String pageId,
String zoneName,
String parentId,
String pageTitle,
String template)
Get available content types for a page being created
|
List<Map<String,Object>> |
getAvailableServices(String pageId,
String zoneName)
Get available services for specified page
|
List<Map<String,Object>> |
getAvailableServicesForCreation(String pageId,
String zoneName,
String parentId,
String pageTitle,
String template)
Get available services for a page being created
|
List<Map<String,Object>> |
getAvailableTemplates(List<String> pageIds)
Get available template for specified pages
|
List<Map<String,Object>> |
getAvailableTemplates(String pageId)
Get available template for specified page
|
List<Map<String,Object>> |
getAvailableTemplatesForCreation(String pageId,
String parentId,
String pageTitle)
Get available content types for a page being created
|
List<String> |
getDeleteablePageContentIds(String pageId,
boolean onlyNewlyCreatedContents)
Get the contents that belong to the
Page and its sub-pages and that can be deleted. |
Map<String,Object> |
getDeleteablePageContents(String id)
Get the contents of a
Page and its subpages which can be deleted. |
List<Content> |
getPageContents(Page page)
Get the contents of a page and its child pages
|
List<Content> |
getPageContents(Page page,
boolean ignoreContentsOfNonRemovablePage)
Get the contents of a page and its child pages
|
Map<String,Object> |
getPageInfos(Page page)
Get the page's properties
|
Map<String,Object> |
getPageInfos(String pageId)
Get the page's properties
|
Map<String,Object> |
getPageParents(String id)
Returns the page's parents ids
|
Map<String,Object> |
getPageProperties(String pageId)
Get the page's properties
|
Map<String,Object> |
getPagesInfos(List<String> pageIds)
Get the properties of given pages
|
Map<String,Object> |
getServiceInfo(String pageId,
String serviceId)
Get service info
|
String |
getServiceParametersAction(String serviceId)
Get the script class name to execute to add or update this service
|
Set<String> |
getTags(List<String> pageIds)
Get the tags from the pages
|
List<Map<String,Object>> |
getUnreferencedContents(String id)
|
protected Set<String> |
getUserRights(PagesContainer pagesCt)
Get the user rights on page container (page or sitemap)
|
boolean |
hasRight(String id,
String rightId)
Check current user right on given page or sitemap
|
Map<String,Object> |
movePage(String id,
String parentId,
int index)
Move a page
|
Map<String,String> |
pastePage(String targetId,
String sourceId,
boolean keepReferences)
Deprecated.
|
Map<String,Object> |
renamePage(String pageId,
String title,
String longTitle,
boolean updatePath,
boolean createAlias)
Rename a page
|
void |
service(ServiceManager smanager) |
Map<String,Object> |
setBlank(List<String> pageIds)
Set pages as blank page
|
Map<String,Object> |
setLink(List<String> pageIds,
String url,
String urlType)
Set pages as redirection
|
Map<String,Object> |
setTemplate(List<String> pageIds,
String templateName)
Set a template to pages
|
Map<String,Object> |
setTemplate(List<String> pageIds,
String templateName,
boolean checkAvailableTemplate)
Set a template to pages
|
Map<String,Object> |
setVisibility(List<String> pageIds,
boolean visible)
Set the visible of pages
|
Map<String,Object> |
tag(List<String> pageIds,
List<String> contentIds,
List<String> tagNames,
Map<String,Object> contextualParameters)
Tag a list of contents with the given tags
|
Map<String,Object> |
tag(List<String> pageIds,
List<String> contentIds,
List<String> tagNames,
String mode,
Map<String,Object> contextualParameters)
Tag a list of contents and/org pages
|
Map<String,Object> |
tag(List<String> pageIds,
List<String> tagNames,
String mode,
Map<String,Object> contextualParameters)
Tag a list of pages
|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
public static final String __SERVICE_PARAM_UNTOUCHED_BINARY
private AmetysObjectResolver _resolver
private ObservationManager _observationManager
private CurrentUserProvider _currentUserProvider
private SkinsManager _skinsManager
private TemplatesAssignmentHandler _templatesHandler
private ServicesAssignmentHandler _serviceHandler
private ContentTypesAssignmentHandler _cTypeHandler
private ContentTypeExtensionPoint _contentTypeExtensionPoint
private ServiceExtensionPoint _serviceExtensionPoint
private WorkflowProvider _workflowProvider
private SharedContentManager _sharedContentManager
private TagProviderExtensionPoint _tagProvider
private WebLanguagesManager _webLanguagesManager
private WebContentDAO _contentDAO
private CopySiteComponent _copySiteComponent
private RightManager _rightManager
private SynchronizeComponent _synchronizeComponent
private Repository _repository
private PageDataTypeExtensionPoint _pageDataTypeExtensionPoint
public PageDAO()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
ServiceException
public Map<String,Object> getPagesInfos(List<String> pageIds)
pageIds
- the id of pagespublic Map<String,Object> getPageInfos(String pageId)
pageId
- the page IDpublic Map<String,Object> getPageInfos(Page page)
page
- the pagepublic Map<String,Object> getPageProperties(String pageId)
pageId
- the id of pagepublic boolean hasRight(String id, String rightId)
id
- The id of the page or sitemaprightId
- The if of right to checkpublic Map<String,Object> createPage(String parentId, String title, String longTitle)
parentId
- The parent id. Can not be null.title
- The page's title. Can not be null.longTitle
- The page's long title. Can be null or blank.public Map<String,String> copyPage(String id, String target, boolean keepReferences) throws RepositoryException
id
- The id of page to copytarget
- The id of parent target pagekeepReferences
- true to keep referencesRepositoryException
- if an error occurred during copy@Deprecated public Map<String,String> pastePage(String targetId, String sourceId, boolean keepReferences) throws RepositoryException
targetId
- the page to copy insourceId
- the page to copykeepReferences
- true to keep references for contents, or false to duplicate contentsRepositoryException
- if an error occurspublic Map<String,Object> movePage(String id, String parentId, int index)
id
- The page idparentId
- The id of parent destinationindex
- The position in parent child nodes where page will be inserted. -1 means as the last child.private boolean _canCreate(PagesContainer parentPage)
private boolean _canDelete(Page page)
public Map<String,Object> setLink(List<String> pageIds, String url, String urlType)
pageIds
- the id of pages to modifyurl
- the url of redirectionurlType
- the type of redirectionpublic List<Map<String,Object>> getAvailableTemplates(String pageId)
pageId
- The page's idpublic List<Map<String,Object>> getAvailableContentTypes(String pageId, String zoneName)
pageId
- The page's idzoneName
- the name of the zonepublic List<Map<String,Object>> getAvailableContentTypesForCreation(String pageId, String zoneName, String parentId, String pageTitle, String template)
pageId
- The page's id. Can be null of the page is not yet createdzoneName
- the name of the zoneparentId
- The id of parent pagepageTitle
- The title of page to createtemplate
- The template of page to createprivate boolean _hasRight(ContentType contentType, Page page)
public List<Map<String,Object>> getAvailableServices(String pageId, String zoneName)
pageId
- The page's idzoneName
- the name of the zonepublic List<Map<String,Object>> getAvailableServicesForCreation(String pageId, String zoneName, String parentId, String pageTitle, String template)
pageId
- The page's id. Can be null of the page is not yet createdzoneName
- the name of the zoneparentId
- The id of parent pagepageTitle
- The title of page to createtemplate
- The template of page to createprivate Page _createPage(PagesContainer parent, String pageTitle, String template)
public List<Map<String,Object>> getAvailableTemplates(List<String> pageIds)
pageIds
- The id of pagespublic List<Map<String,Object>> getAvailableTemplatesForCreation(String pageId, String parentId, String pageTitle)
pageId
- The page's id. Can be null of the page is not yet createdparentId
- The id of parent pagepageTitle
- The title of page to createpublic Map<String,Object> getServiceInfo(String pageId, String serviceId)
pageId
- Optional, the page id of the service. To get some basic info about the page.serviceId
- The id of the servicepublic Map<String,Object> renamePage(String pageId, String title, String longTitle, boolean updatePath, boolean createAlias)
pageId
- The id of page to renametitle
- The page's titlelongTitle
- The page's long title.updatePath
- true to update page's pathcreateAlias
- true to create a aliaspublic Map<String,Object> deletePage(String pageId, boolean deleteBelongingContents)
pageId
- the id of page to deletedeleteBelongingContents
- true to delete the contents that belong to the page and its sub-pages onlypublic Map<String,Object> deletePage(ModifiablePage page, boolean deleteBelongingContents)
page
- the page to deletedeleteBelongingContents
- true to delete the contents that belong to the page and its sub-pages onlypublic Map<String,Object> setBlank(List<String> pageIds)
pageIds
- the id of pages to modifypublic Map<String,Object> setTemplate(List<String> pageIds, String templateName)
pageIds
- the id of pages to updatetemplateName
- The template namepublic Map<String,Object> setTemplate(List<String> pageIds, String templateName, boolean checkAvailableTemplate)
pageIds
- the id of pages to updatetemplateName
- The template namecheckAvailableTemplate
- true if you want to check available templatepublic String getServiceParametersAction(String serviceId)
serviceId
- the service idprivate void _removeOldZones(ModifiablePage page, String templateName)
public Set<String> getTags(List<String> pageIds)
pageIds
- The ids of the pagespublic Map<String,Object> tag(List<String> pageIds, List<String> tagNames, String mode, Map<String,Object> contextualParameters)
pageIds
- The ids of pages to tagtagNames
- The tagsmode
- The mode for updating tags: 'REPLACE' to replace tags, 'INSERT' to add tags or 'REMOVE' to remove tags.contextualParameters
- Contextual parameters. Must contain the site namepublic Map<String,Object> tag(List<String> pageIds, List<String> contentIds, List<String> tagNames, Map<String,Object> contextualParameters)
pageIds
- The ids of pages to tagcontentIds
- The ids of contents to tagtagNames
- The tagscontextualParameters
- The contextual parameterspublic Map<String,Object> tag(List<String> pageIds, List<String> contentIds, List<String> tagNames, String mode, Map<String,Object> contextualParameters)
pageIds
- The ids of pages to tagcontentIds
- The ids of contents to tagtagNames
- The tagsmode
- The mode for updating tags: 'REPLACE' to replace tags, 'INSERT' to add tags or 'REMOVE' to remove tags.contextualParameters
- The contextual parameterspublic boolean _isTagValid(Page page, String tagName)
page
- The pagetagName
- The tag namepublic Map<String,Object> setVisibility(List<String> pageIds, boolean visible)
pageIds
- The id of pagesvisible
- true
to set pages as visible, false
otherwisepublic Map<String,Object> getDeleteablePageContents(String id)
Page
and its subpages which can be deleted.
A content is deleteable if user has right, the content is not locked and not referenced by other pages.id
- The id of pagepublic List<String> getDeleteablePageContentIds(String pageId, boolean onlyNewlyCreatedContents)
Page
and its sub-pages and that can be deleted.
A content is deleteable if user has right, the content is not locked and it's not referenced by other pages.
If 'onlyNewlyCreatedContents' is set to 'true', only newly created contents will be returnedpageId
- The id of pageonlyNewlyCreatedContents
- true to return only the newly created contentspublic List<Map<String,Object>> getUnreferencedContents(String id)
id
- The id of page or zone itempublic Map<String,Object> getAttachmentsRootNode(String id)
id
- the page's idpublic Map<String,Object> getPageParents(String id)
id
- the page's idpublic List<Content> getPageContents(Page page)
page
- The pagepublic List<Content> getPageContents(Page page, boolean ignoreContentsOfNonRemovablePage)
page
- The pageignoreContentsOfNonRemovablePage
- true to ignore contents of non-removable pages (virtual pages)protected Set<String> getUserRights(PagesContainer pagesCt)
pagesCt
- The pages containerprivate boolean _isReferenced(Content content)
private Map<String,Object> _page2Json(Page page)
private Map<String,Object> _publication2Json(Page page)
private AmetysObjectIterable<Content> _getIncomingContentReferences(String pageId)
private AmetysObjectIterable<Page> _getIncomingPageReferences(String pageId)
private Map<String,Object> _zone2json(Zone zone)
private Map<String,Object> _zoneitem2json(ZoneItem zoneItem)
private void _updateContentsAfterCopy(Page createdPage) throws AmetysRepositoryException
AmetysRepositoryException
private List<String> _getChildrenPageIds(Page page)
private boolean _isParentInvisible(Page page)
page
- page to checkprivate boolean _isPreviewable(Page page)
page
- The page to look atprivate boolean _isPageExist(String id)
private boolean _isInfiniteRedirection(Page page, List<String> pagesSequence)
private Page _getPageRedirection(Page page)