org.springframework.extensions.jcr.JcrTemplate Java Examples

The following examples show how to use org.springframework.extensions.jcr.JcrTemplate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EcmConfigurationTest.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
public JcrTemplate jcrTemplate() throws Exception {
    JcrTemplate bean = new JcrTemplate();
    bean.setSessionFactory(jcrSessionFactory());
    bean.setAllowCreate(true);
    return bean;
}
 
Example #2
Source File: PageConfigurationTest.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
public JcrTemplate pageJcrTemplate() throws Exception {
    JcrTemplate bean = new JcrTemplate();
    bean.setSessionFactory(pageJcrSessionFactory());
    bean.setAllowCreate(true);
    return bean;
}
 
Example #3
Source File: PurRepositoryTestBase.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void setApplicationContext( ApplicationContext applicationContext ) throws BeansException {
  unifiedRepository = applicationContext.getBean( "unifiedRepository", IUnifiedRepository.class );
  tenantManager = applicationContext.getBean( "tenantMgrProxy", ITenantManager.class );
  userRoleDao = applicationContext.getBean( "userRoleDao", IUserRoleDao.class );
  authorizationPolicy = applicationContext.getBean( "authorizationPolicy", IAuthorizationPolicy.class );
  roleBindingDaoTarget =
      (IRoleAuthorizationPolicyRoleBindingDao) applicationContext
          .getBean( "roleAuthorizationPolicyRoleBindingDaoTarget" );

  SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean( "jcrSessionFactory" );
  testJcrTemplate = new JcrTemplate( jcrSessionFactory );
  testJcrTemplate.setAllowCreate( true );
  testJcrTemplate.setExposeNativeSession( true );
  txnTemplate = applicationContext.getBean( "jcrTransactionTemplate", TransactionTemplate.class );
  repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean( "repositoryFileDao" );

  superAdminRole = applicationContext.getBean( "superAdminAuthorityName", String.class );
  repositoryAdmin = applicationContext.getBean( "repositoryAdminUsername", String.class );
  systemAdmin = (String) applicationContext.getBean( "superAdminUserName" );
  tenantAdminRole = applicationContext.getBean( "singleTenantAdminAuthorityName", String.class );
  tenantAuthenticatedRole = applicationContext.getBean( "singleTenantAuthenticatedAuthorityName", String.class );

  TestPrincipalProvider.userRoleDao = userRoleDao;
  TestPrincipalProvider.adminCredentialsStrategy =
      (CredentialsStrategy) applicationContext.getBean( "jcrAdminCredentialsStrategy" );
  TestPrincipalProvider.repository = (Repository) applicationContext.getBean( "jcrRepository" );

  doSetApplicationContext( applicationContext );
}
 
Example #4
Source File: PurRepositoryIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void setApplicationContext( final ApplicationContext applicationContext ) throws BeansException {
  SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean( "jcrSessionFactory" );
  testJcrTemplate = new JcrTemplate( jcrSessionFactory );
  testJcrTemplate.setAllowCreate( true );
  testJcrTemplate.setExposeNativeSession( true );
  repositoryAdminUsername = (String) applicationContext.getBean( "repositoryAdminUsername" );
  superAdminRoleName = (String) applicationContext.getBean( "superAdminAuthorityName" );
  sysAdminUserName = (String) applicationContext.getBean( "superAdminUserName" );
  tenantAuthenticatedRoleName = (String) applicationContext.getBean( "singleTenantAuthenticatedAuthorityName" );
  singleTenantAdminRoleName = (String) applicationContext.getBean( "singleTenantAdminAuthorityName" );
  tenantManager = (ITenantManager) applicationContext.getBean( "tenantMgrProxy" );
  roleBindingDaoTarget =
      (IRoleAuthorizationPolicyRoleBindingDao) applicationContext
          .getBean( "roleAuthorizationPolicyRoleBindingDaoTarget" );
  authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean( "authorizationPolicy" );
  repo = (IUnifiedRepository) applicationContext.getBean( "unifiedRepository" );
  userRoleDao = (IUserRoleDao) applicationContext.getBean( "userRoleDao" );
  repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean( "repositoryFileDao" );
  testUserRoleDao = userRoleDao;
  repositoryLifecyleManager =
      (IBackingRepositoryLifecycleManager) applicationContext.getBean( "defaultBackingRepositoryLifecycleManager" );
  txnTemplate = (TransactionTemplate) applicationContext.getBean( "jcrTransactionTemplate" );
  TestPrincipalProvider.userRoleDao = testUserRoleDao;
  TestPrincipalProvider.adminCredentialsStrategy =
      (CredentialsStrategy) applicationContext.getBean( "jcrAdminCredentialsStrategy" );
  TestPrincipalProvider.repository = (Repository) applicationContext.getBean( "jcrRepository" );
}
 
Example #5
Source File: UIEERepositoryDirectoryIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void setApplicationContext( final ApplicationContext applicationContext ) throws BeansException {
  SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean( "jcrSessionFactory" );
  testJcrTemplate = new JcrTemplate( jcrSessionFactory );
  testJcrTemplate.setAllowCreate( true );
  testJcrTemplate.setExposeNativeSession( true );
  repositoryAdminUsername = (String) applicationContext.getBean( "repositoryAdminUsername" );
  superAdminRoleName = (String) applicationContext.getBean( "superAdminAuthorityName" );
  sysAdminUserName = (String) applicationContext.getBean( "superAdminUserName" );
  tenantAuthenticatedRoleName = (String) applicationContext.getBean( "singleTenantAuthenticatedAuthorityName" );
  singleTenantAdminRoleName = (String) applicationContext.getBean( "singleTenantAdminAuthorityName" );
  tenantManager = (ITenantManager) applicationContext.getBean( "tenantMgrProxy" );
  roleBindingDaoTarget =
      (IRoleAuthorizationPolicyRoleBindingDao) applicationContext
          .getBean( "roleAuthorizationPolicyRoleBindingDaoTarget" );
  authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean( "authorizationPolicy" );
  repo = (IUnifiedRepository) applicationContext.getBean( "unifiedRepository" );
  userRoleDao = (IUserRoleDao) applicationContext.getBean( "userRoleDao" );
  repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean( "repositoryFileDao" );
  testUserRoleDao = userRoleDao;
  repositoryLifecyleManager =
      (IBackingRepositoryLifecycleManager) applicationContext.getBean( "defaultBackingRepositoryLifecycleManager" );
  txnTemplate = (TransactionTemplate) applicationContext.getBean( "jcrTransactionTemplate" );
  TestPrincipalProvider.userRoleDao = testUserRoleDao;
  TestPrincipalProvider.adminCredentialsStrategy =
      (CredentialsStrategy) applicationContext.getBean( "jcrAdminCredentialsStrategy" );
  TestPrincipalProvider.repository = (Repository) applicationContext.getBean( "jcrRepository" );
}
 
Example #6
Source File: StorageUpdater.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public void afterPropertiesSet() throws Exception {
	jcrTemplate = new JcrTemplate(sessionFactory);
	executeUpdates();
}
 
Example #7
Source File: StorageUpdate.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
protected JcrTemplate getTemplate() {
	return jcrTemplate;
}
 
Example #8
Source File: StorageUpdate.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
void setTemplate(final JcrTemplate jcrTemplate) {
	this.jcrTemplate = jcrTemplate;
}
 
Example #9
Source File: JcrDaoSupport.java    From mycollab with GNU Affero General Public License v3.0 2 votes vote down vote up
/**
 * Set the JCR SessionFactory to be used by this DAO. Will automatically
 * create a JcrTemplate for the given SessionFactory.
 * 
 * @param sessionFactory
    * @see #setTemplate
 */
public final void setSessionFactory(SessionFactory sessionFactory) {
	this.template = new JcrTemplate(sessionFactory);
}
 
Example #10
Source File: JcrDaoSupport.java    From mycollab with GNU Affero General Public License v3.0 2 votes vote down vote up
/**
 * Set the JcrTemplate for this DAO explicitly, as an alternative to
 * specifying a SessionFactory.
 * 
 * @param jcrTemplate
    * @see #setSessionFactory
 */
public final void setTemplate(JcrTemplate jcrTemplate) {
	this.template = jcrTemplate;
}
 
Example #11
Source File: JcrDaoSupport.java    From mycollab with GNU Affero General Public License v3.0 2 votes vote down vote up
/**
 * Return the JcrTemplate for this DAO, pre-initialized with the
 * SessionFactory or set explicitly.
    * @return
    */
public final JcrTemplate getTemplate() {
	return template;
}