Package org.ejbca.core.ejb.ra.raadmin

Examples of org.ejbca.core.ejb.ra.raadmin.EndEntityProfileData


            final String errorMessage = "Attempted to add an end entity profile with name " + profilename + ", which already exists in the database.";
            LOG.error(errorMessage);
            throw new EndEntityProfileExistsException(errorMessage);
        } else {
            try {
                entityManager.persist(new EndEntityProfileData(Integer.valueOf(profileid), profilename, profile));
                flushProfileCache();
                final String msg = INTRES.getLocalizedMessage("ra.addedprofile", profilename);
                logSession.log(admin, admin.getCaId(), LogConstants.MODULE_RA, new Date(), null, null,
                        LogConstants.EVENT_INFO_ENDENTITYPROFILE, msg);
            } catch (Exception e) {
View Full Code Here


            logSession.log(admin, admin.getCaId(), LogConstants.MODULE_RA, new Date(), null, null,
                    LogConstants.EVENT_ERROR_ENDENTITYPROFILE, msg);
            throw new EndEntityProfileExistsException();
        }
        if (EndEntityProfileData.findByProfileName(entityManager, newname) == null) {
          final EndEntityProfileData pdl = EndEntityProfileData.findByProfileName(entityManager, orgname);
            boolean success = false;
            if (pdl != null) {
              try {
                entityManager.persist(new EndEntityProfileData(Integer.valueOf(findFreeEndEntityProfileId()), newname, (EndEntityProfile) pdl.getProfile().clone()));
                flushProfileCache();
                final String msg = INTRES.getLocalizedMessage("ra.clonedprofile", newname, orgname);
                logSession.log(admin, admin.getCaId(), LogConstants.MODULE_RA, new Date(), null, null,
                    LogConstants.EVENT_INFO_ENDENTITYPROFILE, msg);
                success = true;
View Full Code Here

        String[] availablecas = null;
        boolean exists = false;
        final Collection<EndEntityProfileData> result = EndEntityProfileData.findAll(entityManager);
        final Iterator<EndEntityProfileData> i = result.iterator();
        while (i.hasNext() && !exists) {
          final EndEntityProfileData ep = i.next();
            availablecas = ep.getProfile().getValue(EndEntityProfile.AVAILCAS, 0).split(EndEntityProfile.SPLITCHAR);
            for (int j = 0; j < availablecas.length; j++) {
                if (Integer.parseInt(availablecas[j]) == caid) {
                    exists = true;
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("CA exists in entity profile " + ep.getProfileName());
                    }
                    break;
                }
            }
        }
View Full Code Here

    @Override
    public void initializeAndUpgradeProfiles(final Admin admin) {
      final Collection<EndEntityProfileData> result = EndEntityProfileData.findAll(entityManager);
      final Iterator<EndEntityProfileData> iter = result.iterator();
        while (iter.hasNext()) {
          final EndEntityProfileData pdata = iter.next();
            if (LOG.isDebugEnabled()) {
              final String name = pdata.getProfileName();
                LOG.debug("Loaded end entity profile: " + name);
            }
            pdata.upgradeProfile();
        }
        flushProfileCache();
    }
View Full Code Here

        flushProfileCache();
    }

    @Override
    public void internalChangeEndEntityProfileNoFlushCache(final Admin admin, final String profilename, final EndEntityProfile profile) {
      final EndEntityProfileData pdl = EndEntityProfileData.findByProfileName(entityManager, profilename);
        if (pdl == null) {
          final String msg = INTRES.getLocalizedMessage("ra.errorchangeprofile", profilename);
            logSession.log(admin, admin.getCaId(), LogConstants.MODULE_RA, new Date(), null, null,
                    LogConstants.EVENT_ERROR_ENDENTITYPROFILE, msg);
        } else {
            pdl.setProfile(profile);
            final String msg = INTRES.getLocalizedMessage("ra.changedprofile", profilename);
            logSession.log(admin, admin.getCaId(), LogConstants.MODULE_RA, new Date(), null, null,
                    LogConstants.EVENT_INFO_ENDENTITYPROFILE, msg);
        }
    }
View Full Code Here

    }

    @Override
    public void removeEndEntityProfile(final Admin admin, final String profilename) {
        try {
          final EndEntityProfileData pdl = EndEntityProfileData.findByProfileName(entityManager, profilename);
          if (pdl == null) {
            if (LOG.isDebugEnabled()) {
              LOG.debug("Trying to remove an end entity profile that does not exist: "+profilename);                   
            }
          } else {
View Full Code Here

            logSession.log(admin, admin.getCaId(), LogConstants.MODULE_RA, new Date(), null, null,
                    LogConstants.EVENT_ERROR_ENDENTITYPROFILE, msg);
            throw new EndEntityProfileExistsException();
        }
        if (EndEntityProfileData.findByProfileName(entityManager, newprofilename) == null) {
          final EndEntityProfileData pdl = EndEntityProfileData.findByProfileName(entityManager, oldprofilename);
            if (pdl == null) {
              final String msg = INTRES.getLocalizedMessage("ra.errorrenameprofile", oldprofilename, newprofilename);
                logSession.log(admin, admin.getCaId(), LogConstants.MODULE_RA, new Date(), null, null,
                        LogConstants.EVENT_ERROR_ENDENTITYPROFILE, msg);
            } else {
                pdl.setProfileName(newprofilename);
                flushProfileCache();
                final String msg = INTRES.getLocalizedMessage("ra.renamedprofile", oldprofilename, newprofilename);
                logSession.log(admin, admin.getCaId(), LogConstants.MODULE_RA, new Date(), null, null,
                        LogConstants.EVENT_INFO_ENDENTITYPROFILE, msg);
            }
View Full Code Here

  }

  public void testEndEntityProfileData() {
    LOG.trace(">testEndEntityProfileData");
    logMemStats();
    EndEntityProfileData entity = new EndEntityProfileData();
    entity.setDataUnsafe(HASHMAP_200K);
    entity.setId(BOGUS_INTEGER);
    entity.setProfileName(VARCHAR_250B);
    entity.setRowProtection(CLOB_10KiB);
    entity.setRowVersion(0);
    storeAndRemoveEntity(entity);
    LOG.trace("<testEndEntityProfileData");
  }
View Full Code Here

TOP

Related Classes of org.ejbca.core.ejb.ra.raadmin.EndEntityProfileData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.