com.flexive.shared.interfaces
Interface ContentEngine

All Known Subinterfaces:
ContentEngineLocal

public interface ContentEngine

ContentEngine

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Method Summary
 FxPK createNewVersion(FxContent content)
          Create a new version for an existing content instance
 java.lang.String exportContent(FxContent content)
          Export a content instance
 long getBinaryId(FxPK pk, java.lang.String xpath, FxLanguage language)
          Get the binary id for the given XPath.
 long getBinaryId(FxPK pk, java.lang.String xpath, FxLanguage language, boolean fallbackToDefault)
          Get the binary id for the given XPath.
 FxContentSecurityInfo getContentSecurityInfo(FxPK pk)
          Get all security relevant information about a content instance identified by its primary key
 FxContentVersionInfo getContentVersionInfo(FxPK id)
          Get information about the versions used for a content id
 java.util.List<FxPK> getPKsForType(long typeId, boolean onePkPerInstance)
           Returns all primary keys for the given type.
 int getReferencedContentCount(FxPK pk)
          Get the number of references that exist for the requested content
 FxContent importContent(java.lang.String xml, boolean newInstance)
          Import a content from XML
 FxContent initialize(long typeId)
          Initialize a new FxContent instance for a type with default values.
 FxContent initialize(long typeId, long mandatorId, long prefACL, long prefStep, long prefLang)
          Initialize a new FxContent instance with preferred acl, step and language
 FxContent initialize(java.lang.String typeName)
          Initialize a new FxContent instance for a type with default values.
 FxContent load(FxPK pk)
          Load a content
 FxContentContainer loadContainer(long id)
          Load a content container (all versions of a content)
 FxContent prepareSave(FxContent content)
          Prepare a content for a save or create operation (resolves binaries for script processing, etc.).
 void remove(FxPK pk)
          Remove a content
 int removeForType(long typeId)
          Remove all instances of the given type.
 void removeVersion(FxPK pk)
          Remove a content's version.
 FxPK save(FxContent content)
          Store an existing content or create a new one
 

Method Detail

initialize

FxContent initialize(long typeId,
                     long mandatorId,
                     long prefACL,
                     long prefStep,
                     long prefLang)
                     throws FxApplicationException
Initialize a new FxContent instance with preferred acl, step and language

Parameters:
typeId - type to use
mandatorId - mandator to assign this content (has to be available for the type!)
prefACL - preferred acl, if not applicable the best fit will be used
prefStep - preferred step, if not applicable the best fit will be used
prefLang - preferred language, if not applicable the best fit will be used
Returns:
FxContent
Throws:
FxApplicationException - TODO
FxLoadException - on initialization errors

initialize

FxContent initialize(long typeId)
                     throws FxApplicationException
Initialize a new FxContent instance for a type with default values. mandator, ACL, Step and Lang will be taken on a "first-useable" basis

Parameters:
typeId - type to use
Returns:
content instance
Throws:
FxApplicationException - on errors

initialize

FxContent initialize(java.lang.String typeName)
                     throws FxApplicationException
Initialize a new FxContent instance for a type with default values. mandator, ACL, Step and Lang will be taken on a "first-useable" basis

Parameters:
typeName - type to use
Returns:
content instance
Throws:
FxApplicationException - on errors

load

FxContent load(FxPK pk)
               throws FxApplicationException
Load a content

Parameters:
pk - primary key to load
Returns:
FxContent
Throws:
FxApplicationException - TODO
FxLoadException
FxNoAccessException
FxNotFoundException - if no instance for this primary key was found

loadContainer

FxContentContainer loadContainer(long id)
                                 throws FxApplicationException
Load a content container (all versions of a content)

Parameters:
id - requested content id
Returns:
container with all versions of the content
Throws:
FxApplicationException - on errors

save

FxPK save(FxContent content)
          throws FxApplicationException
Store an existing content or create a new one

Parameters:
content - the content to persist
Returns:
the primary key of the content
Throws:
FxApplicationException - TODO
FxCreateException - on errors
FxUpdateException - on errors
FxNoAccessException

prepareSave

FxContent prepareSave(FxContent content)
                      throws FxApplicationException
Prepare a content for a save or create operation (resolves binaries for script processing, etc.). This is optional and is not required to be called prior to saving, it exists to have metadata available in GUI's prior to saving.

Parameters:
content - the content to prepare
Returns:
the prepared content
Throws:
FxInvalidParameterException - on errors
FxDbException - on errors
FxApplicationException

createNewVersion

FxPK createNewVersion(FxContent content)
                      throws FxApplicationException
Create a new version for an existing content instance

Parameters:
content - the content to persist
Returns:
the primary key of the contents new version
Throws:
FxApplicationException - TODO
FxCreateException - on errors
FxUpdateException - on errors
FxNoAccessException

remove

void remove(FxPK pk)
            throws FxApplicationException
Remove a content

Parameters:
pk - primary key of the content to remove
Throws:
FxApplicationException - TODO
FxRemoveException - on errors
FxNoAccessException - on errors

removeVersion

void removeVersion(FxPK pk)
                   throws FxApplicationException
Remove a content's version. If the content consists only of this specific version the whole content is removed

Parameters:
pk - primary key of a distinct version to remove
Throws:
FxApplicationException - TODO
FxRemoveException - on errors
FxNoAccessException - on errors

removeForType

int removeForType(long typeId)
                  throws FxApplicationException
Remove all instances of the given type. Beans using this method should apply very strict security restrictions!

Parameters:
typeId - affected FxType
Returns:
number of instances removed
Throws:
FxApplicationException - TODO
FxRemoveException - on errors

getContentSecurityInfo

FxContentSecurityInfo getContentSecurityInfo(FxPK pk)
                                             throws FxApplicationException
Get all security relevant information about a content instance identified by its primary key

Parameters:
pk - primary key to query security information for
Returns:
FxContentSecurityInfo
Throws:
FxApplicationException - TODO

getContentVersionInfo

FxContentVersionInfo getContentVersionInfo(FxPK id)
                                           throws FxApplicationException
Get information about the versions used for a content id

Parameters:
id - the id to query version information for
Returns:
FxContentVersionInfo
Throws:
FxApplicationException - on errors

getReferencedContentCount

int getReferencedContentCount(FxPK pk)
                              throws FxApplicationException
Get the number of references that exist for the requested content

Parameters:
pk - primary key of the requested content
Returns:
number of references that exist for the requested content
Throws:
FxApplicationException - on errors

getPKsForType

java.util.List<FxPK> getPKsForType(long typeId,
                                   boolean onePkPerInstance)
                                   throws FxApplicationException

Returns all primary keys for the given type. Since this method does not implement security, it may only be called by the global supervisor. You can use the search engine to achieve the same, just with security enabled, with

final List<FxPK> folderPks = new SqlQueryBuilder().select("@pk").type("FOLDER").getResult().collectColumn(1);

Parameters:
typeId - the type to request the primary keys for
onePkPerInstance - return one primary key per instance (with max version) or one per actual version?
Returns:
list containing the primary keys
Throws:
FxApplicationException - on errors

getBinaryId

long getBinaryId(FxPK pk,
                 java.lang.String xpath,
                 FxLanguage language)
                 throws FxApplicationException
Get the binary id for the given XPath. The root ("/") XPath will return the contents preview binary id. An invalid XPath or no associated binary id will throw an FxNotFoundException or FxInvalidParameterException. Security will be checked and FxNoAccessException thrown if restricted.

Parameters:
pk - primary key
xpath - XPath
language - the language (if null, the user ticket language will be used)
Returns:
binary id
Throws:
FxApplicationException - on errors

getBinaryId

long getBinaryId(FxPK pk,
                 java.lang.String xpath,
                 FxLanguage language,
                 boolean fallbackToDefault)
                 throws FxApplicationException
Get the binary id for the given XPath. If no binary exists for the requested language, the default language will be tried. The root ("/") XPath will return the contents preview binary id. An invalid XPath or no associated binary id will throw an FxNotFoundException or FxInvalidParameterException. Security will be checked and FxNoAccessException thrown if restricted.

Parameters:
pk - primary key
xpath - XPath
language - the language (if null, the user ticket language will be used)
fallbackToDefault - fall back to the default language if the requested language is not null and not found?
Returns:
binary id
Throws:
FxApplicationException - on errors

importContent

FxContent importContent(java.lang.String xml,
                        boolean newInstance)
                        throws FxApplicationException
Import a content from XML

Parameters:
xml - the content as XML
newInstance - modify the content to be treated like a new instance
Returns:
FxContent
Throws:
FxApplicationException - on errors

exportContent

java.lang.String exportContent(FxContent content)
                               throws FxApplicationException
Export a content instance

Parameters:
content - content instance to export
Returns:
content as XML
Throws:
FxApplicationException - on errors