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


Java IdentityQuery类代码示例

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


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

示例1: listUsersByFilter

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
/**
 *
 * @param filter
 * @param isBlocked
 * @return
 */
public List<User> listUsersByFilter(String filter, Boolean isBlocked) {

    final IdentityQueryBuilder queryBuilder = this.identityManager.getQueryBuilder();

    final IdentityQuery<User> query = queryBuilder.createIdentityQuery(User.class);

    List<Condition> conditions = new ArrayList<>();

    // considera que a busca ira ou nao bucar os bloqueados
    if (isBlocked != null) {
        conditions.add(queryBuilder.equal(User.ENABLED, !isBlocked));
    }

    // considere que os filtros devem ser setados
    if (filter != null && !filter.isEmpty()) {
        conditions = Arrays.asList(
                queryBuilder.like(User.USER_NAME, "%" + filter + "%"),
                queryBuilder.like(User.NAME, "%" + filter + "%"));
    }

    query.where(conditions.toArray(new Condition[]{}));

    return query.getResultList();
}
 
开发者ID:arthurgregorio,项目名称:web-budget,代码行数:31,代码来源:AccountService.java

示例2: listGroupsByFilter

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
/**
 *
 * @param filter
 * @param isBlocked
 * @return
 */
public List<Group> listGroupsByFilter(String filter, Boolean isBlocked) {

    final IdentityQueryBuilder queryBuilder = this.identityManager.getQueryBuilder();

    final IdentityQuery<Group> query = queryBuilder.createIdentityQuery(Group.class);

    List<Condition> conditions = new ArrayList<>();

    // considera que a busca ira ou nao bucar os bloqueados
    if (isBlocked != null) {
        conditions.add(queryBuilder.equal(User.ENABLED, !isBlocked));
    }

    // considere que os filtros devem ser setados
    if (filter != null && !filter.isEmpty()) {
        conditions = Arrays.asList(
                queryBuilder.like(User.USER_NAME, "%" + filter + "%"),
                queryBuilder.like(User.NAME, "%" + filter + "%"));
    }

    query.where(conditions.toArray(new Condition[]{}));

    return query.getResultList();
}
 
开发者ID:arthurgregorio,项目名称:web-budget,代码行数:31,代码来源:AccountService.java

示例3: listRoles

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
/**
 * 
 * @return 
 */
public List<Role> listRoles() {

    final IdentityQueryBuilder queryBuilder = 
            this.identityManager.getQueryBuilder();
    final IdentityQuery<Role> query = 
            queryBuilder.createIdentityQuery(Role.class);

    return query.getResultList();
}
 
开发者ID:arthurgregorio,项目名称:web-budget,代码行数:14,代码来源:AccountService.java

示例4: authenticate

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
@Override
@Transactional(qualifier = PicketLink.class)
public void authenticate() 
{
	if(!identity.isLoggedIn())
	{
		FacesContext context = FacesContext.getCurrentInstance();
		if (realm.isEmpty())
		{
			context.addMessage("Realm",new FacesMessage(messages.DomainRequired()));
		}
		if (credentials.getUserId().isEmpty())
		{
			context.addMessage("username",new FacesMessage(messages.UsernameRequired()));
		}
		if (credentials.getPassword().isEmpty())
		{
			context.addMessage("password",new FacesMessage(messages.PasswordRequired()));
		}
				
		Realm storedRealm = partitionManager.getPartition(Realm.class, realm);
		if(storedRealm == null)
		{
			context.addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR,"Error!", messages.LoginStatusFailure()));
			return;
		}
		IdentityManager identityManager = partitionManager.createIdentityManager(storedRealm);
		
		Password password = new Password(credentials.getPassword());
		UsernamePasswordCredentials m_credentials = new UsernamePasswordCredentials(credentials.getUserId(), password);
		identityManager.validateCredentials(m_credentials);
        org.picketlink.idm.credential.Credentials.Status status = m_credentials.getStatus();
        if (status == org.picketlink.idm.credential.Credentials.Status.INVALID)
        {
			context.addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR,"Error!", messages.LoginStatusFailure()));
			return;
        }
        IdentityQueryBuilder queryBuilder = identityManager.getQueryBuilder();
        IdentityQuery<User> query = queryBuilder.createIdentityQuery(User.class);

        // let's check if the user is stored by querying by name
        query.where(queryBuilder.equal(User.USER_NAME, credentials.getUserId()));

        List<User> users = query.getResultList();

        setStatus(AuthenticationStatus.SUCCESS);
        setAccount(users.get(0));
//		UserIdentity user = new UserIdentity();
//		user.setUsername(Username);
//		user.setPassword(Password);
//		model.SaveUser(user);
//		System.out.print("this is test");
	}
     //  this.viewNavigationHandler.navigateTo(Windows.contourdynamics.class);
}
 
开发者ID:Contourdynamics,项目名称:smartcommunication,代码行数:56,代码来源:CDidentityManager.java

示例5: checkForDefaultGroups

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
/**
 * 
 * @param partitionManager 
 */
private void checkForDefaultGroups(PartitionManager partitionManager) {
    
    final IdentityManager identityManager = 
            partitionManager.createIdentityManager(this.defaultRealm);
    
    final IdentityQuery<Group> query = identityManager
            .createIdentityQuery(Group.class);

    query.setParameter(Group.NAME, "Administradores");

    final List<Group> groups = query.getResultList();
    
    if (groups.isEmpty()) {
        
        this.logger.info("Creating default groups");
        
        identityManager.add(new Group("Administradores"));
    }
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:24,代码来源:SecurityInitializer.java

示例6: checkForDefaultRoles

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
/**
 * 
 * @param partitionManager 
 */
private void checkForDefaultRoles(PartitionManager partitionManager) {
    
    final IdentityManager identityManager = 
            partitionManager.createIdentityManager(this.defaultRealm);
    
    final IdentityQuery<Role> query = identityManager
            .createIdentityQuery(Role.class);

    query.setParameter(Role.NAME, ApplicationRoles.ADMINISTRATOR);

    List<Role> roles = query.getResultList();
    
    if (roles.isEmpty()) {
        
        this.logger.info("Creating default roles");
        
        identityManager.add(new Role(ApplicationRoles.ADMINISTRATOR));
    }
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:24,代码来源:SecurityInitializer.java

示例7: listUsers

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
/**
 *
 * @param isBlocked
 * @return
 */
public List<User> listUsers(Boolean isBlocked) {

    final IdentityQueryBuilder queryBuilder = this.identityManager.getQueryBuilder();

    final IdentityQuery<User> query = queryBuilder.createIdentityQuery(User.class);

    if (isBlocked != null) {
        query.where(queryBuilder.equal(User.ENABLED, !isBlocked));
    }

    return query.getResultList();
}
 
开发者ID:arthurgregorio,项目名称:web-budget,代码行数:18,代码来源:AccountService.java

示例8: listGroups

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
/**
 *
 * @param isBlocked
 * @return
 */
public List<Group> listGroups(Boolean isBlocked) {

    final IdentityQueryBuilder queryBuilder = this.identityManager.getQueryBuilder();

    final IdentityQuery<Group> query = queryBuilder.createIdentityQuery(Group.class);

    if (isBlocked != null) {
        query.where(queryBuilder.equal(User.ENABLED, !isBlocked));
    }

    return query.getResultList();
}
 
开发者ID:arthurgregorio,项目名称:web-budget,代码行数:18,代码来源:AccountService.java

示例9: checkForDefaultUsers

import org.picketlink.idm.query.IdentityQuery; //导入依赖的package包/类
/**
 * 
 * @param partitionManager 
 */
private void checkForDefaultUsers(PartitionManager partitionManager) {

    final IdentityManager identityManager = 
            partitionManager.createIdentityManager(this.defaultRealm);
    
    final IdentityQuery<User> query = identityManager
            .createIdentityQuery(User.class);

    query.setParameter(User.USER_NAME, "admin");

    List<User> users = query.getResultList();
    
    if (users.isEmpty()) {
        
        this.logger.info("Creating default users");
        
        final User user = new User("admin", new Person(
                "Administrador", "[email protected]"));
        
        user.setCreatedDate(new Date());
        user.setEnabled(true);
        user.setExpirationDate(null);
        
        identityManager.add(user);

        identityManager.updateCredential(user, new Password("admin"));
        
        final RelationshipManager relationshipManager = 
                partitionManager.createRelationshipManager();
        
        final IdentityQuery<Role> roleQuery = 
                identityManager.createIdentityQuery(Role.class);

        roleQuery.setParameter(Role.NAME, ApplicationRoles.ADMINISTRATOR);
        
        final Role administratorRole = roleQuery.getResultList().get(0);
        
        relationshipManager.add(new Grant(user, administratorRole));
    }
}
 
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:45,代码来源:SecurityInitializer.java


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