throws CertificateProfileExistsException {
if (isCertificateProfileNameFixed(newprofilename)) {
final String msg = INTRES.getLocalizedMessage("store.errorcertprofilefixed", newprofilename);
logSession.log(admin, admin.getCaId(), LogConstants.MODULE_CA, new Date(), null, null, LogConstants.EVENT_ERROR_CERTPROFILE,
msg);
throw new CertificateProfileExistsException(msg);
}
if (isCertificateProfileNameFixed(oldprofilename)) {
final String msg = INTRES.getLocalizedMessage("store.errorcertprofilefixed", oldprofilename);
logSession.log(admin, admin.getCaId(), LogConstants.MODULE_CA, new Date(), null, null, LogConstants.EVENT_ERROR_CERTPROFILE,
msg);
throw new CertificateProfileExistsException(msg);
}
if (CertificateProfileData.findByProfileName(entityManager, newprofilename) == null) {
final CertificateProfileData pdl = CertificateProfileData.findByProfileName(entityManager, oldprofilename);
if (pdl == null) {
final String msg = INTRES.getLocalizedMessage("store.errorrenameprofile", oldprofilename, newprofilename);
logSession.log(admin, admin.getCaId(), LogConstants.MODULE_CA, new Date(), null, null,
LogConstants.EVENT_ERROR_CERTPROFILE, msg);
} else {
pdl.setCertificateProfileName(newprofilename);
flushProfileCache();
final String msg = INTRES.getLocalizedMessage("store.renamedprofile", oldprofilename, newprofilename);
logSession.log(admin, admin.getCaId(), LogConstants.MODULE_CA, new Date(), null, null, LogConstants.EVENT_INFO_CERTPROFILE, msg);
}
} else {
final String msg = INTRES.getLocalizedMessage("store.errorcertprofileexists", newprofilename);
logSession.log(admin, admin.getCaId(), LogConstants.MODULE_CA, new Date(), null, null, LogConstants.EVENT_ERROR_CERTPROFILE, msg);
throw new CertificateProfileExistsException();
}
}