// $Id$\r
/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy\r
-* http://www.e-taxonomy.eu\r
-*\r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
+ * Copyright (C) 2007 EDIT\r
+ * European Distributed Institute of Taxonomy\r
+ * http://www.e-taxonomy.eu\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version 1.1\r
+ * See LICENSE.TXT at the top of this package for the full license terms.\r
+ */\r
\r
package eu.etaxonomy.cdm.api.application;\r
\r
import org.springframework.beans.factory.annotation.Autowired;\r
import org.springframework.context.ApplicationContext;\r
import org.springframework.context.ApplicationContextAware;\r
-import org.springframework.orm.hibernate3.HibernateTransactionManager;\r
-import org.springframework.security.access.PermissionEvaluator;\r
+import org.springframework.orm.hibernate4.HibernateTransactionManager;\r
import org.springframework.security.authentication.ProviderManager;\r
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;\r
+import org.springframework.security.core.Authentication;\r
+import org.springframework.security.core.context.SecurityContext;\r
+import org.springframework.security.core.context.SecurityContextHolder;\r
import org.springframework.stereotype.Component;\r
import org.springframework.transaction.PlatformTransactionManager;\r
import org.springframework.transaction.TransactionDefinition;\r
import eu.etaxonomy.cdm.api.service.ICommonService;\r
import eu.etaxonomy.cdm.api.service.IDatabaseService;\r
import eu.etaxonomy.cdm.api.service.IDescriptionService;\r
+import eu.etaxonomy.cdm.api.service.IEntityConstraintViolationService;\r
+import eu.etaxonomy.cdm.api.service.IEntityValidationService;\r
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;\r
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;\r
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;\r
import eu.etaxonomy.cdm.api.service.IUserService;\r
import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
import eu.etaxonomy.cdm.api.service.IWorkingSetService;\r
+import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;\r
+import eu.etaxonomy.cdm.api.service.molecular.IPrimerService;\r
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;\r
import eu.etaxonomy.cdm.model.common.CdmBase;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.ICdmPermissionEvaluator;\r
\r
/**\r
* @author a.mueller\r
* @created 21.05.2008\r
* @version 1.0\r
*/\r
-/**\r
- * @author a.mueller\r
- *\r
- */\r
@Component\r
public class CdmApplicationDefaultConfiguration implements ICdmApplicationConfiguration, ApplicationContextAware {\r
- private static final Logger logger = Logger.getLogger(CdmApplicationDefaultConfiguration.class);\r
-\r
- protected ApplicationContext applicationContext;\r
-\r
-\r
- @Autowired\r
- //@Qualifier("nameService")\r
- private INameService nameService;\r
- @Autowired\r
- //@Qualifier("taxonService")\r
- private ITaxonService taxonService;\r
- @Autowired\r
- //@Qualifier("classificationService")\r
- private IClassificationService classificationService;\r
- @Autowired\r
- //@Qualifier("referenceService")\r
- private IReferenceService referenceService;\r
- @Autowired\r
- //@Qualifier("agentService")\r
- private IAgentService agentService;\r
- @Autowired\r
- //@Qualifier("databaseService")\r
- private IDatabaseService databaseService;\r
- @Autowired\r
- //@Qualifier("termService")\r
- private ITermService termService;\r
- @Autowired\r
- private HibernateTransactionManager transactionManager;\r
- @Autowired\r
- //@Qualifier("descriptionService")\r
- private IDescriptionService descriptionService;\r
- @Autowired\r
- //@Qualifier("occurrenceService")\r
- private IOccurrenceService occurrenceService;\r
- @Autowired\r
- //@Qualifier("mediaService")\r
- private IMediaService mediaService;\r
- @Autowired\r
- //@Qualifier("commonService")\r
- private ICommonService commonService;\r
- @Autowired\r
- private ILocationService locationService;\r
- @Autowired\r
- private SessionFactory sessionFactory;\r
- @Autowired\r
- private DataSource dataSource;\r
- @Autowired\r
- private ProviderManager authenticationManager;\r
- @Autowired\r
- private IUserService userService;\r
- @Autowired\r
- private IGrantedAuthorityService grantedAuthorityService;\r
- @Autowired\r
- private IGroupService groupService;\r
- @Autowired\r
- private ICollectionService collectionService;\r
- @Autowired\r
- private IFeatureTreeService featureTreeService;\r
- @Autowired\r
- private IFeatureNodeService featureNodeService;\r
- @Autowired\r
- private IVocabularyService vocabularyService;\r
- @Autowired\r
- private ITaxonNodeService taxonNodeService;\r
- @Autowired\r
- private IIdentificationKeyService identificationKeyService;\r
- @Autowired\r
- private IPolytomousKeyService polytomousKeyService;\r
- @Autowired\r
- private IPolytomousKeyNodeService polytomousKeyNodeService;\r
- @Autowired\r
- private PermissionEvaluator permissionEvaluator;\r
-\r
-\r
-// @Autowired\r
- //@Qualifier("mainService")\r
- private IService<CdmBase> mainService;\r
-\r
- @Autowired\r
- private IWorkingSetService workingSetService;\r
-\r
-//********************** CONSTRUCTOR *********************************************************/\r
-\r
- /**\r
- * Constructor\r
- */\r
- protected CdmApplicationDefaultConfiguration() {\r
- }\r
-\r
-// ****************************** APPLICATION CONTEXT *************************************************/\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)\r
- */\r
- public void setApplicationContext(ApplicationContext applicationContext)\r
- throws BeansException {\r
- this.applicationContext = applicationContext;\r
- }\r
-\r
-// ****************************** GETTER *************************************************/\r
-\r
-\r
- public final Object getBean(String name){\r
- return this.applicationContext.getBean(name);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getAgentService()\r
- */\r
- public IAgentService getAgentService() {\r
- return this.agentService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getDatabaseService()\r
- */\r
- public IDatabaseService getDatabaseService() {\r
- return this.databaseService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getNameService()\r
- */\r
- public INameService getNameService() {\r
- return this.nameService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getReferenceService()\r
- */\r
- public IReferenceService getReferenceService() {\r
- return this.referenceService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTaxonService()\r
- */\r
- public ITaxonService getTaxonService() {\r
- return this.taxonService;\r
- }\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getClassificationService()\r
- */\r
- public IClassificationService getClassificationService() {\r
- return this.classificationService;\r
- }\r
-\r
- public ITaxonNodeService getTaxonNodeService(){\r
- return this.taxonNodeService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getDescriptionService()\r
- */\r
- public IDescriptionService getDescriptionService(){\r
- return this.descriptionService;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getOccurrenceService()\r
- */\r
- public IOccurrenceService getOccurrenceService(){\r
- return this.occurrenceService;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getMediaService()\r
- */\r
- public IMediaService getMediaService(){\r
- return this.mediaService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTermService()\r
- */\r
- public ITermService getTermService() {\r
- return this.termService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getCommonService()\r
- */\r
- public ICommonService getCommonService(){\r
- return this.commonService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getLocationService()\r
- */\r
- public ILocationService getLocationService() {\r
- return this.locationService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getUserService()\r
- */\r
- public IUserService getUserService() {\r
- return this.userService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getUserService()\r
- */\r
- public IGrantedAuthorityService getGrantedAuthorityService() {\r
- return this.grantedAuthorityService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getCommonService()\r
- */\r
- public IService<CdmBase> getMainService(){\r
- return this.mainService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTransactionManager()\r
- */\r
- public PlatformTransactionManager getTransactionManager() {\r
- return this.transactionManager;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getAuthenticationManager()\r
- */\r
- public ProviderManager getAuthenticationManager() {\r
- return this.authenticationManager;\r
- }\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#NewConversation()\r
- */\r
- public ConversationHolder NewConversation() {\r
- // TODO make this a prototype\r
- return new ConversationHolder(dataSource, sessionFactory, transactionManager);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getCollectionService()\r
- */\r
- public ICollectionService getCollectionService() {\r
- return collectionService;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getFeatureTreeService()\r
- */\r
- public IFeatureTreeService getFeatureTreeService() {\r
- return featureTreeService;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getFeatureNodeService()\r
- */\r
- public IFeatureNodeService getFeatureNodeService(){\r
- return featureNodeService;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getVocabularyService()\r
- */\r
- public IVocabularyService getVocabularyService() {\r
- return vocabularyService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getIdentificationKeyService()\r
- */\r
- public IIdentificationKeyService getIdentificationKeyService(){\r
- return identificationKeyService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPolytomousKeyService()\r
- */\r
- public IPolytomousKeyService getPolytomousKeyService(){\r
- return polytomousKeyService;\r
- }\r
-\r
- public IPolytomousKeyNodeService getPolytomousKeyNodeService(){\r
- return polytomousKeyNodeService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getWorkingSetService()\r
- */\r
- @Override\r
- public IWorkingSetService getWorkingSetService() {\r
- return workingSetService;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getGroupService()\r
- */\r
- @Override\r
- public IGroupService getGroupService() {\r
- return groupService;\r
- }\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPermissionEvaluator()\r
- */\r
- public PermissionEvaluator getPermissionEvaluator() {\r
- return permissionEvaluator;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()\r
- */\r
- @Override\r
- public TransactionStatus startTransaction() {\r
- return startTransaction(false);\r
- }\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()\r
- */\r
- @Override\r
- public TransactionStatus startTransaction(Boolean readOnly) {\r
-\r
- PlatformTransactionManager txManager = getTransactionManager();\r
-\r
- DefaultTransactionDefinition defaultTxDef = new DefaultTransactionDefinition();\r
- defaultTxDef.setReadOnly(readOnly);\r
- TransactionDefinition txDef = defaultTxDef;\r
-\r
- // Log some transaction-related debug information.\r
- if (logger.isDebugEnabled()) {\r
- logger.debug("Transaction name = " + txDef.getName());\r
- logger.debug("Transaction facets:");\r
- logger.debug("Propagation behavior = " + txDef.getPropagationBehavior());\r
- logger.debug("Isolation level = " + txDef.getIsolationLevel());\r
- logger.debug("Timeout = " + txDef.getTimeout());\r
- logger.debug("Read Only = " + txDef.isReadOnly());\r
- // org.springframework.orm.hibernate3.HibernateTransactionManager\r
- // provides more transaction/session-related debug information.\r
- }\r
-\r
- TransactionStatus txStatus = txManager.getTransaction(txDef);\r
- return txStatus;\r
- }\r
-\r
-\r
- public void commitTransaction(TransactionStatus txStatus){\r
- PlatformTransactionManager txManager = getTransactionManager();\r
- txManager.commit(txStatus);\r
- return;\r
- }\r
-\r
-\r
+ private static final Logger logger = Logger.getLogger(CdmApplicationDefaultConfiguration.class);\r
+\r
+ protected ApplicationContext applicationContext;\r
+\r
+ @Autowired\r
+ //@Qualifier("nameService")\r
+ private INameService nameService;\r
+ @Autowired\r
+ //@Qualifier("taxonService")\r
+ private ITaxonService taxonService;\r
+ @Autowired\r
+ //@Qualifier("classificationService")\r
+ private IClassificationService classificationService;\r
+ @Autowired\r
+ //@Qualifier("referenceService")\r
+ private IReferenceService referenceService;\r
+ @Autowired\r
+ //@Qualifier("agentService")\r
+ private IAgentService agentService;\r
+ @Autowired\r
+ //@Qualifier("databaseService")\r
+ private IDatabaseService databaseService;\r
+ @Autowired\r
+ //@Qualifier("termService")\r
+ private ITermService termService;\r
+ //@Autowired\r
+ private HibernateTransactionManager transactionManager;\r
+ @Autowired\r
+ //@Qualifier("descriptionService")\r
+ private IDescriptionService descriptionService;\r
+ @Autowired\r
+ //@Qualifier("occurrenceService")\r
+ private IOccurrenceService occurrenceService;\r
+ @Autowired\r
+ //@Qualifier("primerService")\r
+ private IPrimerService primerService;\r
+ @Autowired\r
+ //@Qualifier("amplificationService")\r
+ private IAmplificationService amplificationService;\r
+ @Autowired\r
+ //@Qualifier("sequenceService")\r
+ private ISequenceService sequenceService;\r
+ @Autowired\r
+ //@Qualifier("mediaService")\r
+ private IMediaService mediaService;\r
+ @Autowired\r
+ //@Qualifier("commonService")\r
+ private ICommonService commonService;\r
+ @Autowired\r
+ private ILocationService locationService;\r
+ //@Autowired\r
+ private SessionFactory sessionFactory;\r
+ //@Autowired\r
+ private DataSource dataSource;\r
+ @Autowired\r
+ private ProviderManager authenticationManager;\r
+ @Autowired\r
+ private IUserService userService;\r
+ @Autowired\r
+ private IGrantedAuthorityService grantedAuthorityService;\r
+ @Autowired\r
+ private IGroupService groupService;\r
+ @Autowired\r
+ private ICollectionService collectionService;\r
+ @Autowired\r
+ private IFeatureTreeService featureTreeService;\r
+ @Autowired\r
+ private IFeatureNodeService featureNodeService;\r
+ @Autowired\r
+ private IVocabularyService vocabularyService;\r
+ @Autowired\r
+ private ITaxonNodeService taxonNodeService;\r
+ @Autowired\r
+ private IIdentificationKeyService identificationKeyService;\r
+ @Autowired\r
+ private IPolytomousKeyService polytomousKeyService;\r
+ @Autowired\r
+ private IPolytomousKeyNodeService polytomousKeyNodeService;\r
+ @Autowired\r
+ private IEntityValidationService entityValidationService;\r
+ @Autowired\r
+ private IEntityConstraintViolationService entityConstraintViolationService;\r
+ @Autowired\r
+ private ICdmPermissionEvaluator permissionEvaluator;\r
+\r
+ // @Autowired\r
+ //@Qualifier("mainService")\r
+ private IService<CdmBase> mainService;\r
+\r
+ @Autowired\r
+ private IWorkingSetService workingSetService;\r
+\r
+\r
+ //********************** CONSTRUCTOR *********************************************************/\r
+\r
+ /**\r
+ * Constructor\r
+ */\r
+ protected CdmApplicationDefaultConfiguration(){}\r
+\r
+\r
+ // ****************************** APPLICATION CONTEXT *************************************************/\r
+\r
+ @Override\r
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException{\r
+ this.applicationContext = applicationContext;\r
+ }\r
+\r
+ // ****************************** GETTER *************************************************/\r
+\r
+ @Override\r
+ public final Object getBean(String name){\r
+ return this.applicationContext.getBean(name);\r
+ }\r
+\r
+ @Override\r
+ public IAgentService getAgentService(){\r
+ return this.agentService;\r
+ }\r
+\r
+ @Override\r
+ public IDatabaseService getDatabaseService(){\r
+ return this.databaseService;\r
+ }\r
+\r
+\r
+ @Autowired\r
+ public void setDataSource(DataSource dataSource){\r
+ this.dataSource = dataSource;\r
+ }\r
+\r
+ @Override\r
+ public INameService getNameService(){\r
+ return this.nameService;\r
+ }\r
+\r
+ @Override\r
+ public IReferenceService getReferenceService(){\r
+ return this.referenceService;\r
+ }\r
+\r
+ @Autowired\r
+ public void setSessionFactory(SessionFactory sessionFactory){\r
+ this.sessionFactory = sessionFactory;\r
+ }\r
+\r
+ @Override\r
+ public ITaxonService getTaxonService(){\r
+ return this.taxonService;\r
+ }\r
+\r
+ @Override\r
+ public IClassificationService getClassificationService(){\r
+ return this.classificationService;\r
+ }\r
+\r
+ @Override\r
+ public ITaxonNodeService getTaxonNodeService(){\r
+ return this.taxonNodeService;\r
+ }\r
+\r
+ @Override\r
+ public IDescriptionService getDescriptionService(){\r
+ return this.descriptionService;\r
+ }\r
+\r
+ @Override\r
+ public IOccurrenceService getOccurrenceService(){\r
+ return this.occurrenceService;\r
+ }\r
+\r
+ @Override\r
+ public IPrimerService getPrimerService(){\r
+ return this.primerService;\r
+ }\r
+\r
+ @Override\r
+ public IAmplificationService getAmplificationService(){\r
+ return this.amplificationService;\r
+ }\r
+\r
+ @Override\r
+ public ISequenceService getSequenceService(){\r
+ return this.sequenceService;\r
+ }\r
+\r
+ @Override\r
+ public IMediaService getMediaService(){\r
+ return this.mediaService;\r
+ }\r
+\r
+ @Override\r
+ public ITermService getTermService(){\r
+ return this.termService;\r
+ }\r
+\r
+ @Override\r
+ public ICommonService getCommonService(){\r
+ return this.commonService;\r
+ }\r
+\r
+ @Override\r
+ public ILocationService getLocationService(){\r
+ return this.locationService;\r
+ }\r
+\r
+ @Override\r
+ public IUserService getUserService(){\r
+ return this.userService;\r
+ }\r
+\r
+ @Override\r
+ public IGrantedAuthorityService getGrantedAuthorityService(){\r
+ return this.grantedAuthorityService;\r
+ }\r
+\r
+ @Override\r
+ public IService<CdmBase> getMainService(){\r
+ return this.mainService;\r
+ }\r
+\r
+ @Override\r
+ public PlatformTransactionManager getTransactionManager(){\r
+ return this.transactionManager;\r
+ }\r
+\r
+\r
+ @Autowired\r
+ public void setTransactionManager(PlatformTransactionManager transactionManager){\r
+ this.transactionManager = (HibernateTransactionManager) transactionManager;\r
+ }\r
+\r
+ @Override\r
+ public ProviderManager getAuthenticationManager(){\r
+ return this.authenticationManager;\r
+ }\r
+\r
+ @Override\r
+ public ConversationHolder NewConversation(){\r
+ // TODO make this a prototype\r
+ return new ConversationHolder(dataSource, sessionFactory, transactionManager);\r
+ }\r
+\r
+ @Override\r
+ public ICollectionService getCollectionService(){\r
+ return collectionService;\r
+ }\r
+\r
+ @Override\r
+ public IFeatureTreeService getFeatureTreeService(){\r
+ return featureTreeService;\r
+ }\r
+\r
+ @Override\r
+ public IFeatureNodeService getFeatureNodeService(){\r
+ return featureNodeService;\r
+ }\r
+\r
+ @Override\r
+ public IVocabularyService getVocabularyService(){\r
+ return vocabularyService;\r
+ }\r
+\r
+ @Override\r
+ public IIdentificationKeyService getIdentificationKeyService(){\r
+ return identificationKeyService;\r
+ }\r
+\r
+ @Override\r
+ public IPolytomousKeyService getPolytomousKeyService(){\r
+ return polytomousKeyService;\r
+ }\r
+\r
+\r
+ @Override\r
+ public IPolytomousKeyNodeService getPolytomousKeyNodeService(){\r
+ return polytomousKeyNodeService;\r
+ }\r
+\r
+ @Override\r
+ public IWorkingSetService getWorkingSetService(){\r
+ return workingSetService;\r
+ }\r
+\r
+ @Override\r
+ public IGroupService getGroupService(){\r
+ return groupService;\r
+ }\r
+\r
+\r
+ @Override\r
+ public IEntityValidationService getEntityValidationService(){\r
+ return entityValidationService;\r
+ }\r
+\r
+\r
+ @Override\r
+ public IEntityConstraintViolationService getEntityConstraintViolationService(){\r
+ return entityConstraintViolationService;\r
+ }\r
+\r
+ @Override\r
+ public ICdmPermissionEvaluator getPermissionEvaluator(){\r
+ return permissionEvaluator;\r
+ }\r
+\r
+ @Override\r
+ public TransactionStatus startTransaction(){\r
+ return startTransaction(false);\r
+ }\r
+\r
+ @Override\r
+ public TransactionStatus startTransaction(Boolean readOnly){\r
+\r
+ PlatformTransactionManager txManager = getTransactionManager();\r
+\r
+ DefaultTransactionDefinition defaultTxDef = new DefaultTransactionDefinition();\r
+ defaultTxDef.setReadOnly(readOnly);\r
+ TransactionDefinition txDef = defaultTxDef;\r
+\r
+ // Log some transaction-related debug information.\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug("Transaction name = " + txDef.getName());\r
+ logger.debug("Transaction facets:");\r
+ logger.debug("Propagation behavior = " + txDef.getPropagationBehavior());\r
+ logger.debug("Isolation level = " + txDef.getIsolationLevel());\r
+ logger.debug("Timeout = " + txDef.getTimeout());\r
+ logger.debug("Read Only = " + txDef.isReadOnly());\r
+ // org.springframework.orm.hibernate4.HibernateTransactionManager\r
+ // provides more transaction/session-related debug information.\r
+ }\r
+\r
+ TransactionStatus txStatus = txManager.getTransaction(txDef);\r
+ return txStatus;\r
+ }\r
+\r
+\r
+ @Override\r
+ public void commitTransaction(TransactionStatus txStatus){\r
+ PlatformTransactionManager txManager = getTransactionManager();\r
+ txManager.commit(txStatus);\r
+ return;\r
+ }\r
+\r
+ @Override\r
+ public void authenticate(String username, String password){\r
+ UsernamePasswordAuthenticationToken tokenForUser = new UsernamePasswordAuthenticationToken(username, password);\r
+ Authentication authentication = this.getAuthenticationManager().authenticate(tokenForUser);\r
+ SecurityContext context = SecurityContextHolder.getContext();\r
+ context.setAuthentication(authentication);\r
+ }\r
\r
}\r