Ejemplo n.º 1
0
  @Override
  protected void postBusEventFromTransaction(
      final CustomFieldModelDao customField,
      final CustomFieldModelDao savedCustomField,
      final ChangeType changeType,
      final EntitySqlDaoWrapperFactory<EntitySqlDao> entitySqlDaoWrapperFactory,
      final InternalCallContext context)
      throws BillingExceptionBase {

    BusInternalEvent customFieldEvent = null;
    switch (changeType) {
      case INSERT:
        customFieldEvent =
            new DefaultCustomFieldCreationEvent(
                customField.getId(),
                customField.getObjectId(),
                customField.getObjectType(),
                context.getAccountRecordId(),
                context.getTenantRecordId(),
                context.getUserToken());
        break;
      case DELETE:
        customFieldEvent =
            new DefaultCustomFieldDeletionEvent(
                customField.getId(),
                customField.getObjectId(),
                customField.getObjectType(),
                context.getAccountRecordId(),
                context.getTenantRecordId(),
                context.getUserToken());
        break;
      default:
        return;
    }

    try {
      bus.postFromTransaction(customFieldEvent, entitySqlDaoWrapperFactory.getSqlDao());
    } catch (PersistentBus.EventBusException e) {
      log.warn("Failed to post tag event for custom field " + customField.getId().toString(), e);
    }
  }
Ejemplo n.º 2
0
 @Override
 protected CustomFieldApiException generateAlreadyExistsException(
     final CustomFieldModelDao entity, final InternalCallContext context) {
   return new CustomFieldApiException(ErrorCode.CUSTOM_FIELD_ALREADY_EXISTS, entity.getId());
 }