コード例 #1
0
  @Override
  protected ConsumerSPI internalSaveChangesTo(Consumer consumer) throws RegistrationException {
    ConsumerSPI consumerSPI = super.internalSaveChangesTo(consumer);

    ChromatticSession session = persister.getSession();
    try {
      ConsumerMapping cm = session.findById(ConsumerMapping.class, consumer.getPersistentKey());
      cm.initFrom(consumer);
      persister.closeSession(true);
    } catch (Exception e) {
      persister.closeSession(false);
      throw new RegistrationException(e);
    }

    return consumerSPI;
  }
コード例 #2
0
  protected RegistrationSPI internalSaveChangesTo(Registration registration)
      throws RegistrationException {
    RegistrationSPI registrationSPI = super.internalSaveChangesTo(registration);

    ChromatticSession session = persister.getSession();
    try {
      RegistrationMapping cm =
          session.findById(RegistrationMapping.class, registration.getPersistentKey());
      cm.initFrom(registration);
      persister.closeSession(true);
    } catch (Exception e) {
      persister.closeSession(false);
      throw new RegistrationException(e);
    }

    return registrationSPI;
  }
コード例 #3
0
  @Override
  protected RegistrationSPI internalCreateRegistration(
      ConsumerSPI consumer, Map registrationProperties) throws RegistrationException {
    ChromatticSession session = persister.getSession();
    RegistrationSPI registration = null;
    try {
      ConsumerMapping cm = session.findById(ConsumerMapping.class, consumer.getPersistentKey());
      RegistrationMapping rm = cm.createAndAddRegistrationMappingFrom(null);
      registration = newRegistrationSPI(consumer, registrationProperties, rm.getPersistentKey());
      rm.initFrom(registration);
      persister.closeSession(true);
    } catch (Exception e) {
      persister.closeSession(false);
      throw new RegistrationException(e);
    }

    return registration;
  }
コード例 #4
0
 private void remove(String id, Class clazz) {
   ChromatticSession session = persister.getSession();
   session.remove(session.findById(clazz, id));
   persister.closeSession(true);
 }