Tabnine Logo
TagDefinitionApiException
Code IndexAdd Tabnine to your IDE (free)

How to use
TagDefinitionApiException
in
com.ning.billing.util.api

Best Java code snippets using com.ning.billing.util.api.TagDefinitionApiException (Showing top 5 results out of 315)

origin: com.ning.billing/killbill-util

  @Override
  protected TagDefinitionApiException generateAlreadyExistsException(final TagDefinitionModelDao entity, final InternalCallContext context) {
    return new TagDefinitionApiException(ErrorCode.TAG_DEFINITION_ALREADY_EXISTS, entity.getId());
  }
}
origin: com.ning.billing/killbill-jaxrs

  @Override
  public Response toResponse(final TagDefinitionApiException exception) {
    if (exception.getCode() == ErrorCode.TAG_DEFINITION_ALREADY_EXISTS.getCode()) {
      return buildConflictingRequestResponse(exception, uriInfo);
    } else if (exception.getCode() == ErrorCode.TAG_DEFINITION_CONFLICTS_WITH_CONTROL_TAG.getCode()) {
      return buildConflictingRequestResponse(exception, uriInfo);
    } else if (exception.getCode() == ErrorCode.TAG_DEFINITION_DOES_NOT_EXIST.getCode()) {
      return buildNotFoundResponse(exception, uriInfo);
    } else if (exception.getCode() == ErrorCode.TAG_DEFINITION_IN_USE.getCode()) {
      return buildBadRequestResponse(exception, uriInfo);
    } else {
      return buildBadRequestResponse(exception, uriInfo);
    }
  }
}
origin: com.ning.billing/killbill-util

  @Override
  public Void inTransaction(final EntitySqlDaoWrapperFactory<EntitySqlDao> entitySqlDaoWrapperFactory) throws Exception {
    final TagDefinitionSqlDao tagDefinitionSqlDao = entitySqlDaoWrapperFactory.become(TagDefinitionSqlDao.class);
    // Make sure the tag definition exists
    final TagDefinitionModelDao tagDefinition = tagDefinitionSqlDao.getById(definitionId.toString(), context);
    if (tagDefinition == null) {
      throw new TagDefinitionApiException(ErrorCode.TAG_DEFINITION_DOES_NOT_EXIST, definitionId);
    }
    // Make sure it is not used currently
    if (tagDefinitionSqlDao.tagDefinitionUsageCount(definitionId.toString(), context) > 0) {
      throw new TagDefinitionApiException(ErrorCode.TAG_DEFINITION_IN_USE, definitionId);
    }
    // Delete it
    tagDefinitionSqlDao.markTagDefinitionAsDeleted(definitionId.toString(), context);
    postBusEventFromTransaction(tagDefinition, tagDefinition, ChangeType.DELETE, entitySqlDaoWrapperFactory, context);
    return null;
  }
});
origin: com.ning.billing/killbill-util

throw new TagDefinitionApiException(ErrorCode.TAG_DEFINITION_CONFLICTS_WITH_CONTROL_TAG, definitionName);
origin: com.ning.billing/killbill-util

  @Override
  public TagDefinitionModelDao inTransaction(final EntitySqlDaoWrapperFactory<EntitySqlDao> entitySqlDaoWrapperFactory) throws Exception {
    final TagDefinitionSqlDao tagDefinitionSqlDao = entitySqlDaoWrapperFactory.become(TagDefinitionSqlDao.class);
    // Make sure the tag definition doesn't exist already
    final TagDefinitionModelDao existingDefinition = tagDefinitionSqlDao.getByName(definitionName, context);
    if (existingDefinition != null) {
      throw new TagDefinitionApiException(ErrorCode.TAG_DEFINITION_ALREADY_EXISTS, definitionName);
    }
    // Create it
    final TagDefinitionModelDao tagDefinition = new TagDefinitionModelDao(context.getCreatedDate(), definitionName, description);
    tagDefinitionSqlDao.create(tagDefinition, context);
    // Post an event to the bus
    final boolean isControlTag = TagModelDaoHelper.isControlTag(tagDefinition.getName());
    final TagDefinitionInternalEvent tagDefinitionEvent;
    if (isControlTag) {
      tagDefinitionEvent = tagEventBuilder.newControlTagDefinitionCreationEvent(tagDefinition.getId(), tagDefinition,
                                           context.getAccountRecordId(), context.getTenantRecordId(), context.getUserToken());
    } else {
      tagDefinitionEvent = tagEventBuilder.newUserTagDefinitionCreationEvent(tagDefinition.getId(), tagDefinition,
                                          context.getAccountRecordId(), context.getTenantRecordId(), context.getUserToken());
    }
    try {
      bus.postFromTransaction(tagDefinitionEvent, entitySqlDaoWrapperFactory.getSqlDao());
    } catch (PersistentBus.EventBusException e) {
      log.warn("Failed to post tag definition creation event for tag " + tagDefinition.getId(), e);
    }
    return tagDefinition;
  }
});
com.ning.billing.util.apiTagDefinitionApiException

Most used methods

  • <init>
  • getCode

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • onRequestPermissionsResult (Fragment)
  • onCreateOptionsMenu (Activity)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JLabel (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now