com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate
Class HibernateRepositoryServiceImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by com.jaspersoft.jasperserver.api.metadata.common.service.impl.HibernateDaoImpl
              extended by com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryServiceImpl
All Implemented Interfaces:
HibernateRepositoryService, ReferenceResolver, RepositoryService, RepositoryUnsecure, org.springframework.beans.factory.InitializingBean

public class HibernateRepositoryServiceImpl
extends HibernateDaoImpl
implements HibernateRepositoryService, ReferenceResolver

Version:
$Id: HibernateRepositoryServiceImpl.java 10237 2007-09-25 19:58:01Z bob $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jaspersoft.jasperserver.api.metadata.common.service.impl.HibernateDaoImpl
HibernateDaoImpl.DaoCallback
 
Field Summary
protected static java.lang.String CHILDREN_FOLDER_SUFFIX
           
protected static java.lang.String TEMP_NAME_PREFIX
           
protected static int TEMP_NAME_PREFIX_LENGTH
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
HibernateRepositoryServiceImpl()
           
 
Method Summary
protected  RepoResource createPersistentResource(java.lang.Class persistentClass)
           
 void delete(ExecutionContext context, java.lang.String[] resourceURIs, java.lang.String[] folderURIs)
           
 void deleteFolder(ExecutionContext context, java.lang.String uri)
           
protected  void deleteFolder(java.lang.String uri)
           
 void deleteResource(ExecutionContext context, java.lang.String uri)
           
protected  void deleteResource(java.lang.String uri)
           
protected  RepoResource findByName(java.lang.Class persistentClass, RepoFolder folder, java.lang.String name, boolean required)
           
 RepoResource findByURI(java.lang.Class persistentClass, java.lang.String uri, boolean required)
           
 ResourceLookup[] findResource(ExecutionContext context, FilterCriteria filterCriteria)
          Given filtering criteria, find relevant Resources.
 ResourceLookup[] findResources(ExecutionContext context, FilterCriteria[] filterCriteria)
           
 boolean folderExists(ExecutionContext context, java.lang.String uri)
           
protected  boolean folderExists(java.lang.String uri)
           
 java.util.List getAllFolders(ExecutionContext context)
           
 java.lang.String getChildrenFolderName(java.lang.String resourceName)
           
protected  java.text.Collator getCollator(ExecutionContext context)
           
 CollatorFactory getCollatorFactory()
           
 FileResourceData getContentResourceData(ExecutionContext context, java.lang.String uri)
           
 RepoResource getExternalReference(java.lang.String uri, java.lang.Class persistentReferenceClass)
           
 Folder getFolder(ExecutionContext context, java.lang.String uri)
           
protected  RepoFolder getFolder(java.lang.String uri, boolean required)
           
 Folder getFolderUnsecure(ExecutionContext context, java.lang.String uri)
           
 ResourceFactory getPersistentClassMappings()
           
 RepoResource getPersistentReference(java.lang.String uri, java.lang.Class clientReferenceClass)
           
 RepoResource getReference(RepoResource owner, Resource resource, java.lang.Class persistentReferenceClass)
           
 RepoResource getReference(RepoResource owner, ResourceReference resourceRef, java.lang.Class persistentReferenceClass)
           
 RepoResource getRepoResource(Resource resource)
           
protected  RepoResource getRepositoryReference(RepoResource owner, Resource res)
           
 Resource getResource(ExecutionContext context, java.lang.String uri)
           
 Resource getResource(ExecutionContext context, java.lang.String uri, java.lang.Class resourceType)
           
 FileResourceData getResourceData(ExecutionContext context, java.lang.String uri)
           
 ResourceFactory getResourceFactory()
           
 Resource getResourceUnsecure(ExecutionContext context, java.lang.String uri)
           
protected  RepoFolder getRootFolder()
           
 java.util.List getSubFolders(ExecutionContext context, java.lang.String folderURI)
           
 ResourceValidator getValidator(Resource resource)
           
 java.util.Map getValidatorMappings()
           
 void hideFolder(java.lang.String uri)
           
protected  void initTempNameResources()
           
 java.util.List loadClientResources(FilterCriteria filterCriteria)
           
protected  java.util.List loadRepoResourceList(ExecutionContext context, FilterCriteria filterCriteria)
           
 java.util.List loadRepoResourceList(ExecutionContext context, FilterCriteria filterCriteria, boolean sort)
           
 java.util.List loadRepoResourceList(FilterCriteria filterCriteria)
           
protected  java.lang.Object loadResource(java.lang.String uri, java.lang.Class resourceType)
           
protected  ResourceLookup[] loadResources(ExecutionContext context, FilterCriteria filterCriteria)
           
protected  ResourceLookup[] loadResources(ExecutionContext context, FilterCriteria[] filterCriteria)
           
 java.util.List loadResourcesList(ExecutionContext context, FilterCriteria filterCriteria)
           
 java.util.List loadResourcesList(ExecutionContext context, FilterCriteria[] filterCriteria)
           
 java.util.List loadResourcesList(FilterCriteria filterCriteria)
           
 Resource newResource(ExecutionContext context, java.lang.Class _class)
          Return a Resource that does not yet contain content.
protected  boolean pathExists(java.lang.String uri)
           
 boolean repositoryPathExists(ExecutionContext context, java.lang.String uri)
          Determines whether a resource or folder having a specified URI exists in the repository.
protected  void resetTempNameResources()
           
 boolean resourceExists(ExecutionContext executionContext, FilterCriteria filterCriteria)
           
 boolean resourceExists(ExecutionContext executionContext, java.lang.String uri)
           
 boolean resourceExists(ExecutionContext executionContext, java.lang.String uri, java.lang.Class resourceType)
           
protected  boolean resourceExists(RepoFolder folder, java.lang.String name, java.lang.Class resourceType)
           
protected  boolean resourceExists(java.lang.String uri)
           
protected  boolean resourceExists(java.lang.String uri, java.lang.Class type)
           
protected  java.lang.Class resourcePersistentClass(java.lang.Class resourceType)
           
 void saveFolder(ExecutionContext context, Folder folder)
           
protected  void saveFolder(Folder folder)
           
 void saveResource(ExecutionContext context, Resource resource)
           
 void setCollatorFactory(CollatorFactory collatorFactory)
           
 void setPersistentClassMappings(ResourceFactory persistentClassMappings)
           
 void setResourceFactory(ResourceFactory resourceFactory)
           
 void setValidatorMappings(java.util.Map validatorMappings)
           
protected  void sortRepoResourcesByURI(ExecutionContext context, java.util.List repoResources)
           
protected  java.util.Set tempNameResources()
           
protected  java.util.List toLookups(java.util.List repoResources)
           
protected  org.hibernate.criterion.DetachedCriteria translateFilterToCriteria(FilterCriteria filterCriteria)
           
 void unhideFolder(java.lang.String uri)
           
 ValidationErrors validateResource(ExecutionContext context, Resource resource, ValidationErrorFilter filter)
           
 
Methods inherited from class com.jaspersoft.jasperserver.api.metadata.common.service.impl.HibernateDaoImpl
endOperation, executeCallback, executeWriteCallback, executeWriteCallback, getOperationTimestamp, startOperation
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMP_NAME_PREFIX

protected static final java.lang.String TEMP_NAME_PREFIX
See Also:
Constant Field Values

TEMP_NAME_PREFIX_LENGTH

protected static final int TEMP_NAME_PREFIX_LENGTH

CHILDREN_FOLDER_SUFFIX

protected static final java.lang.String CHILDREN_FOLDER_SUFFIX
See Also:
Constant Field Values
Constructor Detail

HibernateRepositoryServiceImpl

public HibernateRepositoryServiceImpl()
Method Detail

getPersistentClassMappings

public ResourceFactory getPersistentClassMappings()

setPersistentClassMappings

public void setPersistentClassMappings(ResourceFactory persistentClassMappings)

getResourceFactory

public ResourceFactory getResourceFactory()

setResourceFactory

public void setResourceFactory(ResourceFactory resourceFactory)

getValidatorMappings

public java.util.Map getValidatorMappings()

setValidatorMappings

public void setValidatorMappings(java.util.Map validatorMappings)

getValidator

public ResourceValidator getValidator(Resource resource)

getResource

public Resource getResource(ExecutionContext context,
                            java.lang.String uri)
Specified by:
getResource in interface HibernateRepositoryService
Specified by:
getResource in interface RepositoryService
Returns:
the resource if found or null otherwise

getResourceUnsecure

public Resource getResourceUnsecure(ExecutionContext context,
                                    java.lang.String uri)
Specified by:
getResourceUnsecure in interface RepositoryUnsecure
Returns:
the resource if found or null otherwise

getResource

public Resource getResource(ExecutionContext context,
                            java.lang.String uri,
                            java.lang.Class resourceType)
Specified by:
getResource in interface RepositoryService

loadResource

protected java.lang.Object loadResource(java.lang.String uri,
                                        java.lang.Class resourceType)

resourcePersistentClass

protected java.lang.Class resourcePersistentClass(java.lang.Class resourceType)

saveFolder

public void saveFolder(ExecutionContext context,
                       Folder folder)
Specified by:
saveFolder in interface RepositoryService

saveFolder

protected void saveFolder(Folder folder)

getFolder

protected RepoFolder getFolder(java.lang.String uri,
                               boolean required)

getRootFolder

protected RepoFolder getRootFolder()

validateResource

public ValidationErrors validateResource(ExecutionContext context,
                                         Resource resource,
                                         ValidationErrorFilter filter)
Specified by:
validateResource in interface RepositoryService

saveResource

public void saveResource(ExecutionContext context,
                         Resource resource)
Specified by:
saveResource in interface HibernateRepositoryService
Specified by:
saveResource in interface RepositoryService

initTempNameResources

protected void initTempNameResources()

resetTempNameResources

protected void resetTempNameResources()

tempNameResources

protected java.util.Set tempNameResources()

getRepoResource

public RepoResource getRepoResource(Resource resource)
Specified by:
getRepoResource in interface HibernateRepositoryService

resourceExists

public boolean resourceExists(ExecutionContext executionContext,
                              java.lang.String uri)
Specified by:
resourceExists in interface RepositoryService

resourceExists

public boolean resourceExists(ExecutionContext executionContext,
                              java.lang.String uri,
                              java.lang.Class resourceType)
Specified by:
resourceExists in interface RepositoryService

resourceExists

public boolean resourceExists(ExecutionContext executionContext,
                              FilterCriteria filterCriteria)
Specified by:
resourceExists in interface RepositoryService

resourceExists

protected boolean resourceExists(java.lang.String uri)

resourceExists

protected boolean resourceExists(java.lang.String uri,
                                 java.lang.Class type)

findResource

public ResourceLookup[] findResource(ExecutionContext context,
                                     FilterCriteria filterCriteria)
Description copied from interface: HibernateRepositoryService
Given filtering criteria, find relevant Resources.

Specified by:
findResource in interface HibernateRepositoryService
Specified by:
findResource in interface RepositoryService
Returns:
Array of found Resources

findResources

public ResourceLookup[] findResources(ExecutionContext context,
                                      FilterCriteria[] filterCriteria)
Specified by:
findResources in interface RepositoryService

loadClientResources

public java.util.List loadClientResources(FilterCriteria filterCriteria)
Specified by:
loadClientResources in interface RepositoryService

loadResourcesList

public java.util.List loadResourcesList(FilterCriteria filterCriteria)
Specified by:
loadResourcesList in interface RepositoryService

loadResourcesList

public java.util.List loadResourcesList(ExecutionContext context,
                                        FilterCriteria filterCriteria)
Specified by:
loadResourcesList in interface RepositoryService

loadResourcesList

public java.util.List loadResourcesList(ExecutionContext context,
                                        FilterCriteria[] filterCriteria)
Specified by:
loadResourcesList in interface RepositoryService

toLookups

protected java.util.List toLookups(java.util.List repoResources)

loadResources

protected ResourceLookup[] loadResources(ExecutionContext context,
                                         FilterCriteria filterCriteria)

loadResources

protected ResourceLookup[] loadResources(ExecutionContext context,
                                         FilterCriteria[] filterCriteria)

loadRepoResourceList

public java.util.List loadRepoResourceList(FilterCriteria filterCriteria)

loadRepoResourceList

protected java.util.List loadRepoResourceList(ExecutionContext context,
                                              FilterCriteria filterCriteria)

loadRepoResourceList

public java.util.List loadRepoResourceList(ExecutionContext context,
                                           FilterCriteria filterCriteria,
                                           boolean sort)

translateFilterToCriteria

protected org.hibernate.criterion.DetachedCriteria translateFilterToCriteria(FilterCriteria filterCriteria)

sortRepoResourcesByURI

protected void sortRepoResourcesByURI(ExecutionContext context,
                                      java.util.List repoResources)

newResource

public Resource newResource(ExecutionContext context,
                            java.lang.Class _class)
Description copied from interface: RepositoryService
Return a Resource that does not yet contain content.

Specified by:
newResource in interface HibernateRepositoryService
Specified by:
newResource in interface RepositoryService
Returns:
Resource

findByURI

public RepoResource findByURI(java.lang.Class persistentClass,
                              java.lang.String uri,
                              boolean required)
Specified by:
findByURI in interface HibernateRepositoryService

findByName

protected RepoResource findByName(java.lang.Class persistentClass,
                                  RepoFolder folder,
                                  java.lang.String name,
                                  boolean required)

resourceExists

protected boolean resourceExists(RepoFolder folder,
                                 java.lang.String name,
                                 java.lang.Class resourceType)

createPersistentResource

protected RepoResource createPersistentResource(java.lang.Class persistentClass)

getRepositoryReference

protected RepoResource getRepositoryReference(RepoResource owner,
                                              Resource res)

getReference

public RepoResource getReference(RepoResource owner,
                                 ResourceReference resourceRef,
                                 java.lang.Class persistentReferenceClass)
Specified by:
getReference in interface ReferenceResolver

getReference

public RepoResource getReference(RepoResource owner,
                                 Resource resource,
                                 java.lang.Class persistentReferenceClass)
Specified by:
getReference in interface ReferenceResolver

getAllFolders

public java.util.List getAllFolders(ExecutionContext context)
Specified by:
getAllFolders in interface RepositoryService

getSubFolders

public java.util.List getSubFolders(ExecutionContext context,
                                    java.lang.String folderURI)
Specified by:
getSubFolders in interface RepositoryService

getResourceData

public FileResourceData getResourceData(ExecutionContext context,
                                        java.lang.String uri)
                                 throws JSResourceNotFoundException
Specified by:
getResourceData in interface HibernateRepositoryService
Specified by:
getResourceData in interface RepositoryService
Returns:
Throws:
JSResourceNotFoundException

getContentResourceData

public FileResourceData getContentResourceData(ExecutionContext context,
                                               java.lang.String uri)
                                        throws JSResourceNotFoundException
Specified by:
getContentResourceData in interface RepositoryService
Throws:
JSResourceNotFoundException

getExternalReference

public RepoResource getExternalReference(java.lang.String uri,
                                         java.lang.Class persistentReferenceClass)
Specified by:
getExternalReference in interface ReferenceResolver

getPersistentReference

public RepoResource getPersistentReference(java.lang.String uri,
                                           java.lang.Class clientReferenceClass)
Specified by:
getPersistentReference in interface ReferenceResolver

deleteResource

public void deleteResource(ExecutionContext context,
                           java.lang.String uri)
Specified by:
deleteResource in interface HibernateRepositoryService
Specified by:
deleteResource in interface RepositoryService

deleteResource

protected void deleteResource(java.lang.String uri)

deleteFolder

public void deleteFolder(ExecutionContext context,
                         java.lang.String uri)
Specified by:
deleteFolder in interface HibernateRepositoryService
Specified by:
deleteFolder in interface RepositoryService

deleteFolder

protected void deleteFolder(java.lang.String uri)

delete

public void delete(ExecutionContext context,
                   java.lang.String[] resourceURIs,
                   java.lang.String[] folderURIs)
Specified by:
delete in interface HibernateRepositoryService
Specified by:
delete in interface RepositoryService

getFolder

public Folder getFolder(ExecutionContext context,
                        java.lang.String uri)
Specified by:
getFolder in interface RepositoryService

folderExists

public boolean folderExists(ExecutionContext context,
                            java.lang.String uri)
Specified by:
folderExists in interface RepositoryService

getFolderUnsecure

public Folder getFolderUnsecure(ExecutionContext context,
                                java.lang.String uri)
Specified by:
getFolderUnsecure in interface RepositoryUnsecure

folderExists

protected boolean folderExists(java.lang.String uri)

getChildrenFolderName

public java.lang.String getChildrenFolderName(java.lang.String resourceName)
Specified by:
getChildrenFolderName in interface RepositoryService

getCollatorFactory

public CollatorFactory getCollatorFactory()

setCollatorFactory

public void setCollatorFactory(CollatorFactory collatorFactory)

getCollator

protected java.text.Collator getCollator(ExecutionContext context)

pathExists

protected boolean pathExists(java.lang.String uri)

repositoryPathExists

public boolean repositoryPathExists(ExecutionContext context,
                                    java.lang.String uri)
Description copied from interface: RepositoryService
Determines whether a resource or folder having a specified URI exists in the repository.

Repository entities are uniquely identified by their URI. This method can be used to check whether a URI is already present in the repository.

Specified by:
repositoryPathExists in interface RepositoryService
Parameters:
context - the execution context
uri - the URI
Returns:
true iff the URI is present in the repository

hideFolder

public void hideFolder(java.lang.String uri)
Specified by:
hideFolder in interface RepositoryService

unhideFolder

public void unhideFolder(java.lang.String uri)
Specified by:
unhideFolder in interface RepositoryService


Copyright © 2007. All Rights Reserved.