org.broadleafcommerce.cms.structure.service
Interface StructuredContentService

All Superinterfaces:
SandBoxItemListener
All Known Implementing Classes:
StructuredContentServiceImpl

public interface StructuredContentService
extends SandBoxItemListener

Provides services to manage StructuredContent items.

Author:
bpolster

Method Summary
 StructuredContent addStructuredContent(StructuredContent content, SandBox destinationSandbox)
          This method is intended to be called from within the CMS admin only.
 Long countContentItems(SandBox sandBox, org.hibernate.Criteria c)
          Follows the same rules as findContentItems.
 void deleteStructuredContent(StructuredContent content, SandBox destinationSandbox)
          If deleting and item where content.originalItemId != null then the item is deleted from the database.
 List<StructuredContent> findContentItems(SandBox sandbox, org.hibernate.Criteria criteria)
          This method is intended to be called solely from the CMS admin.
 Map<String,StructuredContentField> findFieldsByContentId(Long contentId)
          Returns the fields associated with the passed in contentId.
 StructuredContent findStructuredContentById(Long contentId)
          Returns the StructuredContent item associated with the passed in id.
 StructuredContentType findStructuredContentTypeById(Long id)
          Returns the StructuredContentType associated with the passed in id.
 StructuredContentType findStructuredContentTypeByName(String name)
          Returns the StructuredContentType associated with the passed in String value.
 List<StructuredContent> lookupStructuredContentItemsByName(SandBox sandBox, StructuredContentType contentType, String contentName, Locale locale, Integer count, Map<String,Object> ruleDTOs)
          This method returns content
Returns active content items for the passed in sandbox that match the passed in type.
 List<StructuredContent> lookupStructuredContentItemsByType(SandBox sandBox, StructuredContentType contentType, Locale locale, Integer count, Map<String,Object> ruleDTOs)
          This method returns content
Returns active content items for the passed in sandbox that match the passed in type.
 List<StructuredContentType> retrieveAllStructuredContentTypes()
           
 StructuredContent updateStructuredContent(StructuredContent content, SandBox sandbox)
          This method is intended to be called from within the CMS admin only.
 
Methods inherited from interface org.broadleafcommerce.openadmin.server.domain.SandBoxItemListener
itemPromoted, itemRejected, itemReverted
 

Method Detail

findStructuredContentById

StructuredContent findStructuredContentById(Long contentId)
Returns the StructuredContent item associated with the passed in id.

Parameters:
contentId - - The id of the content item.
Returns:
The associated structured content item.

findStructuredContentTypeById

StructuredContentType findStructuredContentTypeById(Long id)
Returns the StructuredContentType associated with the passed in id.

Parameters:
id - - The id of the content type.
Returns:
The associated StructuredContentType.

findStructuredContentTypeByName

StructuredContentType findStructuredContentTypeByName(String name)
Returns the StructuredContentType associated with the passed in String value.

Parameters:
name - - The name of the content type.
Returns:
The associated StructuredContentType.

retrieveAllStructuredContentTypes

List<StructuredContentType> retrieveAllStructuredContentTypes()
Returns:
a list of all StructuredContentTypes

findFieldsByContentId

Map<String,StructuredContentField> findFieldsByContentId(Long contentId)
Returns the fields associated with the passed in contentId. This is preferred over the direct access from the ContentItem so that the two items can be cached distinctly

Parameters:
contentId - - The id of the content.
Returns:
Map of fields for this content id

findContentItems

List<StructuredContent> findContentItems(SandBox sandbox,
                                         org.hibernate.Criteria criteria)
This method is intended to be called solely from the CMS admin. Similar methods exist that are intended for other clients (e.g. lookupStructuredContentItemsBy....
Returns content items for the passed in sandbox that match the passed in criteria. The criteria acts as a where clause to be used in the search for content items. Implementations should automatically add criteria such that no archived items are returned from this method.
The SandBox parameter impacts the results as follows. If a SandBoxType of production is passed in, only those items in that SandBox are returned.
If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.

Parameters:
sandbox - - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.
criteria - - the criteria used to search for content
Returns:

countContentItems

Long countContentItems(SandBox sandBox,
                       org.hibernate.Criteria c)
Follows the same rules as findContentItems.

Returns:
the count of items in this sandbox that match the passed in Criteria

addStructuredContent

StructuredContent addStructuredContent(StructuredContent content,
                                       SandBox destinationSandbox)
This method is intended to be called from within the CMS admin only. Adds the passed in contentItem to the DB. Creates a sandbox/site if one doesn't already exist.


updateStructuredContent

StructuredContent updateStructuredContent(StructuredContent content,
                                          SandBox sandbox)
This method is intended to be called from within the CMS admin only. Updates the structuredContent according to the following rules: 1. If sandbox has changed from null to a value This means that the user is editing an item in production and the edit is taking place in a sandbox. Clone the item and add it to the new sandbox and set the cloned item's originalItemId to the id of the item being updated. 2. If the sandbox has changed from one value to another This means that the user is moving the item from one sandbox to another. Update the siteId for the item to the one associated with the new sandbox 3. If the sandbox has changed from a value to null This means that the item is moving from the sandbox to production. If the item has an originalItemId, then update that item by setting it's archived flag to true. Then, update the siteId of the item being updated to be the siteId of the original item. 4. If the sandbox is the same then just update the item.


deleteStructuredContent

void deleteStructuredContent(StructuredContent content,
                             SandBox destinationSandbox)
If deleting and item where content.originalItemId != null then the item is deleted from the database. If the originalItemId is null, then this method marks the items as deleted within the passed in sandbox.

Parameters:
content -
destinationSandbox -

lookupStructuredContentItemsByType

List<StructuredContent> lookupStructuredContentItemsByType(SandBox sandBox,
                                                           StructuredContentType contentType,
                                                           Locale locale,
                                                           Integer count,
                                                           Map<String,Object> ruleDTOs)
This method returns content
Returns active content items for the passed in sandbox that match the passed in type.
The SandBox parameter impacts the results as follows. If a SandBoxType of production is passed in, only those items in that SandBox are returned.
If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.

Parameters:
sandBox - - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.
contentType - - the type of content to return
count - - the max number of content items to return
ruleDTOs - - a Map of objects that will be used in MVEL processing.
Returns:
- The matching items
See Also:
DisplayContentTag

lookupStructuredContentItemsByName

List<StructuredContent> lookupStructuredContentItemsByName(SandBox sandBox,
                                                           StructuredContentType contentType,
                                                           String contentName,
                                                           Locale locale,
                                                           Integer count,
                                                           Map<String,Object> ruleDTOs)
This method returns content
Returns active content items for the passed in sandbox that match the passed in type.
The SandBox parameter impacts the results as follows. If a SandBoxType of production is passed in, only those items in that SandBox are returned.
If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.

Parameters:
sandBox - - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.
contentType - - the type of content to return
contentName - - the name of content to return
count - - the max number of content items to return
ruleDTOs - - a Map of objects that will be used in MVEL processing.
Returns:
- The matching items
See Also:
DisplayContentTag


Copyright © 2011. All Rights Reserved.