data1.setSubjectDN(CertTools.stringToBCDNString(dn));
data1.setDN(CertTools.stringToBCDNString(dn));
    public void changeUser(Admin admin, String username,  String dn, String subjectaltname, String email, int endentityprofileid, int certificateprofileid,                           boolean administrator, boolean keyrecoverable, int tokentype, int hardwaretokenissuerid)                              throws AuthorizationDeniedException, UserDoesntFullfillEndEntityProfile, RemoteException {        debug(">changeUser("+username+", "+dn+", "+email+")");        // Check if user fulfills it's profile.        if(globalconfiguration.getEnableEndEntityProfileLimitations()){        EndEntityProfile profile = raadminsession.getEndEntityProfile(admin, endentityprofileid);        try{          profile.doesUserFullfillEndEntityProfileWithoutPassword(username,  dn, subjectaltname, email, certificateprofileid,                                                                 administrator, keyrecoverable, tokentype, hardwaretokenissuerid);        }catch(UserDoesntFullfillEndEntityProfile udfp){            logsession.log(admin, LogEntry.MODULE_RA, new java.util.Date(),username, null, LogEntry.EVENT_ERROR_CHANGEDENDENTITY,"Userdata didn'nt fullfill end entity profile. + " + udfp.getMessage());                          throw new UserDoesntFullfillEndEntityProfile(udfp.getMessage());           }          // Check if administrator is authorized to edit user.           if(!profileauthproxy.getEndEntityProfileAuthorization(admin, endentityprofileid,EndEntityProfileAuthorizationProxy.EDIT_RIGHTS)){            logsession.log(admin, LogEntry.MODULE_RA, new java.util.Date(),username, null, LogEntry.EVENT_ERROR_CHANGEDENDENTITY,"Administrator not authorized");                           throw new AuthorizationDeniedException("Administrator not authorized to edit user.");            }          }                try {            UserDataPK pk = new UserDataPK(username);            UserDataLocal data1= home.findByPrimaryKey(pk);            data1.setSubjectDN(CertTools.stringToBCDNString(dn));            if(subjectaltname != null )                data1.setSubjectAltName(subjectaltname);                         if(email != null)                data1.setSubjectEmail(email);                        data1.setType(makeType(administrator, keyrecoverable));            data1.setEndEntityProfileId(endentityprofileid);            data1.setCertificateProfileId(certificateprofileid);            data1.setTokenType(tokentype);            data1.setHardTokenIssuerId(hardwaretokenissuerid);                        data1.setTimeModified((new java.util.Date()).getTime());            logsession.log(admin, LogEntry.MODULE_RA, new java.util.Date(),username, null, LogEntry.EVENT_INFO_CHANGEDENDENTITY,"");        }        catch (Exception e) {            logsession.log(admin, LogEntry.MODULE_RA,  new java.util.Date(),username, null, LogEntry.EVENT_ERROR_CHANGEDENDENTITY,"");             throw new EJBException(e.getMessage());        }        debug("<changeUser("+username+", password, "+dn+", "+email+")");    } // changeUser