spcp7.imagegallery.abstractionlayer.impl.internal
Class ContentProviderRegistryImpl

java.lang.Object
  extended by spcp7.imagegallery.abstractionlayer.impl.internal.ContentProviderRegistryImpl
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware, ContentProviderRegistryFace

public class ContentProviderRegistryImpl
extends java.lang.Object
implements ContentProviderRegistryFace, org.springframework.context.ApplicationContextAware

Author:
Phillip Merensky

Constructor Summary
ContentProviderRegistryImpl()
          Default constructor which initializes the default properties
 
Method Summary
 java.lang.Long addContentFolder(ContentFolderModelFace contentFolder)
          With this method a new not yet existing content folder can be added.
 java.util.List<ContentFolderModelFace> getAllContentFolders()
          This method retrieves all content folders.
 ContentFolderModelFace getContentFolderById(java.lang.Long id)
          This method retrieves a content folder with the specified id.
 ContentFolderModelFace getContentFolderInstance()
          This method is a factory for a content folder instance to be independent of the underlying implementation.
 java.util.List<ContentFolderModelFace> getContentFolders(int from, int to)
          This method retrieves content folders.
 ContentFace getContentInstance()
          This method is a factory for a content instance to be independent of the underlying implementation.
 ContentManipulationFace getContentManipulatorInstance(java.lang.String typeID)
          Call this method if you need a content manipulator instance of the specified content provider.
 ContentProviderFace getContentProviderInstance(java.lang.String typeID)
          Call this method if you need an instance of a specified content provider
.
 java.util.List<java.lang.String> getContentProviders()
          This method retrieves a List of content providers.
 ContentRetrievalFace getContentRetrievalInstance(java.lang.String typeID)
          Call this method if you need a content retrieval instance of the specified content provider.
 ContentSubmitterFace getContentSubmitterInstance(java.lang.String typeID)
          Call this method if you need a content submitter instance of the specified content provider.
 java.util.Map<java.lang.String,PropertyModelFace> getDefaultProperties()
          This methods returns a list of spcp7 default properties.
 void registerContentFolderActionListener(ContentFolderActionListenerFace listener)
          This methods registers a listener for content folder actions.
 void registerContentProvider(ContentProviderFace contentProvider)
          Deprecated.  
 void removeContentFolder(java.lang.Long id)
          With this method a content folder can be removed by its id.
 void removeContentFolderActionListener(ContentFolderActionListenerFace listener)
          This method removes the specified listener from the content folder action listener list.
 void removeContentProvider(java.lang.String typeId)
          Deprecated.  
 void setApplicationContext(org.springframework.context.ApplicationContext arg0)
           
 void setContentProviders(java.util.List<ContentProviderFace> contentProviders)
          Injected by Spring
 void setCprValidation(CprValidation cprValidation)
          Injected by Spring
 void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
          Injected by Spring
 void setGeneralValidationUtil(GeneralValidation generalValidationUtil)
          Injected by Spring
 java.lang.Long updateContentFolder(ContentFolderModelFace contentFolder)
          With this method a yet existing content folder can be updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentProviderRegistryImpl

public ContentProviderRegistryImpl()
Default constructor which initializes the default properties

See Also:
initDefaultProperties()
Method Detail

addContentFolder

public java.lang.Long addContentFolder(ContentFolderModelFace contentFolder)
                                throws ContentFolderValidationException,
                                       ContentProviderNotAvailableException,
                                       PropertyBooleanValidationException,
                                       PropertyNumberValidationException
Description copied from interface: ContentProviderRegistryFace
With this method a new not yet existing content folder can be added. For updates of content folders use ContentProviderRegistryFace.updateContentFolder(ContentFolderModelFace). Properties of the content folder and the default properties of the gallery will be merged so that properties of the content folder overwrite the default properties of the image gallery if the keys are the same.

Specified by:
addContentFolder in interface ContentProviderRegistryFace
Parameters:
contentFolder - The content folder which should be added. The id should not be set. If it is set, it will be overwritten.
Returns:
The id of the yet inserted content folder
Throws:
ContentFolderValidationException
ContentProviderNotAvailableException
PropertyBooleanValidationException
PropertyNumberValidationException
See Also:
ContentProviderRegistryFace.addContentFolder(spcp7.imagegallery.abstractionlayer.face.persistence.ContentFolderModelFace)

setEntityManagerFactory

public void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
Injected by Spring

Parameters:
emf -

getContentFolderInstance

public ContentFolderModelFace getContentFolderInstance()
Description copied from interface: ContentProviderRegistryFace
This method is a factory for a content folder instance to be independent of the underlying implementation.

Specified by:
getContentFolderInstance in interface ContentProviderRegistryFace
Returns:
A new fresh content folder instance
See Also:
ContentProviderRegistryFace.getContentFolderInstance()

getContentManipulatorInstance

public ContentManipulationFace getContentManipulatorInstance(java.lang.String typeID)
                                                      throws ContentProviderNotAvailableException,
                                                             FeatureNotProvidedException
Description copied from interface: ContentProviderRegistryFace
Call this method if you need a content manipulator instance of the specified content provider. This method CAN be implemented. If it is not an exception will be thrown.

Specified by:
getContentManipulatorInstance in interface ContentProviderRegistryFace
Parameters:
typeID - The typeID of the content provider from which the content manipulator instance should be retrieved.
Returns:
The singleton content manipulator instance of the underlying content provider.
Throws:
ContentProviderNotAvailableException
FeatureNotProvidedException - If manipulation is not available for the specified content provider
See Also:
ContentProviderRegistryFace.getContentManipulatorInstance(java.lang.String)

getContentRetrievalInstance

public ContentRetrievalFace getContentRetrievalInstance(java.lang.String typeID)
                                                 throws ContentProviderNotAvailableException
Description copied from interface: ContentProviderRegistryFace
Call this method if you need a content retrieval instance of the specified content provider. This method must be implemented by every content provider

Specified by:
getContentRetrievalInstance in interface ContentProviderRegistryFace
Parameters:
typeID - The typeID of the content provider from which the content retrieval instance should be retrieved.
Returns:
The singleton content retrieval instance of the underlying content provider.
Throws:
ContentProviderNotAvailableException
See Also:
ContentProviderRegistryFace.getContentRetrievalInstance(java.lang.String)

getContentSubmitterInstance

public ContentSubmitterFace getContentSubmitterInstance(java.lang.String typeID)
                                                 throws ContentProviderNotAvailableException,
                                                        FeatureNotProvidedException
Description copied from interface: ContentProviderRegistryFace
Call this method if you need a content submitter instance of the specified content provider. This method CAN be implemented. If not an exception will be thrown.

Specified by:
getContentSubmitterInstance in interface ContentProviderRegistryFace
Parameters:
typeID - The typeID of the content provider from which the content submitter instance should be retrieved.
Returns:
The singleton content submitter instance of the underlying content provider.
Throws:
ContentProviderNotAvailableException
FeatureNotProvidedException - If submission is not available for the specified content provider
See Also:
ContentProviderRegistryFace.getContentSubmitterInstance(java.lang.String)

getAllContentFolders

public java.util.List<ContentFolderModelFace> getAllContentFolders()
Description copied from interface: ContentProviderRegistryFace
This method retrieves all content folders.

Specified by:
getAllContentFolders in interface ContentProviderRegistryFace
Returns:
List A list of all content folders.
See Also:
ContentProviderRegistryFace.getAllContentFolders()

getContentFolders

public java.util.List<ContentFolderModelFace> getContentFolders(int from,
                                                                int to)
                                                         throws RangeNotValidException
Description copied from interface: ContentProviderRegistryFace
This method retrieves content folders. Only the specified range of the result set will be returned.

Specified by:
getContentFolders in interface ContentProviderRegistryFace
Parameters:
from - The lower border
to - The upper border
Returns:
List A list of content folders within the specified range.
Throws:
RangeNotValidException - If the provided range is not valid (eg. from bigger than to)
See Also:
ContentProviderRegistryFace.getContentFolders(int, int)

getContentProviderInstance

public ContentProviderFace getContentProviderInstance(java.lang.String typeID)
                                               throws ContentProviderNotAvailableException
Description copied from interface: ContentProviderRegistryFace
Call this method if you need an instance of a specified content provider
. To know the typeIDs of the current available content providers use ContentProviderRegistryFace.getContentProviders().

Specified by:
getContentProviderInstance in interface ContentProviderRegistryFace
Parameters:
typeID - The typeID of the content provider which should be retrieved.
Returns:
the singleton instance of the specified content provider
Throws:
ContentProviderNotAvailableException
See Also:
ContentProviderRegistryFace.getContentProviderInstance(java.lang.String)

getContentProviders

public java.util.List<java.lang.String> getContentProviders()
Description copied from interface: ContentProviderRegistryFace
This method retrieves a List of content providers. If a single content provider instance should be retrieved look at the instance retrieval methods like ContentProviderRegistryFace.getContentManipulatorInstance(String), ContentProviderRegistryFace.getContentProviderInstance(String), ContentProviderRegistryFace.getContentRetrievalInstance(String) or ContentProviderRegistryFace.getContentSubmitterInstance(String)

Specified by:
getContentProviders in interface ContentProviderRegistryFace
Returns:
List A list with strings of contentContentProviderTypeIds
See Also:
ContentProviderRegistryFace.getContentProviders()

registerContentProvider

public void registerContentProvider(ContentProviderFace contentProvider)
Deprecated. 

This shows a possibility of adding a content provider via java code. Generally this is discouraged. Inject a content provider within the spring configuration file directly!

Parameters:
contentProvider -

removeContentFolder

public void removeContentFolder(java.lang.Long id)
Description copied from interface: ContentProviderRegistryFace
With this method a content folder can be removed by its id.

Specified by:
removeContentFolder in interface ContentProviderRegistryFace
Parameters:
id - The id of the content folder which should be removed
See Also:
ContentProviderRegistryFace.removeContentFolder(java.lang.Long)

removeContentProvider

public void removeContentProvider(java.lang.String typeId)
Deprecated. 

This shows a possibility of deleting a content provider via java code. Generally this is discouraged. Remove the content provider within the spring configuration file directly!

Parameters:
typeId -

updateContentFolder

public java.lang.Long updateContentFolder(ContentFolderModelFace contentFolder)
                                   throws ContentFolderValidationException,
                                          ContentProviderNotAvailableException,
                                          PropertyBooleanValidationException,
                                          PropertyNumberValidationException
Description copied from interface: ContentProviderRegistryFace
With this method a yet existing content folder can be updated. Obviously the ContentFolderModelFace.getId() field has to be set. All values (set or unset) of the provided content folder will be overwritten in the older persisted instance.

Specified by:
updateContentFolder in interface ContentProviderRegistryFace
Parameters:
contentFolder - The new content folder which with new values which should replace the old one with the same id
Returns:
The id of the updated content folder
Throws:
ContentFolderValidationException
ContentProviderNotAvailableException
PropertyBooleanValidationException
PropertyNumberValidationException
See Also:
ContentProviderRegistryFace.updateContentFolder(spcp7.imagegallery.abstractionlayer.face.persistence.ContentFolderModelFace)

getContentFolderById

public ContentFolderModelFace getContentFolderById(java.lang.Long id)
Description copied from interface: ContentProviderRegistryFace
This method retrieves a content folder with the specified id.

Specified by:
getContentFolderById in interface ContentProviderRegistryFace
Parameters:
id - The id of the content folder which should be retrieved
Returns:
A value copied instance of the content folder with the specified id.
See Also:
ContentProviderRegistryFace.getContentFolderById(java.lang.Long)

getContentInstance

public ContentFace getContentInstance()
Description copied from interface: ContentProviderRegistryFace
This method is a factory for a content instance to be independent of the underlying implementation.

Specified by:
getContentInstance in interface ContentProviderRegistryFace
Returns:
A new fresh content instance
See Also:
ContentProviderRegistryFace.getContentInstance()

getDefaultProperties

public java.util.Map<java.lang.String,PropertyModelFace> getDefaultProperties()
Description copied from interface: ContentProviderRegistryFace
This methods returns a list of spcp7 default properties. That is properties that are essential for the operation of the whole concept.
These properties can be overwritten within a class implementing ContentProviderFace. Properties of ContentProviderFace implementations and these default properties will be merged when adding a new content folder. In this case properties of the content provider with the same PropertyModelFace.setSchluessel(String) will overwrite properties of this method.

Specified by:
getDefaultProperties in interface ContentProviderRegistryFace
Returns:
A Map containing key (PropertyModelFace.setSchluessel(String)) value associations of default properties.
See Also:
ContentProviderRegistryFace.getDefaultProperties()

registerContentFolderActionListener

public void registerContentFolderActionListener(ContentFolderActionListenerFace listener)
Description copied from interface: ContentProviderRegistryFace
This methods registers a listener for content folder actions. The registered listeners will not be persisted and thus have to be reregistered when a new instance of the content provider registry will be created.

Specified by:
registerContentFolderActionListener in interface ContentProviderRegistryFace
Parameters:
listener - A class implementing ContentFolderActionListenerFace
See Also:
ContentProviderRegistryFace.registerContentFolderActionListener(spcp7.imagegallery.abstractionlayer.face.ContentFolderActionListenerFace)

removeContentFolderActionListener

public void removeContentFolderActionListener(ContentFolderActionListenerFace listener)
Description copied from interface: ContentProviderRegistryFace
This method removes the specified listener from the content folder action listener list.

Specified by:
removeContentFolderActionListener in interface ContentProviderRegistryFace
Parameters:
listener - A class implementing ContentFolderActionListenerFace
See Also:
ContentProviderRegistryFace.removeContentFolderActionListener(spcp7.imagegallery.abstractionlayer.face.ContentFolderActionListenerFace)

setContentProviders

public void setContentProviders(java.util.List<ContentProviderFace> contentProviders)
Injected by Spring

Parameters:
contentProviders -

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext arg0)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException
See Also:
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)

setGeneralValidationUtil

public void setGeneralValidationUtil(GeneralValidation generalValidationUtil)
Injected by Spring

Parameters:
generalValidationUtil - the generalValidationUtil to set

setCprValidation

public void setCprValidation(CprValidation cprValidation)
Injected by Spring

Parameters:
cprValidation - the cprValidation to set


Copyright © 2008. All Rights Reserved.