Ejemplo n.º 1
0
  // Used only for Use Case 9.2, not an official KMIP operation
  public void deactivate(String uniqueIdentifier)
      throws KLMSItemNotFoundException, KLMSIllegalOperationException,
          KLMSObjectNotPreActiveException {
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();

    ManagedObject object = getObjectByUID(uniqueIdentifier, em);
    ((CryptographicObject) object).deactivate();

    em.getTransaction().commit();
    em.clear();
  }
Ejemplo n.º 2
0
  public String destroy(String uniqueIdentifier) throws KLMSItemNotFoundException {
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();

    ManagedObject object = getObjectByUID(uniqueIdentifier, em);

    if (object instanceof CryptographicObject) {
      ((CryptographicObject) object).destroy();
    } else {
      em.remove(object);
    }

    em.getTransaction().commit();
    em.clear();

    return object.getUniqueIdentifierValue();
  }