org.hibernate.criterion.Property Java Examples

The following examples show how to use org.hibernate.criterion.Property. 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: K8sApiStatusDaoImpl.java    From kardio with Apache License 2.0 6 votes vote down vote up
@Override
public long getCurrentNumberOfApis(int envId,String componentIdsStrg) throws ParseException {
	
	List<Integer> comIdList = DaoUtil.convertCSVToList(componentIdsStrg);
	
	Session session = sessionFactory.openSession();
	DetachedCriteria subMaxDate = DetachedCriteria.forClass(K8sApiStatusEntity.class);
	subMaxDate.setProjection(Projections.max("statusDate"));
	Criteria crtCurrenrApi = session.createCriteria(K8sApiStatusEntity.class);
	crtCurrenrApi.add(Property.forName("statusDate").eq(subMaxDate));
	DaoUtil.addEnvironmentToCriteria(envId, comIdList, crtCurrenrApi);
	crtCurrenrApi.setProjection(Projections.sum("totalApi"));
	long currentNumberOfApi = (long) (crtCurrenrApi.uniqueResult() == null ? (long)0 : crtCurrenrApi.uniqueResult());
	session.close();
	return currentNumberOfApi;
}
 
Example #2
Source File: ComponentTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testComponentFormulaQuery() {
	Session s = openSession();
	Transaction t = s.beginTransaction();
	s.createQuery("from User u where u.person.yob = 1999").list();
	s.createCriteria(User.class)
		.add( Property.forName("person.yob").between( new Integer(1999), new Integer(2002) ) )
		.list();
	if ( getDialect().supportsRowValueConstructorSyntax() ) {
		s.createQuery("from User u where u.person = ('gavin', :dob, 'Peachtree Rd', 'Karbarook Ave', 1974, 'Peachtree Rd')")
			.setDate("dob", new Date("March 25, 1974")).list();
		s.createQuery("from User where person = ('gavin', :dob, 'Peachtree Rd', 'Karbarook Ave', 1974, 'Peachtree Rd')")
			.setDate("dob", new Date("March 25, 1974")).list();
	}
	t.commit();
	s.close();
}
 
Example #3
Source File: ComponentTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
	super.afterConfigurationBuilt( mappings, dialect );
	// Oracle and Postgres do not have year() functions, so we need to
	// redefine the 'User.person.yob' formula
	//
	// consider temporary until we add the capability to define
	// mapping foprmulas which can use dialect-registered functions...
	PersistentClass user = mappings.getClass( User.class.getName() );
	org.hibernate.mapping.Property personProperty = user.getProperty( "person" );
	Component component = ( Component ) personProperty.getValue();
	Formula f = ( Formula ) component.getProperty( "yob" ).getValue().getColumnIterator().next();

	SQLFunction yearFunction = ( SQLFunction ) dialect.getFunctions().get( "year" );
	if ( yearFunction == null ) {
		// the dialect not know to support a year() function, so rely on the
		// ANSI SQL extract function
		f.setFormula( "extract( year from dob )");
	}
	else {
		List args = new ArrayList();
		args.add( "dob" );
		f.setFormula( yearFunction.render( args, null ) );
	}
}
 
Example #4
Source File: InterroleController.java    From jeecg with Apache License 2.0 6 votes vote down vote up
/**
 * 获取 除当前 角色之外的用户信息列表
 * 
 * @param request
 *            request
 * @return 处理结果信息
 */
@RequestMapping(params = "addUserToRoleList")
public void addUserToOrgList(TSUser user, HttpServletRequest request, HttpServletResponse response,
		DataGrid dataGrid) {
	String roleId = request.getParameter("roleId");

	CriteriaQuery cq = new CriteriaQuery(TSUser.class, dataGrid);
	org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, user);

	// 获取 当前组织机构的用户信息
	CriteriaQuery subCq = new CriteriaQuery(InterroleUserEntity.class);
	subCq.setProjection(Property.forName("TSUser.id"));
	subCq.eq("interroleEntity.id", roleId);
	subCq.add();
	cq.eq("userType", "2");
	cq.add(Property.forName("id").notIn(subCq.getDetachedCriteria()));
	cq.add();

	this.systemService.getDataGridReturn(cq, true);
	TagUtil.datagrid(response, dataGrid);
}
 
Example #5
Source File: OrganzationController.java    From jeecg with Apache License 2.0 6 votes vote down vote up
/**
 * 获取 除当前 组织之外的用户信息列表
 * @param request request
 * @return 处理结果信息
 */
@RequestMapping(params = "addUserToOrgList")
public void addUserToOrgList(TSUser user, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
    String orgId = request.getParameter("orgId");

    CriteriaQuery cq = new CriteriaQuery(TSUser.class, dataGrid);
    org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, user);

    // 获取 当前组织机构的用户信息
    CriteriaQuery subCq = new CriteriaQuery(TSUserOrg.class);
    subCq.setProjection(Property.forName("tsUser.id"));
    subCq.eq("tsDepart.id", orgId);
    subCq.add();

    cq.add(Property.forName("id").notIn(subCq.getDetachedCriteria()));
    cq.add();

    this.systemService.getDataGridReturn(cq, true);
    TagUtil.datagrid(response, dataGrid);
}
 
Example #6
Source File: DepartController.java    From jeecg with Apache License 2.0 6 votes vote down vote up
/**
 * 获取 除当前 组织之外的用户信息列表
 * @param request request
 * @return 处理结果信息
 */
@RequestMapping(params = "addUserToOrgList")
public void addUserToOrgList(TSUser user, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
    String orgId = request.getParameter("orgId");

    CriteriaQuery cq = new CriteriaQuery(TSUser.class, dataGrid);
    org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, user);

    // 获取 当前组织机构的用户信息
    CriteriaQuery subCq = new CriteriaQuery(TSUserOrg.class);
    subCq.setProjection(Property.forName("tsUser.id"));
    subCq.eq("tsDepart.id", orgId);
    subCq.add();

    cq.add(Property.forName("id").notIn(subCq.getDetachedCriteria()));

    cq.eq("deleteFlag", Globals.Delete_Normal);//删除状态,不删除
    cq.eq("userType",Globals.USER_TYPE_SYSTEM);//系统用户

    cq.add();

    this.systemService.getDataGridReturn(cq, true);
    TagUtil.datagrid(response, dataGrid);
}
 
Example #7
Source File: RoleController.java    From jeecg with Apache License 2.0 6 votes vote down vote up
/**
 * 获取 除当前 角色之外的用户信息列表
 * @param request request
 * @return 处理结果信息
 */
@RequestMapping(params = "addUserToRoleList")
public void addUserToOrgList(TSUser user, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
    String roleId = request.getParameter("roleId");

    CriteriaQuery cq = new CriteriaQuery(TSUser.class, dataGrid);
    org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, user);

    // 获取 当前组织机构的用户信息
    CriteriaQuery subCq = new CriteriaQuery(TSRoleUser.class);
    subCq.setProjection(Property.forName("TSUser.id"));
    subCq.eq("TSRole.id", roleId);
    subCq.add();
    
    cq.add(Property.forName("id").notIn(subCq.getDetachedCriteria()));

    cq.eq("deleteFlag", Globals.Delete_Normal);//删除状态,不删除
    cq.eq("userType",Globals.USER_TYPE_SYSTEM);//系统用户

    cq.add();

    this.systemService.getDataGridReturn(cq, true);
    TagUtil.datagrid(response, dataGrid);
}
 
Example #8
Source File: KpiDAOImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
private SbiKpiExecutionFilter from(SchedulerFilter schedulerFilter, SbiKpiExecutionFilter sbiFilter, Session session) {
    Integer placeholderId = null;
    if (schedulerFilter.getPlaceholderId() != null) {
        placeholderId = schedulerFilter.getPlaceholderId();
    } else if (schedulerFilter.getPlaceholderName() != null) {
        placeholderId = (Integer) session.createCriteria(SbiKpiPlaceholder.class).add(Restrictions.eq("name", schedulerFilter.getPlaceholderName()))
                .setProjection(Property.forName("id")).uniqueResult();
    }
    if (sbiFilter == null) {
        sbiFilter = new SbiKpiExecutionFilter();
        SbiKpiExecutionFilterId id = new SbiKpiExecutionFilterId(placeholderId, schedulerFilter.getExecutionId(), schedulerFilter.getKpiId(),
                schedulerFilter.getKpiVersion());
        sbiFilter.setSbiKpiExecutionFilterId(id);
        updateSbiCommonInfo4Insert(sbiFilter);
    } else {
        updateSbiCommonInfo4Update(sbiFilter);
    }
    sbiFilter.setValue(schedulerFilter.getValue());
    sbiFilter.setTypeId(schedulerFilter.getType().getValueId());
    return sbiFilter;
}
 
Example #9
Source File: KpiDAOImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public List<String> listPlaceholderByMeasures(final List<String> measures) {
    List<SbiKpiPlaceholder> lst = list(new ICriterion<SbiKpiPlaceholder>() {
        @Override
        public Criteria evaluate(Session session) {
            DetachedCriteria detachedCriteria = DetachedCriteria.forClass(SbiKpiRuleOutput.class).createAlias("sbiKpiRule", "sbiKpiRule")
                    .createAlias("sbiKpiAlias", "sbiKpiAlias").setProjection(Property.forName("sbiKpiRule.sbiKpiRuleId.id"))
                    .add(Restrictions.eq("sbiKpiRule.active", 'T')).add(Restrictions.in("sbiKpiAlias.name", measures));

            Criteria c = session.createCriteria(SbiKpiRule.class).createAlias("sbiKpiPlaceholders", "sbiKpiPlaceholders")
                    .add(Property.forName("sbiKpiRuleId.id").in(detachedCriteria)).add(Restrictions.eq("active", 'T'))
                    .setProjection(Projections.distinct(Projections.property("sbiKpiPlaceholders.name").as("name")))
                    .setResultTransformer(Transformers.aliasToBean(SbiKpiPlaceholder.class));
            return c;
        }
    });
    List<String> placeholdername = new ArrayList<>();
    for (SbiKpiPlaceholder sbiKpiPlaceholder : lst) {
        placeholdername.add(sbiKpiPlaceholder.getName());
    }
    return placeholdername;
}
 
Example #10
Source File: ApiStatusDaoImpl.java    From kardio with Apache License 2.0 6 votes vote down vote up
@Override
public long getCurrentNumberOfApis(int envId,String componentIdsStrg) throws ParseException {
	
	List<Integer> comIdList = DaoUtil.convertCSVToList(componentIdsStrg);
	
	Session session = sessionFactory.openSession();
	DetachedCriteria subMaxDate = DetachedCriteria.forClass(ApiStatusEntity.class);
	subMaxDate.setProjection(Projections.max("statusDate"));
	Criteria crtCurrenrApi = session.createCriteria(ApiStatusEntity.class);
	crtCurrenrApi.add(Property.forName("statusDate").eq(subMaxDate));
	DaoUtil.addEnvironmentToCriteria(envId, comIdList, crtCurrenrApi);
	crtCurrenrApi.setProjection(Projections.sum("totalApi"));
	long currentNumberOfApi = (long) (crtCurrenrApi.uniqueResult() == null ? (long)0 : crtCurrenrApi.uniqueResult());
	session.close();
	return currentNumberOfApi;
}
 
Example #11
Source File: HibernateSystemUnderTestDao.java    From livingdoc-confluence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public SystemUnderTest getByName(String projectName, String sutName) {
    final Criteria crit = sessionService.getSession().createCriteria(SystemUnderTest.class);
    crit.add(Property.forName(NAME).eq(sutName));
    crit.createAlias("project", "p");
    crit.add(Restrictions.eq("p.name", projectName));
    SystemUnderTest systemUnderTest = ( SystemUnderTest ) crit.uniqueResult();
    HibernateLazyInitializer.init(systemUnderTest);
    return systemUnderTest;
}
 
Example #12
Source File: QuarzSchedulerDAOImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public List<String> listTriggerPausedByGroup(final String triggerGroup, final String jobGroup) {
	return executeOnTransaction(new IExecuteOnTransaction<List<String>>() {
		@Override
		public List<String> execute(Session session) throws Exception {
			List<String> suspendedTriggers = session.createCriteria(SbiTriggerPaused.class).add(Restrictions.eq("triggerGroup", triggerGroup))
					.add(Restrictions.eq("jobGroup", jobGroup)).setProjection(Property.forName("triggerName")).list();
			return suspendedTriggers;
		}
	});
}
 
Example #13
Source File: HibernateSystemUnderTestDao.java    From livingdoc-confluence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Runner getRunnerByName(String name) {
    final Criteria crit = sessionService.getSession().createCriteria(Runner.class);
    crit.add(Property.forName(NAME).eq(name));
    Runner runner = ( Runner ) crit.uniqueResult();
    HibernateLazyInitializer.init(runner);
    return runner;
}
 
Example #14
Source File: HibernateSystemInfoDao.java    From livingdoc-confluence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public SystemInfo getSystemInfo() {
    final Criteria crit = sessionService.getSession().createCriteria(SystemInfo.class);
    crit.add(Property.forName("id").eq(SYSTEM_INFO));
    SystemInfo systemInfo = ( SystemInfo ) crit.uniqueResult();
    // crit.addOrder(Order.desc("id"));
    // List list = crit.list();
    // SystemInfo systemInfo = null;
    // if (list.size() > 0) {
    // systemInfo = (SystemInfo) list.get(0);
    // }
    HibernateLazyInitializer.init(systemInfo);
    return systemInfo;
}
 
Example #15
Source File: HibernateRepositoryDao.java    From livingdoc-confluence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public RepositoryType getTypeByName(String repositoryTypeName) {
    final Criteria crit = sessionService.getSession().createCriteria(RepositoryType.class);
    crit.add(Property.forName("name").eq(repositoryTypeName));
    RepositoryType repositoryType = ( RepositoryType ) crit.uniqueResult();
    HibernateLazyInitializer.init(repositoryType);
    return repositoryType;
}
 
Example #16
Source File: HibernateRepositoryDao.java    From livingdoc-confluence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Repository getByName(String projectName, String repositoryName) {
    final Criteria crit = sessionService.getSession().createCriteria(Repository.class);
    crit.add(Property.forName("name").eq(repositoryName));
    crit.createAlias("project", "p");
    crit.add(Restrictions.eq("p.name", projectName));
    Repository repository = ( Repository ) crit.uniqueResult();
    HibernateLazyInitializer.init(repository);
    return repository;
}
 
Example #17
Source File: HibernateRepositoryDao.java    From livingdoc-confluence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Repository getByUID(String repositoryUid) {
    final Criteria crit = sessionService.getSession().createCriteria(Repository.class);
    crit.add(Property.forName("uid").eq(repositoryUid));
    Repository repository = ( Repository ) crit.uniqueResult();
    HibernateLazyInitializer.init(repository);
    return repository;
}
 
Example #18
Source File: HibernateProjectDao.java    From livingdoc-confluence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Project getByName(String name) {
    final Criteria crit = sessionService.getSession().createCriteria(Project.class);
    crit.add(Property.forName("name").eq(name));
    Project project = ( Project ) crit.uniqueResult();
    HibernateLazyInitializer.init(project);
    return project;
}
 
Example #19
Source File: DaoUtil.java    From kardio with Apache License 2.0 5 votes vote down vote up
public static void addEnvironmentToCriteria(int envId, List<Integer> compIds, Criteria criteria) {
	criteria.createCriteria("environment", "environment");
	if(envId != 0){
		criteria.add(Restrictions.eq("environment.environmentId", envId));
	}
	criteria.add(Restrictions.eq("environment.envLock", 0));
	if(compIds.size() > 0){
		criteria.add(Property.forName("component.componentId").in(compIds));
	}
}
 
Example #20
Source File: UnionSubclassTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testQuerySubclassAttribute() {
	if ( getDialect() instanceof HSQLDialect ) {
		return; // TODO : why??
	}
	
	Session s = openSession();
	Transaction t = s.beginTransaction();
	Person p = new Person();
	p.setName("Emmanuel");
	p.setSex('M');
	s.persist(p);
	Employee q = new Employee();
	q.setName("Steve");
	q.setSex('M');
	q.setTitle("Mr");
	q.setSalary( new BigDecimal(1000) );
	s.persist(q);

	List result = s.createQuery("from Person where salary > 100").list();
	assertEquals( result.size(), 1 );
	assertSame( result.get(0), q );
	
	result = s.createQuery("from Person where salary > 100 or name like 'E%'").list();
	assertEquals( result.size(), 2 );		

	result = s.createCriteria(Person.class)
		.add( Property.forName("salary").gt( new BigDecimal(100) ) )
		.list();
	assertEquals( result.size(), 1 );
	assertSame( result.get(0), q );

	result = s.createQuery("select salary from Person where salary > 100").list();
	assertEquals( result.size(), 1 );
	assertEquals( ( (BigDecimal) result.get(0) ).intValue(), 1000 );
	
	s.delete(p);
	s.delete(q);
	t.commit();
	s.close();
}
 
Example #21
Source File: SchedulerDBManager.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
private Order configureSortOrder(SortParameter<JobSortParameter> param, Property property) {
    if (param.getSortOrder().isAscending()) {
        return property.asc();
    } else {
        return property.desc();
    }
}
 
Example #22
Source File: CriteriaQueryTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testClassProperty() {
	Session s = openSession();
	Transaction t = s.beginTransaction();

	// HQL: from Animal a where a.mother.class = Reptile
	Criteria c = s.createCriteria(Animal.class,"a")
		.createAlias("mother","m")
		.add( Property.forName("m.class").eq(Reptile.class) );
	c.list();
	t.rollback();
	s.close();
}
 
Example #23
Source File: StateFactory.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
private static <T extends StateRevision> Optional<T> latestRevision(
        Class<T> revisionType, String field, Object bean) {
    DetachedCriteria maxQuery = DetachedCriteria.forClass(revisionType)
            .add(Restrictions.eq(field, bean))
            .setProjection(Projections.max("id"));
    T revision = (T) getSession()
            .createCriteria(revisionType)
            .add(Restrictions.eq(field, bean))
            .add(Property.forName("id").eq(maxQuery))
            .uniqueResult();
    return Optional.ofNullable(revision);
}
 
Example #24
Source File: DiscriminatorTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testQuerySubclassAttribute() {
	Session s = openSession();
	Transaction t = s.beginTransaction();
	Person p = new Person();
	p.setName("Emmanuel");
	p.setSex('M');
	s.persist(p);
	Employee q = new Employee();
	q.setName("Steve");
	q.setSex('M');
	q.setTitle("Mr");
	q.setSalary( new BigDecimal(1000) );
	s.persist(q);

	List result = s.createQuery("from Person where salary > 100").list();
	assertEquals( result.size(), 1 );
	assertSame( result.get(0), q );

	result = s.createQuery("from Person where salary > 100 or name like 'E%'").list();
	assertEquals( result.size(), 2 );

	result = s.createCriteria(Person.class)
		.add( Property.forName("salary").gt( new BigDecimal(100) ) )
		.list();
	assertEquals( result.size(), 1 );
	assertSame( result.get(0), q );

	//TODO: make this work:
	/*result = s.createQuery("select salary from Person where salary > 100").list();
	assertEquals( result.size(), 1 );
	assertEquals( result.get(0), new BigDecimal(1000) );*/

	s.delete(p);
	s.delete(q);
	t.commit();
	s.close();
}
 
Example #25
Source File: JoinedSubclassTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testQuerySubclassAttribute() {
	Session s = openSession();
	Transaction t = s.beginTransaction();
	Person p = new Person();
	p.setName("Emmanuel");
	p.setSex('M');
	s.persist(p);
	Employee q = new Employee();
	q.setName("Steve");
	q.setSex('M');
	q.setTitle("Mr");
	q.setSalary( new BigDecimal(1000) );
	s.persist(q);

	List result = s.createQuery("from Person where salary > 100").list();
	assertEquals( result.size(), 1 );
	assertSame( result.get(0), q );

	result = s.createQuery("from Person where salary > 100 or name like 'E%'").list();
	assertEquals( result.size(), 2 );

	result = s.createCriteria(Person.class)
		.add( Property.forName("salary").gt( new BigDecimal(100) ) )
		.list();
	assertEquals( result.size(), 1 );
	assertSame( result.get(0), q );

	//TODO: make this work:
	/*result = s.createQuery("select salary from Person where salary > 100").list();
	assertEquals( result.size(), 1 );
	assertEquals( result.get(0), new BigDecimal(1000) );*/

	s.delete(p);
	s.delete(q);
	t.commit();
	s.close();
}
 
Example #26
Source File: RoleDAOHibImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Get the Meta Model Categories associated to a role
 *
 * @see it.eng.spagobi.commons.dao.IRoleDAO#getMetaModelCategoryForRole(java.lang.Integer)
 */
@Override
public List<Integer> getMetaModelCategoriesForRoles(final Collection<String> roles) throws EMFUserError {
	return executeOnTransaction(new IExecuteOnTransaction<List<Integer>>() {
		@Override
		public List<Integer> execute(Session session) throws Exception {
			Criteria c = session.createCriteria(SbiExtRoles.class);
			c.add(Restrictions.in("name", roles));
			c.createAlias("sbiMetaModelCategories", "_sbiMetaModelCategories");
			c.setProjection(Property.forName("_sbiMetaModelCategories.valueId"));
			return c.list();
		}
	});
}
 
Example #27
Source File: OrganzationController.java    From jeecg with Apache License 2.0 5 votes vote down vote up
/**
     * 获取 除当前 组织之外的用户信息列表
     * @param request request
     * @return 处理结果信息
     */
    @RequestMapping(params = "addMyOrgUserToOrgList")
    public void addMyOrgUserToOrgList(TSUser user, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
        String orgId = request.getParameter("orgId");

        CriteriaQuery cq = new CriteriaQuery(TSUser.class, dataGrid);
        org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, user);

        // 获取 当前组织机构的用户信息
//        CriteriaQuery subCq = new CriteriaQuery(TSUserOrg.class);
//        subCq.setProjection(Property.forName("tsUser.id"));
//        subCq.notEq("tsDepart.id", orgId);
        TSDepart tsDepart = ResourceUtil.getSessionUser().getCurrentDepart();
//        subCq.like("tsDepart.orgCode", tsDepart.getOrgCode()+"%");
//        subCq.add();

        String sql = "select uo.user_id from t_s_user_org  uo left join t_s_depart d on uo.org_id = d.id where d.org_code like concat(?,'%') " +
        		     "and uo.user_id not in (select suo.user_id from t_s_user_org  suo  where suo.org_id = ? )";
        List<Map<String, Object>> userIdMaps = this.systemService.findForJdbc(sql, tsDepart.getOrgCode(),orgId);

        List<Object> userIds = new ArrayList<Object>();
        for(Map<String, Object> map :userIdMaps){
        	userIds.add(map.get("user_id"));
        }
        Object[] userIdArr = userIds.toArray();
//        cq.add(Property.forName("id").in(subCq.getDetachedCriteria()));
        cq.add(Property.forName("id").in(userIdArr));
        cq.add();

        this.systemService.getDataGridReturn(cq, true);
        TagUtil.datagrid(response, dataGrid);
    }
 
Example #28
Source File: OutputParameterDAOImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void removeParametersByBiobjId(Integer biobjId, Session session) throws EMFUserError {
	List<Integer> ids = session.createCriteria(SbiOutputParameter.class).add(Restrictions.eq("biobjId", biobjId)).setProjection(Property.forName("id"))
			.list();
	for (Integer id : ids) {
		removeParameter(id, session);
	}
}
 
Example #29
Source File: OutputParameterDAOImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void removeUserDefinedParametersByBiobjId(Integer biobjId, Session session) throws EMFUserError {
	List<Integer> ids = session.createCriteria(SbiOutputParameter.class).add(Restrictions.eq("biobjId", biobjId))
			.add(Restrictions.eq("isUserDefined", true)).setProjection(Property.forName("id")).list();
	for (Integer id : ids) {
		removeParameter(id, session);
	}
}
 
Example #30
Source File: OutputParameterDAOImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void removeSystemDefinedParametersByBiobjId(Integer biobjId, Session session) throws EMFUserError {

	List<Integer> ids = session.createCriteria(SbiOutputParameter.class).add(Restrictions.eq("biobjId", biobjId)).add(Restrictions.isNull("isUserDefined"))
			.setProjection(Property.forName("id")).list();
	// .add(Restrictions.eq("isUserDefined", false)).setProjection(Property.forName("id")).list();
	for (Integer id : ids) {
		removeParameter(id, session);
	}
}