当前位置: 首页>>代码示例>>Java>>正文


Java FilterClauseSearchCriteria类代码示例

本文整理汇总了Java中gov.nih.nci.security.dao.FilterClauseSearchCriteria的典型用法代码示例。如果您正苦于以下问题:Java FilterClauseSearchCriteria类的具体用法?Java FilterClauseSearchCriteria怎么用?Java FilterClauseSearchCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FilterClauseSearchCriteria类属于gov.nih.nci.security.dao包,在下文中一共展示了FilterClauseSearchCriteria类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFiltersForGroups

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
/**
 * This method injects the security filters which are created for this application. It retrieves a list of all the filters which have 
 * been defined for this application from the CSM Database. Now for each filter in the list, it creates a new FilterDefinition object.
 * It then retrieves the Persistent Class from the passed Configuration Object using the class name for which the filter is defined.
 * It then adds the filter to the persistent class by setting the filtering query.
 * @param authorizationManager The CSM AuthorizationManager instance for this application
 * @param configuration The Hibernate Configuration initialized for this application
 * 
 */
public static void addFiltersForGroups(AuthorizationManager authorizationManager,Configuration configuration)
{
	boolean needsOptimisation = false;
	Properties props = configuration.getProperties();
	
	if(!isExistActiveMappingElement(authorizationManager))
		needsOptimisation = isMySQLDatabase(props,true);
	
	FilterClause searchFilterClause = new FilterClause();
	searchFilterClause.setClassName("*");
	SearchCriteria searchCriteria = new FilterClauseSearchCriteria(searchFilterClause);
	List list = authorizationManager.getObjects(searchCriteria);
	Iterator iterator = list.iterator();
	while (iterator.hasNext())
	{
		HashMap parameters = new HashMap();
		parameters.put("GROUP_NAMES", new StringType());
		parameters.put("APPLICATION_ID", new LongType());

		FilterClause filterClause = (FilterClause)iterator.next();
		FilterDefinition filterDefinition = new FilterDefinition (
				filterClause.getClassName().substring(filterClause.getClassName().lastIndexOf('.') + 1) + filterClause.getId(), "", parameters);
		configuration.addFilterDefinition(filterDefinition);
		PersistentClass persistentClass = configuration.getClassMapping(filterClause.getClassName());
		persistentClass.addFilter(
				filterClause.getClassName().substring(filterClause.getClassName().lastIndexOf('.') + 1) + filterClause.getId()
				, optimiseFilterQuery(needsOptimisation,filterClause.getGeneratedSQLForGroup()));
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:39,代码来源:InstanceLevelSecurityHelper.java

示例2: getFiltersForGroups

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
/**
 * This method injects the security filters which are created for this application. It retrieves a list of all the filters which have 
 * been defined for this application from the CSM Database. Now for each filter in the list, it creates a new FilterDefinition object.
 * 
 * @param authorizationManager The CSM AuthorizationManager instance for this application
 * @param List<FilterDefinition> The Hibernate FilterDefinition List.
 */
public static List<FilterDefinition> getFiltersForGroups(AuthorizationManager authorizationManager) throws CSException
{
	Properties props = new Properties();
	ApplicationContext ac = authorizationManager.getApplicationContext();
	props.setProperty("hibernate.connection.url", ac.getDatabaseURL());
	props.setProperty("hibernate.connection.username", ac.getDatabaseUserName());
	props.setProperty("hibernate.connection.password", ac.getDatabasePassword());
	props.setProperty("hibernate.connection.driver", ac.getDatabaseDriver());
	props.setProperty("hibernate.dialect", ac.getDatabaseDialect());
	

	boolean needsOptimisation = false;
	if(!isExistActiveMappingElement(authorizationManager))
		needsOptimisation = isMySQLDatabase(props,false);
	

	List<FilterDefinition> filterDefinitionList = new ArrayList<FilterDefinition>();
	FilterClause searchFilterClause = new FilterClause();
	searchFilterClause.setClassName("*");
	SearchCriteria searchCriteria = new FilterClauseSearchCriteria(searchFilterClause);
	List list = authorizationManager.getObjects(searchCriteria);
	Iterator iterator = list.iterator();
	while (iterator.hasNext())
	{
		HashMap parameters = new HashMap();
		parameters.put("GROUP_NAMES", new StringType());
		parameters.put("APPLICATION_ID", new LongType());

		FilterClause filterClause = (FilterClause)iterator.next();
		FilterDefinition filterDefinition = new FilterDefinition (
				filterClause.getClassName().substring(
						filterClause.getClassName().lastIndexOf('.') + 1) + filterClause.getId(),
						optimiseFilterQuery(needsOptimisation,filterClause.getGeneratedSQLForGroup()), 
						parameters);
		if(filterDefinition!=null) filterDefinitionList.add(filterDefinition);
	}
	return filterDefinitionList;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:46,代码来源:InstanceLevelSecurityHelper.java

示例3: addFilters

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
/**
 * This method injects the security filters which are created for this application. It retrieves a list of all the filters which have 
 * been defined for this application from the CSM Database. Now for each filter in the list, it creates a new FilterDefinition object.
 * It then retrieves the Persistent Class from the passed Configuration Object using the class name for which the filter is defined.
 * It then adds the filter to the persistent class by setting the filtering query.
 * @param authorizationManager The CSM AuthorizationManager instance for this application
 * @param configuration The Hibernate Configuration initialized for this application
 */
public static void addFilters(AuthorizationManager authorizationManager,Configuration configuration)
{
	boolean needsOptimisation = false;
	Properties props = configuration.getProperties();
	
	if(!isExistActiveMappingElement(authorizationManager))
		needsOptimisation = isMySQLDatabase(props,true);
	
	
	FilterClause searchFilterClause = new FilterClause();
	searchFilterClause.setClassName("*");
	SearchCriteria searchCriteria = new FilterClauseSearchCriteria(searchFilterClause);
	List list = authorizationManager.getObjects(searchCriteria);
	Iterator iterator = list.iterator();
	while (iterator.hasNext())
	{
		HashMap parameters = new HashMap();
		parameters.put("USER_NAME", new StringType());
		parameters.put("APPLICATION_ID", new LongType());

		FilterClause filterClause = (FilterClause)iterator.next();
		FilterDefinition filterDefinition = new FilterDefinition (filterClause.getClassName().substring(filterClause.getClassName().lastIndexOf('.') + 1) + filterClause.getId(), "", parameters);
		configuration.addFilterDefinition(filterDefinition);
		PersistentClass persistentClass = configuration.getClassMapping(filterClause.getClassName());
		persistentClass.addFilter(
				filterClause.getClassName().substring(filterClause.getClassName().lastIndexOf('.') + 1) + filterClause.getId()
				,optimiseFilterQuery(needsOptimisation,filterClause.getGeneratedSQLForUser()));
	}
	
	
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:40,代码来源:InstanceLevelSecurityHelper.java

示例4: getFiltersForUser

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
/**
 * This method injects the security filters which are created for this application. It retrieves a list of all the filters which have 
 * been defined for this application from the CSM Database. Now for each filter in the list, it creates a new FilterDefinition object.
 * 
 * 
 * @param authorizationManager The CSM AuthorizationManager instance for this application
 * @param List<FilterDefinition> The Hibernate FilterDefinition List.
 */
public static List<FilterDefinition> getFiltersForUser(AuthorizationManager authorizationManager) throws CSException
{
	Properties props = new Properties();
	ApplicationContext ac = authorizationManager.getApplicationContext();
	props.setProperty("hibernate.connection.url", ac.getDatabaseURL());
	props.setProperty("hibernate.connection.username", ac.getDatabaseUserName());
	props.setProperty("hibernate.connection.password", ac.getDatabasePassword());
	props.setProperty("hibernate.connection.driver", ac.getDatabaseDriver());
	props.setProperty("hibernate.dialect", ac.getDatabaseDialect());
	

	boolean needsOptimisation = false;
	if(!isExistActiveMappingElement(authorizationManager))		
		needsOptimisation = isMySQLDatabase(props,false);
	
	List<FilterDefinition> filterDefinitionList = new ArrayList<FilterDefinition>();
	
	FilterClause searchFilterClause = new FilterClause();
	searchFilterClause.setClassName("*");
	SearchCriteria searchCriteria = new FilterClauseSearchCriteria(searchFilterClause);
	List list = authorizationManager.getObjects(searchCriteria);
	Iterator iterator = list.iterator();
	while (iterator.hasNext())
	{
		HashMap parameters = new HashMap();
		parameters.put("USER_NAME", new StringType());
		parameters.put("APPLICATION_ID", new LongType());

		FilterClause filterClause = (FilterClause)iterator.next();
		FilterDefinition filterDefinition = new FilterDefinition (
				filterClause.getClassName().substring(filterClause.getClassName().lastIndexOf('.') + 1) + filterClause.getId(),  
				optimiseFilterQuery(needsOptimisation,filterClause.getGeneratedSQLForUser()),
				parameters);
		if(filterDefinition!=null) filterDefinitionList.add(filterDefinition);
	}
	return filterDefinitionList;
	
	
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:48,代码来源:InstanceLevelSecurityHelper.java

示例5: FilterClause

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
/**
 * Retrieve all CSM FilterClause from DB
 * @param authorizationManager
 * @return FilterClauses found
 */
@SuppressWarnings("unchecked")
private static List<FilterClause>retriveAllCsmFilterClause (AuthorizationManager authorizationManager )
{
	List<FilterClause> rtnList=null;
	// Inject CSM defined Filters
	FilterClause searchFilterClause = new FilterClause();
	searchFilterClause.setClassName("*");
	SearchCriteria searchCriteria = new FilterClauseSearchCriteria(searchFilterClause);
	rtnList = (List<FilterClause>)authorizationManager.getObjects(searchCriteria);
	return rtnList;
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:17,代码来源:InstanceLevelSecurityHelper.java

示例6: testGetObjects

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
private void testGetObjects() throws Exception {
	FilterClause searchClause = new FilterClause();	
	SearchCriteria searchCriteria = new FilterClauseSearchCriteria(searchClause);
	List list = authorizationManager.getObjects(searchCriteria);
	System.out.println("InstanceLevelSecurityTest.testGetObjects()...result size:"+list.size());
	for(Object obj : list)
	{
		try {
			printObject(obj, false);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:15,代码来源:InstanceLevelSecurityTest.java

示例7: searchObjects

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
public SearchResult searchObjects(UserProvisioningManager userProvisioningManager) throws Exception
{
	FilterClause filterClause = new FilterClause();
	if (this.className != null && !(this.className.trim().equalsIgnoreCase("")))
		filterClause.setClassName(this.className);

	SearchCriteria searchCriteria = new FilterClauseSearchCriteria(filterClause);
	List list = userProvisioningManager.getObjects(searchCriteria);
	SearchResult searchResult = new SearchResult();
	searchResult.setSearchResultMessage(searchCriteria.getMessage());
	searchResult.setSearchResultObjects(list);
	return searchResult;
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:14,代码来源:InstanceLevelForm.java

示例8: testFilters

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
@Test
public void testFilters() {
    final Transaction tx = this.hibernateHelper.beginTransaction();
    final FilterClause searchFilterClause = new FilterClause();
    searchFilterClause.setClassName("*");
    final SearchCriteria searchCriteria = new FilterClauseSearchCriteria(searchFilterClause);
    final List<?> list = SecurityUtils.getAuthorizationManager().getObjects(searchCriteria);
    assertTrue(list.size() > 0);
    tx.commit();
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:11,代码来源:ProjectDaoTest.java

示例9: testUnSecured

import gov.nih.nci.security.dao.FilterClauseSearchCriteria; //导入依赖的package包/类
private void testUnSecured(){
	SessionFactory sf=null;
	Configuration configuration = null;
	if(null == sf || sf.isClosed()){
		configuration = new Configuration().configure(hibernateCfgFileName);
		sf = configuration.buildSessionFactory();
	}
	
	Session session = null;
	session = sf.openSession();
	session = HibernateSessionFactoryHelper.getAuditSession(sf);
	FilterClause searchClause = new FilterClause();
	SearchCriteria searchCriteria = new FilterClauseSearchCriteria(searchClause);
	Criteria criteria = session.createCriteria(searchCriteria.getObjectType());
	Hashtable fieldValues = searchCriteria.getFieldAndValues();
	Enumeration enKeys= fieldValues.keys();
	while (enKeys.hasMoreElements()) {
		String fieldKey = (String) enKeys.nextElement();
		String fieldValue = (String) fieldValues.get(fieldKey);
			String fieldValue_ = StringUtilities.replaceInString(
					fieldValue.trim(), "*", "%");
			int i = fieldValue_.indexOf("%");
			if (i != -1) {
				criteria.add(Restrictions.like(fieldKey, fieldValue_));
			} else {
				criteria.add(Restrictions.eq(fieldKey, fieldValue_));
			}
	}
	if (fieldValues.size() == 0) {
		criteria.add(Restrictions.eqProperty("1", "1"));
	}	
	criteria =session.createCriteria(gov.nih.nci.cacoresdk.domain.manytomany.bidirectional.Employee.class);
	List list = criteria.list();
	System.out.println("============= UNSECURED SYSTEM ==================");
	System.out.println("Total no of FilterClause on which user has access= "+list.size());
	System.out.println("------------------------------------------------------");
	session.close();
	sf.close();
	for(Object obj : list)
	{
		try {
			printObject(obj, false);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	assertEquals("Incorrect number of FilterClause retrieved",list.size(), 1); // Expecting all cards in the deck including the joker.
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:49,代码来源:InstanceLevelSecurityTest.java


注:本文中的gov.nih.nci.security.dao.FilterClauseSearchCriteria类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。