Java 类ims.admin.vo.domain.AppUserVoAssembler 实例源码

项目:AvoinApotti    文件:DailyPatientProgressDlgImpl.java   
public AppUserVo getAppUser(AppUserRefVo appUserRefVo)
{
    if (appUserRefVo == null || appUserRefVo.getID_AppUserIsNotNull())
        throw new CodingRuntimeException("Cannot get AppUserVo for null AppUserRefVo");

    DomainFactory factory = getDomainFactory();
    AppUser doAppUser = (AppUser) factory.getDomainObject(AppUser.class, appUserRefVo.getID_AppUser().intValue());
    return AppUserVoAssembler.create(doAppUser);
}
项目:AvoinApotti    文件:CcoContextSetter.java   
public void setLoggedInRsno(int userId) 
{
    DomainFactory factory = this.getDomainFactory();
    AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
    AppUserVo appuserVo = AppUserVoAssembler.create(appusr);

    String rsnoId = "";

    if (appuserVo.getMosIsNotNull())
    {
        if (appuserVo.getMos().getCodeMappingsIsNotNull())
        {
            for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
            {
                TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);                 
                if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
                {
                    rsnoId = taxmapVo.getTaxonomyCode();
                    break;
                }
            }

            CcoContextReader.setLoggedInRsno(rsnoId, ctx);

        }

    }
}
项目:AvoinApotti    文件:UserProvider.java   
@SuppressWarnings("unchecked")
public IAppUser getAppUser(String username, String password) throws Exception
{
    String hql = "from AppUser user where user.username=:username and user.password=:password and user.isActive is true";
    List list = getDomainFactory().find(hql, new String[] { "username", "password" }, new Object[] { username, Configuration.getHash(password) } );
    if (list.size() == 0)
        return null;

    return AppUserVoAssembler.create((AppUser)list.get(0));
}
项目:AvoinApotti    文件:ExternalAuthUserProvider.java   
public IAppUser getAppUser(int id)
{
    if(id <= 0)
        return null;

    AppUser domUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, id);
    return AppUserVoAssembler.create(domUser); 
}
项目:AvoinApotti    文件:LDAPLoginImpl.java   
public IAppUser saveLDAPCredentials(IAppUser user, String username, String password) throws StaleObjectException 
{
    DomainFactory factory = getDomainFactory();

    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
    domUser.setLDAPUsername(username);
    domUser.setLDAPPassword(Configuration.encryptPasswordWithCloak(password));

    factory.save(domUser);
    AppUserVo fullUser = AppUserVoAssembler.create(domUser);
    user = fullUser;
    factory.getDomainSession().setUser(user);       

    return user;
}
项目:openMAXIMS    文件:DailyPatientProgressDlgImpl.java   
public AppUserVo getAppUser(AppUserRefVo appUserRefVo)
{
    if (appUserRefVo == null || appUserRefVo.getID_AppUserIsNotNull())
        throw new CodingRuntimeException("Cannot get AppUserVo for null AppUserRefVo");

    DomainFactory factory = getDomainFactory();
    AppUser doAppUser = (AppUser) factory.getDomainObject(AppUser.class, appUserRefVo.getID_AppUser().intValue());
    return AppUserVoAssembler.create(doAppUser);
}
项目:openMAXIMS    文件:PDSPatientSearchImpl.java   
public AppUserVo getAppUser(AppUserRefVo appUserRef) 
{
    if (appUserRef != null)
    {   
     AppUser user = (AppUser) getDomainFactory().getDomainObject(AppUser.class,appUserRef.getID_AppUser());
        AppUserVo voUser = AppUserVoAssembler.create(user);
        return voUser;

    }
    return null;
}
项目:openMAXIMS    文件:ContextSetter.java   
public void setLoggedInRsno(int userId) 
{
    DomainFactory factory = this.getDomainFactory();
    AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
    AppUserVo appuserVo = AppUserVoAssembler.create(appusr);

    String rsnoId = "";

    if (appuserVo.getMosIsNotNull())
    {
        if (appuserVo.getMos().getCodeMappingsIsNotNull())
        {
            for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
            {
                TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);                 
                if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
                {
                    rsnoId = taxmapVo.getTaxonomyCode();
                    break;
                }
            }

            ContextReader.setLoggedInRsno(rsnoId, ctx);

        }

    }
}
项目:openMAXIMS    文件:CcoContextSetter.java   
public void setLoggedInRsno(int userId) 
{
    DomainFactory factory = this.getDomainFactory();
    AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
    AppUserVo appuserVo = AppUserVoAssembler.create(appusr);

    String rsnoId = "";

    if (appuserVo.getMosIsNotNull())
    {
        if (appuserVo.getMos().getCodeMappingsIsNotNull())
        {
            for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
            {
                TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);                 
                if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
                {
                    rsnoId = taxmapVo.getTaxonomyCode();
                    break;
                }
            }

            CcoContextReader.setLoggedInRsno(rsnoId, ctx);

        }

    }
}
项目:openMAXIMS    文件:UserProvider.java   
@SuppressWarnings("unchecked")
public IAppUser getAppUser(String username, String password) throws Exception
{
    String hql = "from AppUser user where user.username=:username and user.password=:password and user.isActive is true";
    List list = getDomainFactory().find(hql, new String[] { "username", "password" }, new Object[] { username, Configuration.getHash(password) } );
    if (list.size() == 0)
        return null;

    return AppUserVoAssembler.create((AppUser)list.get(0));
}
项目:openMAXIMS    文件:UserProvider.java   
public IAppUser lockAccount(IAppUser user, boolean value) throws Exception 
{
    DomainFactory factory = getDomainFactory();
    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
    domUser.setLocked(Boolean.valueOf(value));

    factory.save(domUser);

    AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
    user = fulluser;    

    return user;
}
项目:openMAXIMS    文件:ExternalAuthUserProvider.java   
public IAppUser getAppUser(int id)
{
    if(id <= 0)
        return null;

    AppUser domUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, id);
    return AppUserVoAssembler.create(domUser); 
}
项目:openMAXIMS    文件:ExternalAuthUserProvider.java   
public IAppUser lockAccount(IAppUser user, boolean value) throws Exception 
{
    DomainFactory factory = getDomainFactory();
    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
    domUser.setLocked(Boolean.valueOf(value));

    factory.save(domUser);

    AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
    user = fulluser;    

    return user;
}
项目:openMAXIMS    文件:ApplicationUsersImpl.java   
public AppUserVo updateAppUser(AppUserVo appUser) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();
    AppUser domUser = AppUserVoAssembler.extractAppUser(factory, appUser);
    factory.save(domUser);
    return AppUserVoAssembler.create(domUser);
}
项目:openMAXIMS    文件:LDAPLoginImpl.java   
public IAppUser saveLDAPCredentials(IAppUser user, String username, String password) throws StaleObjectException 
{
    DomainFactory factory = getDomainFactory();

    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
    domUser.setLDAPUsername(username);
    domUser.setLDAPPassword(Configuration.encryptPasswordWithCloak(password));

    factory.save(domUser);
    AppUserVo fullUser = AppUserVoAssembler.create(domUser);
    user = fullUser;
    factory.getDomainSession().setUser(user);       

    return user;
}
项目:openMAXIMS    文件:DailyPatientProgressDlgImpl.java   
public AppUserVo getAppUser(AppUserRefVo appUserRefVo)
{
    if (appUserRefVo == null || appUserRefVo.getID_AppUserIsNotNull())
        throw new CodingRuntimeException("Cannot get AppUserVo for null AppUserRefVo");

    DomainFactory factory = getDomainFactory();
    AppUser doAppUser = (AppUser) factory.getDomainObject(AppUser.class, appUserRefVo.getID_AppUser().intValue());
    return AppUserVoAssembler.create(doAppUser);
}
项目:openMAXIMS    文件:CcoContextSetter.java   
public void setLoggedInRsno(int userId) 
{
    DomainFactory factory = this.getDomainFactory();
    AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
    AppUserVo appuserVo = AppUserVoAssembler.create(appusr);

    String rsnoId = "";

    if (appuserVo.getMosIsNotNull())
    {
        if (appuserVo.getMos().getCodeMappingsIsNotNull())
        {
            for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
            {
                TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);                 
                if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
                {
                    rsnoId = taxmapVo.getTaxonomyCode();
                    break;
                }
            }

            CcoContextReader.setLoggedInRsno(rsnoId, ctx);

        }

    }
}
项目:openMAXIMS    文件:UserProvider.java   
@SuppressWarnings("unchecked")
public IAppUser getAppUser(String username, String password) throws Exception
{
    String hql = "from AppUser user where user.username=:username and user.password=:password and user.isActive is true";
    List list = getDomainFactory().find(hql, new String[] { "username", "password" }, new Object[] { username, Configuration.getHash(password) } );
    if (list.size() == 0)
        return null;

    return AppUserVoAssembler.create((AppUser)list.get(0));
}
项目:openMAXIMS    文件:ExternalAuthUserProvider.java   
public IAppUser getAppUser(int id)
{
    if(id <= 0)
        return null;

    AppUser domUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, id);
    return AppUserVoAssembler.create(domUser); 
}
项目:openMAXIMS    文件:LDAPLoginImpl.java   
public IAppUser saveLDAPCredentials(IAppUser user, String username, String password) throws StaleObjectException 
{
    DomainFactory factory = getDomainFactory();

    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
    domUser.setLDAPUsername(username);
    domUser.setLDAPPassword(Configuration.encryptPasswordWithCloak(password));

    factory.save(domUser);
    AppUserVo fullUser = AppUserVoAssembler.create(domUser);
    user = fullUser;
    factory.getDomainSession().setUser(user);       

    return user;
}
项目:openmaxims-linux    文件:DailyPatientProgressDlgImpl.java   
public AppUserVo getAppUser(AppUserRefVo appUserRefVo)
{
    if (appUserRefVo == null || appUserRefVo.getID_AppUserIsNotNull())
        throw new CodingRuntimeException("Cannot get AppUserVo for null AppUserRefVo");

    DomainFactory factory = getDomainFactory();
    AppUser doAppUser = (AppUser) factory.getDomainObject(AppUser.class, appUserRefVo.getID_AppUser().intValue());
    return AppUserVoAssembler.create(doAppUser);
}
项目:openmaxims-linux    文件:CcoContextSetter.java   
public void setLoggedInRsno(int userId) 
{
    DomainFactory factory = this.getDomainFactory();
    AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
    AppUserVo appuserVo = AppUserVoAssembler.create(appusr);

    String rsnoId = "";

    if (appuserVo.getMosIsNotNull())
    {
        if (appuserVo.getMos().getCodeMappingsIsNotNull())
        {
            for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
            {
                TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);                 
                if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
                {
                    rsnoId = taxmapVo.getTaxonomyCode();
                    break;
                }
            }

            CcoContextReader.setLoggedInRsno(rsnoId, ctx);

        }

    }
}
项目:openmaxims-linux    文件:UserProvider.java   
@SuppressWarnings("unchecked")
public IAppUser getAppUser(String username, String password) throws Exception
{
    String hql = "from AppUser user where user.username=:username and user.password=:password and user.isActive is true";
    List list = getDomainFactory().find(hql, new String[] { "username", "password" }, new Object[] { username, Configuration.getHash(password) } );
    if (list.size() == 0)
        return null;

    return AppUserVoAssembler.create((AppUser)list.get(0));
}
项目:openmaxims-linux    文件:ExternalAuthUserProvider.java   
public IAppUser getAppUser(int id)
{
    if(id <= 0)
        return null;

    AppUser domUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, id);
    return AppUserVoAssembler.create(domUser); 
}
项目:openmaxims-linux    文件:LDAPLoginImpl.java   
public IAppUser saveLDAPCredentials(IAppUser user, String username, String password) throws StaleObjectException 
{
    DomainFactory factory = getDomainFactory();

    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
    domUser.setLDAPUsername(username);
    domUser.setLDAPPassword(Configuration.encryptPasswordWithCloak(password));

    factory.save(domUser);
    AppUserVo fullUser = AppUserVoAssembler.create(domUser);
    user = fullUser;
    factory.getDomainSession().setUser(user);       

    return user;
}
项目:AvoinApotti    文件:LDAPUserProvider.java   
public IAppUser changePassword(IAppUser user, String newPassword) throws Exception
{
    if(user == null)
        throw new Exception("Invalid user and/or password.");

    if(user.useExternalAuthentication())
    {
        throw new ConfigurationException("Change password functionality not supported.");           
    }
    else
    {
        DomainFactory factory = getDomainFactory();
        AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());

        String currentEncodedPassord = domUser.getEncodedPassword();

        domUser.setPassword(Configuration.getHash(newPassword));    
        domUser.setEncodedPassword(Configuration.encryptPasswordWithCloak(newPassword));        
        java.util.Date date = domUser.getPwdExpDate();
        if (date != null)
        {
            Calendar cal = Calendar.getInstance();
            cal.setTime(new java.util.Date());
            cal.add(Calendar.DATE, ConfigFlag.GEN.PASSWD_EXP_INCREMENT.getValue());
            domUser.setPwdExpDate(cal.getTime());
        }

        // WDEV-8894 fix - the current encoded password might be null
        // and in this case we won't store it in the history
        if(currentEncodedPassord != null && currentEncodedPassord.trim().length() > 0)
        {
            List prev = domUser.getPreviousPasswords();
            if(prev == null)
                prev = new ArrayList();

            AppUserPasswordVo previousPassword = new AppUserPasswordVo();
            previousPassword.setDateTime(new DateTime());
            previousPassword.setEncodedPassword(currentEncodedPassord);
            prev.add(AppUserPasswordVoAssembler.extractAppUserPassword(factory, previousPassword));

            domUser.setPreviousPasswords(prev);
        }

        factory.save(domUser);

        AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
        user = fulluser;
        user.setClearPassword(newPassword);

        return user;
    }                           
}
项目:AvoinApotti    文件:UserProvider.java   
public IAppUser getAppUser(String username) 
{
    return AppUserVoAssembler.create(AppUser.getAppUserFromUsername(getDomainFactory(), username));
}
项目:AvoinApotti    文件:UserProvider.java   
public IAppUser getAppUser(int id) 
{
    return AppUserVoAssembler.create((AppUser)getDomainFactory().getDomainObject(AppUser.class, id));
}
项目:AvoinApotti    文件:UserProvider.java   
@SuppressWarnings("unchecked")
public IAppUser changePassword(IAppUser user, String newPassword) throws Exception
{
    DomainFactory factory = getDomainFactory();
    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());

    String currentEncodedPassord = domUser.getEncodedPassword();

    domUser.setPassword(Configuration.getHash(newPassword));    
    domUser.setEncodedPassword(Configuration.encryptPasswordWithCloak(newPassword));        
    java.util.Date date = domUser.getPwdExpDate();
    if (date != null)
    {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new java.util.Date());
        cal.add(Calendar.DATE, ConfigFlag.GEN.PASSWD_EXP_INCREMENT.getValue());
        domUser.setPwdExpDate(cal.getTime());
    }

    // WDEV-8894 fix - the current encoded password might be null
    // and in this case we won't store it in the history
    if(currentEncodedPassord != null && currentEncodedPassord.trim().length() > 0)
    {
        List prev = domUser.getPreviousPasswords();
        if(prev == null)
            prev = new ArrayList();

        AppUserPasswordVo previousPassword = new AppUserPasswordVo();
        previousPassword.setDateTime(new DateTime());
        previousPassword.setEncodedPassword(currentEncodedPassord);
        prev.add(AppUserPasswordVoAssembler.extractAppUserPassword(factory, previousPassword));

        domUser.setPreviousPasswords(prev);
    }

    factory.save(domUser);

    AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
    user = fulluser;
    user.setClearPassword(newPassword);

    return user;
}
项目:AvoinApotti    文件:ExternalAuthUserProvider.java   
public IAppUser getAppUser(String username) 
{
    return AppUserVoAssembler.create(AppUser.getAppUserFromUsername(getDomainFactory(), username));
}
项目:AvoinApotti    文件:ExternalAuthUserProvider.java   
@SuppressWarnings("unchecked")
public IAppUser changePassword(IAppUser user, String newPassword) throws Exception
{
    DomainFactory factory = getDomainFactory();
    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
    java.util.Date date = domUser.getPwdExpDate();
    if (date != null)
    {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new java.util.Date());
        cal.add(Calendar.DATE, ConfigFlag.GEN.PASSWD_EXP_INCREMENT.getValue());
        domUser.setPwdExpDate(cal.getTime());
    }


    // WDEV-14264 May need to replicate to both HEARTS and MAXIMS
    if (ConfigFlag.DTO.USER_REPLICATION_SERVICE.getValue().equals("USER"))
        changeHeartPassword(user, newPassword);
    else if (ConfigFlag.DTO.USER_REPLICATION_SERVICE.getValue().equals("BOTH"))
    {
        changeHeartPassword(user, newPassword);
        changeMaximsPassword(user, newPassword, domUser.getPwdExpDate());
    }
    else
        changeMaximsPassword(user, newPassword, domUser.getPwdExpDate());



    String currentEncodedPassord = domUser.getEncodedPassword();

    domUser.setPassword(Configuration.getHash(newPassword));    
    domUser.setEncodedPassword(Configuration.encryptPasswordWithCloak(newPassword));        

    List prev = domUser.getPreviousPasswords();
    if(prev == null)
        prev = new ArrayList();

    AppUserPasswordVo previousPassword = new AppUserPasswordVo();
    previousPassword.setDateTime(new DateTime());
    previousPassword.setEncodedPassword(currentEncodedPassord);

    //WDEV-9647 If encodedPassword is null, set it to
    // 'unknown' as not null value in password history
    if (!previousPassword.getEncodedPasswordIsNotNull())
        previousPassword.setEncodedPassword("unknown");

    prev.add(AppUserPasswordVoAssembler.extractAppUserPassword(factory, previousPassword));

    domUser.setPreviousPasswords(prev);

    factory.save(domUser);

    AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
    user = fulluser;
    user.setClearPassword(newPassword);

    return user;
}
项目:AvoinApotti    文件:ApplicationUsersImpl.java   
public AppUserVo getAppUser(AppUserShortVo appUserVo)
{
    DomainFactory factory = getDomainFactory();
    return AppUserVoAssembler.create((AppUser)factory.getDomainObject(AppUser.class, appUserVo.getID_AppUser()));
}
项目:openMAXIMS    文件:LDAPUserProvider.java   
public IAppUser changePassword(IAppUser user, String newPassword) throws Exception
{
    if(user == null)
        throw new Exception("Invalid user and/or password.");

    if(user.useExternalAuthentication())
    {
        throw new ConfigurationException("Change password functionality not supported.");           
    }
    else
    {
        DomainFactory factory = getDomainFactory();
        AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());

        String currentEncodedPassord = domUser.getEncodedPassword();

        domUser.setPassword(Configuration.getHash(newPassword));    
        domUser.setEncodedPassword(Configuration.encryptPasswordWithCloak(newPassword));        
        java.util.Date date = domUser.getPwdExpDate();
        if (date != null)
        {
            Calendar cal = Calendar.getInstance();
            cal.setTime(new java.util.Date());
            cal.add(Calendar.DATE, ConfigFlag.GEN.PASSWD_EXP_INCREMENT.getValue());
            domUser.setPwdExpDate(cal.getTime());
        }

        // WDEV-8894 fix - the current encoded password might be null
        // and in this case we won't store it in the history
        if(currentEncodedPassord != null && currentEncodedPassord.trim().length() > 0)
        {
            List prev = domUser.getPreviousPasswords();
            if(prev == null)
                prev = new ArrayList();

            AppUserPasswordVo previousPassword = new AppUserPasswordVo();
            previousPassword.setDateTime(new DateTime());
            previousPassword.setEncodedPassword(currentEncodedPassord);
            prev.add(AppUserPasswordVoAssembler.extractAppUserPassword(factory, previousPassword));

            domUser.setPreviousPasswords(prev);
        }

        factory.save(domUser);

        AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
        user = fulluser;
        user.setClearPassword(newPassword);

        return user;
    }                           
}
项目:openMAXIMS    文件:UserProvider.java   
public IAppUser getAppUser(String username) 
{
    return AppUserVoAssembler.create(AppUser.getAppUserFromUsername(getDomainFactory(), username));
}
项目:openMAXIMS    文件:UserProvider.java   
public IAppUser getAppUser(int id) 
{
    return AppUserVoAssembler.create((AppUser)getDomainFactory().getDomainObject(AppUser.class, id));
}
项目:openMAXIMS    文件:UserProvider.java   
@SuppressWarnings("unchecked")
public IAppUser changePassword(IAppUser user, String newPassword) throws Exception
{
    DomainFactory factory = getDomainFactory();
    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());

    String currentEncodedPassord = domUser.getEncodedPassword();

    domUser.setPassword(Configuration.getHash(newPassword));    
    domUser.setEncodedPassword(Configuration.encryptPasswordWithCloak(newPassword));        
    java.util.Date date = domUser.getPwdExpDate();
    if (date != null)
    {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new java.util.Date());
        cal.add(Calendar.DATE, ConfigFlag.GEN.PASSWD_EXP_INCREMENT.getValue());
        domUser.setPwdExpDate(cal.getTime());
    }

    // WDEV-8894 fix - the current encoded password might be null
    // and in this case we won't store it in the history
    if(currentEncodedPassord != null && currentEncodedPassord.trim().length() > 0)
    {
        List prev = domUser.getPreviousPasswords();
        if(prev == null)
            prev = new ArrayList();

        AppUserPasswordVo previousPassword = new AppUserPasswordVo();
        previousPassword.setDateTime(new DateTime());
        previousPassword.setEncodedPassword(currentEncodedPassord);
        prev.add(AppUserPasswordVoAssembler.extractAppUserPassword(factory, previousPassword));

        domUser.setPreviousPasswords(prev);
    }

    factory.save(domUser);

    AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
    user = fulluser;
    user.setClearPassword(newPassword);

    return user;
}
项目:openMAXIMS    文件:ExternalAuthUserProvider.java   
public IAppUser getAppUser(String username) 
{
    return AppUserVoAssembler.create(AppUser.getAppUserFromUsername(getDomainFactory(), username));
}
项目:openMAXIMS    文件:ExternalAuthUserProvider.java   
@SuppressWarnings("unchecked")
public IAppUser changePassword(IAppUser user, String newPassword) throws Exception
{
    DomainFactory factory = getDomainFactory();
    AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
    java.util.Date date = domUser.getPwdExpDate();
    if (date != null)
    {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new java.util.Date());
        cal.add(Calendar.DATE, ConfigFlag.GEN.PASSWD_EXP_INCREMENT.getValue());
        domUser.setPwdExpDate(cal.getTime());
    }


    // WDEV-14264 May need to replicate to both HEARTS and MAXIMS
    if (ConfigFlag.DTO.USER_REPLICATION_SERVICE.getValue().equals("USER"))
        changeHeartPassword(user, newPassword);
    else if (ConfigFlag.DTO.USER_REPLICATION_SERVICE.getValue().equals("BOTH"))
    {
        changeHeartPassword(user, newPassword);
        changeMaximsPassword(user, newPassword, domUser.getPwdExpDate());
    }
    else
        changeMaximsPassword(user, newPassword, domUser.getPwdExpDate());



    String currentEncodedPassord = domUser.getEncodedPassword();

    domUser.setPassword(Configuration.getHash(newPassword));    
    domUser.setEncodedPassword(Configuration.encryptPasswordWithCloak(newPassword));        

    List prev = domUser.getPreviousPasswords();
    if(prev == null)
        prev = new ArrayList();

    AppUserPasswordVo previousPassword = new AppUserPasswordVo();
    previousPassword.setDateTime(new DateTime());
    previousPassword.setEncodedPassword(currentEncodedPassord);

    //WDEV-9647 If encodedPassword is null, set it to
    // 'unknown' as not null value in password history
    if (!previousPassword.getEncodedPasswordIsNotNull())
        previousPassword.setEncodedPassword("unknown");

    prev.add(AppUserPasswordVoAssembler.extractAppUserPassword(factory, previousPassword));

    domUser.setPreviousPasswords(prev);

    factory.save(domUser);

    AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
    user = fulluser;
    user.setClearPassword(newPassword);

    return user;
}
项目:openMAXIMS    文件:ApplicationUsersImpl.java   
public AppUserVo getAppUser(AppUserShortVo appUserVo)
{
    DomainFactory factory = getDomainFactory();
    return AppUserVoAssembler.create((AppUser)factory.getDomainObject(AppUser.class, appUserVo.getID_AppUser()));
}
项目:openMAXIMS    文件:LDAPUserProvider.java   
public IAppUser changePassword(IAppUser user, String newPassword) throws Exception
{
    if(user == null)
        throw new Exception("Invalid user and/or password.");

    if(user.useExternalAuthentication())
    {
        throw new ConfigurationException("Change password functionality not supported.");           
    }
    else
    {
        DomainFactory factory = getDomainFactory();
        AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());

        String currentEncodedPassord = domUser.getEncodedPassword();

        domUser.setPassword(Configuration.getHash(newPassword));    
        domUser.setEncodedPassword(Configuration.encryptPasswordWithCloak(newPassword));        
        java.util.Date date = domUser.getPwdExpDate();
        if (date != null)
        {
            Calendar cal = Calendar.getInstance();
            cal.setTime(new java.util.Date());
            cal.add(Calendar.DATE, ConfigFlag.GEN.PASSWD_EXP_INCREMENT.getValue());
            domUser.setPwdExpDate(cal.getTime());
        }

        // WDEV-8894 fix - the current encoded password might be null
        // and in this case we won't store it in the history
        if(currentEncodedPassord != null && currentEncodedPassord.trim().length() > 0)
        {
            List prev = domUser.getPreviousPasswords();
            if(prev == null)
                prev = new ArrayList();

            AppUserPasswordVo previousPassword = new AppUserPasswordVo();
            previousPassword.setDateTime(new DateTime());
            previousPassword.setEncodedPassword(currentEncodedPassord);
            prev.add(AppUserPasswordVoAssembler.extractAppUserPassword(factory, previousPassword));

            domUser.setPreviousPasswords(prev);
        }

        factory.save(domUser);

        AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
        user = fulluser;
        user.setClearPassword(newPassword);

        return user;
    }                           
}