com.dotmarketing.portlets.templates.business
Class TemplateAPIImpl

java.lang.Object
  extended by com.dotmarketing.business.BaseInodeAPI
      extended by com.dotmarketing.business.BaseWebAssetAPI
          extended by com.dotmarketing.portlets.templates.business.TemplateAPIImpl
All Implemented Interfaces:
TemplateAPI

public class TemplateAPIImpl
extends BaseWebAssetAPI
implements TemplateAPI


Constructor Summary
TemplateAPIImpl()
           
 
Method Summary
 void associateContainers(java.util.List<Container> containerIdentifiers, Template template)
           
 java.lang.String checkDependencies(java.lang.String templateInode, com.liferay.portal.model.User user, java.lang.Boolean respectFrontendRoles)
           
 Template copy(Template sourceTemplate, Host destination, boolean forceOverwrite, boolean copySourceContainers, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Copies a template to another host.
 Template copy(Template sourceTemplate, Host destination, boolean forceOverwrite, java.util.List<HTMLPageAPI.TemplateContainersReMap.ContainerRemapTuple> containerMappings, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Copies a template to another host.
 Template copy(Template sourceTemplate, com.liferay.portal.model.User user)
           
 void delete(Template template)
           
 boolean delete(Template template, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Delete the specified template
 int deleteOldVersions(java.util.Date assetsOlderThan)
           
 Template find(java.lang.String inode, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
           
 Template findLiveTemplate(java.lang.String id, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the live version of a template given its identifier
 java.util.List<Template> findTemplates(com.liferay.portal.model.User user, boolean includeArchived, java.util.Map<java.lang.String,java.lang.Object> params, java.lang.String hostId, java.lang.String inode, java.lang.String identifier, java.lang.String parent, int offset, int limit, java.lang.String orderBy)
          Retrieves a paginated list of templates the user can use
 java.util.List<Template> findTemplatesAssignedTo(Host parentHost)
          Retrieves all non-archived templates assigned to the given host
 java.util.List<Template> findTemplatesAssignedTo(Host parentHost, boolean includeArchived)
          Retrieves all templates assigned to the given host
 java.util.List<Template> findTemplatesUnder(Folder parentFolder)
           
 java.util.List<Template> findTemplatesUserCanUse(com.liferay.portal.model.User user, java.lang.String hostName, java.lang.String query, boolean searchHost, int offset, int limit)
          Retrieves a paginated list of templates the given user can read.
 Template findWorkingTemplate(java.lang.String id, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the working version of a template given its identifier
 java.util.List<Container> getContainersInTemplate(Template template, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Return the list of container identifiers used in a template body.
 java.util.List<HTMLPage> getPagesUsingTemplate(Template template, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Return the list of pages that use a template body.
 Host getTemplateHost(Template template)
          Retrieves the template associated to a host
protected  void save(WebAsset webAsset)
          Save the asset.
 Template saveTemplate(Template template, Host destination, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Save a template
 void updateParseContainerSyntax(Template template)
          Update template body code to use the new parse container syntax
 
Methods inherited from class com.dotmarketing.business.BaseWebAssetAPI
createAsset, createAsset, createAsset, createAsset, deleteAsset, deleteOldVersions, getCountAssetsAndPermissionsPerRoleAndConditionWithParent, getCountAssetsAndPermissionsPerRoleAndConditionWithParent, getCountAssetsPerConditionWithPermission, getCountAssetsPerConditionWithPermission, getCountAssetsPerConditionWithPermission, getCountAssetsPerConditionWithPermission, getCountAssetsPerConditionWithPermission, getCountAssetsPerConditionWithPermission, isAbstractAsset, saveAsset, unLockAsset
 
Methods inherited from class com.dotmarketing.business.BaseInodeAPI
saveInode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateAPIImpl

public TemplateAPIImpl()
Method Detail

findTemplatesUnder

public java.util.List<Template> findTemplatesUnder(Folder parentFolder)
                                            throws DotDataException
Specified by:
findTemplatesUnder in interface TemplateAPI
Throws:
DotDataException

findTemplatesAssignedTo

public java.util.List<Template> findTemplatesAssignedTo(Host parentHost)
                                                 throws DotDataException
Description copied from interface: TemplateAPI
Retrieves all non-archived templates assigned to the given host

Specified by:
findTemplatesAssignedTo in interface TemplateAPI
Throws:
DotDataException

findTemplatesAssignedTo

public java.util.List<Template> findTemplatesAssignedTo(Host parentHost,
                                                        boolean includeArchived)
                                                 throws DotDataException
Description copied from interface: TemplateAPI
Retrieves all templates assigned to the given host

Specified by:
findTemplatesAssignedTo in interface TemplateAPI
includeArchived - if true it also retrieves all archived templates
Throws:
DotDataException

findTemplatesUserCanUse

public java.util.List<Template> findTemplatesUserCanUse(com.liferay.portal.model.User user,
                                                        java.lang.String hostName,
                                                        java.lang.String query,
                                                        boolean searchHost,
                                                        int offset,
                                                        int limit)
                                                 throws DotDataException,
                                                        DotSecurityException
Description copied from interface: TemplateAPI
Retrieves a paginated list of templates the given user can read. Return working templates. This method uses DB

Specified by:
findTemplatesUserCanUse in interface TemplateAPI
Returns:
Throws:
DotDataException
DotSecurityException

delete

public void delete(Template template)
            throws DotDataException
Throws:
DotDataException

copy

public Template copy(Template sourceTemplate,
                     com.liferay.portal.model.User user)
              throws DotDataException,
                     DotSecurityException
Specified by:
copy in interface TemplateAPI
Throws:
DotDataException
DotSecurityException

copy

public Template copy(Template sourceTemplate,
                     Host destination,
                     boolean forceOverwrite,
                     java.util.List<HTMLPageAPI.TemplateContainersReMap.ContainerRemapTuple> containerMappings,
                     com.liferay.portal.model.User user,
                     boolean respectFrontendRoles)
              throws DotDataException,
                     DotSecurityException
Description copied from interface: TemplateAPI
Copies a template to another host. This method does not copy containers inside instead it remaps the containers based on the containerMappings given.

Specified by:
copy in interface TemplateAPI
Returns:
Throws:
DotDataException
DotSecurityException

getPagesUsingTemplate

public java.util.List<HTMLPage> getPagesUsingTemplate(Template template,
                                                      com.liferay.portal.model.User user,
                                                      boolean respectFrontendRoles)
                                               throws DotDataException,
                                                      DotSecurityException
Description copied from interface: TemplateAPI
Return the list of pages that use a template body.

Specified by:
getPagesUsingTemplate in interface TemplateAPI
Returns:
List
Throws:
DotDataException
DotSecurityException

copy

public Template copy(Template sourceTemplate,
                     Host destination,
                     boolean forceOverwrite,
                     boolean copySourceContainers,
                     com.liferay.portal.model.User user,
                     boolean respectFrontendRoles)
              throws DotDataException,
                     DotSecurityException
Description copied from interface: TemplateAPI
Copies a template to another host.

Specified by:
copy in interface TemplateAPI
Returns:
Template
Throws:
DotDataException
DotSecurityException

save

protected void save(WebAsset webAsset)
             throws DotDataException
Description copied from class: BaseWebAssetAPI
Save the asset.

Specified by:
save in class BaseWebAssetAPI
Throws:
DotDataException

saveTemplate

public Template saveTemplate(Template template,
                             Host destination,
                             com.liferay.portal.model.User user,
                             boolean respectFrontendRoles)
                      throws DotDataException,
                             DotSecurityException
Description copied from interface: TemplateAPI
Save a template

Specified by:
saveTemplate in interface TemplateAPI
Returns:
Template
Throws:
DotDataException
DotSecurityException

getContainersInTemplate

public java.util.List<Container> getContainersInTemplate(Template template,
                                                         com.liferay.portal.model.User user,
                                                         boolean respectFrontendRoles)
                                                  throws DotDataException,
                                                         DotSecurityException
Description copied from interface: TemplateAPI
Return the list of container identifiers used in a template body.

Specified by:
getContainersInTemplate in interface TemplateAPI
Returns:
List
Throws:
DotDataException
DotSecurityException

updateParseContainerSyntax

public void updateParseContainerSyntax(Template template)
Description copied from interface: TemplateAPI
Update template body code to use the new parse container syntax

Specified by:
updateParseContainerSyntax in interface TemplateAPI

getTemplateHost

public Host getTemplateHost(Template template)
                     throws DotDataException
Description copied from interface: TemplateAPI
Retrieves the template associated to a host

Specified by:
getTemplateHost in interface TemplateAPI
Returns:
Throws:
DotDataException

delete

public boolean delete(Template template,
                      com.liferay.portal.model.User user,
                      boolean respectFrontendRoles)
               throws DotSecurityException,
                      java.lang.Exception
Description copied from interface: TemplateAPI
Delete the specified template

Specified by:
delete in interface TemplateAPI
Returns:
boolean
Throws:
DotSecurityException
java.lang.Exception

findWorkingTemplate

public Template findWorkingTemplate(java.lang.String id,
                                    com.liferay.portal.model.User user,
                                    boolean respectFrontendRoles)
                             throws DotDataException,
                                    DotSecurityException
Description copied from interface: TemplateAPI
Retrieves the working version of a template given its identifier

Specified by:
findWorkingTemplate in interface TemplateAPI
Returns:
Throws:
DotDataException
DotSecurityException

findTemplates

public java.util.List<Template> findTemplates(com.liferay.portal.model.User user,
                                              boolean includeArchived,
                                              java.util.Map<java.lang.String,java.lang.Object> params,
                                              java.lang.String hostId,
                                              java.lang.String inode,
                                              java.lang.String identifier,
                                              java.lang.String parent,
                                              int offset,
                                              int limit,
                                              java.lang.String orderBy)
                                       throws DotSecurityException,
                                              DotDataException
Description copied from interface: TemplateAPI
Retrieves a paginated list of templates the user can use

Specified by:
findTemplates in interface TemplateAPI
Returns:
Throws:
DotSecurityException
DotDataException

find

public Template find(java.lang.String inode,
                     com.liferay.portal.model.User user,
                     boolean respectFrontEndRoles)
              throws DotSecurityException,
                     DotDataException
Specified by:
find in interface TemplateAPI
Throws:
DotSecurityException
DotDataException

associateContainers

public void associateContainers(java.util.List<Container> containerIdentifiers,
                                Template template)
                         throws DotHibernateException
Specified by:
associateContainers in interface TemplateAPI
Throws:
DotHibernateException

findLiveTemplate

public Template findLiveTemplate(java.lang.String id,
                                 com.liferay.portal.model.User user,
                                 boolean respectFrontendRoles)
                          throws DotDataException,
                                 DotSecurityException
Description copied from interface: TemplateAPI
Retrieves the live version of a template given its identifier

Specified by:
findLiveTemplate in interface TemplateAPI
Returns:
Throws:
DotDataException
DotSecurityException

checkDependencies

public java.lang.String checkDependencies(java.lang.String templateInode,
                                          com.liferay.portal.model.User user,
                                          java.lang.Boolean respectFrontendRoles)
                                   throws com.liferay.portal.PortalException,
                                          com.liferay.portal.SystemException,
                                          DotDataException,
                                          DotSecurityException
Specified by:
checkDependencies in interface TemplateAPI
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException
DotDataException
DotSecurityException

deleteOldVersions

public int deleteOldVersions(java.util.Date assetsOlderThan)
                      throws DotStateException,
                             DotDataException
Specified by:
deleteOldVersions in interface TemplateAPI
Throws:
DotStateException
DotDataException


Copyright © 2013 dotCMS Inc. All Rights Reserved.