congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TagApiException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.ning.billing.util.api.TagApiException
constructor

Best Java code snippets using com.ning.billing.util.api.TagApiException.<init> (Showing top 4 results out of 315)

origin: com.ning.billing/killbill-util

@Override
protected TagApiException generateAlreadyExistsException(final TagModelDao entity, final InternalCallContext context) {
  // Print the tag details, not the id here, as we throw this exception when checking if a tag already exists
  // by using the isSame(TagModelDao) method (see above)
  return new TagApiException(ErrorCode.TAG_ALREADY_EXISTS, entity.toString());
}
origin: com.ning.billing/killbill-jaxrs

@DELETE
@Path("/{accountId:" + UUID_PATTERN + "}/" + TAGS)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
public Response deleteTags(@PathParam(ID_PARAM_NAME) final String id,
              @QueryParam(QUERY_TAGS) final String tagList,
              @HeaderParam(HDR_CREATED_BY) final String createdBy,
              @HeaderParam(HDR_REASON) final String reason,
              @HeaderParam(HDR_COMMENT) final String comment,
              @javax.ws.rs.core.Context final HttpServletRequest request) throws TagApiException, AccountApiException {
  final CallContext callContext = context.createContext(createdBy, reason, comment, request);
  // Look if there is an AUTO_PAY_OFF for that account and check if the account has a default paymentMethod
  // If not we can't remove the AUTO_PAY_OFF tag
  final Collection<UUID> tagDefinitionUUIDs = getTagDefinitionUUIDs(tagList);
  boolean isTagAutoPayOff = false;
  for (final UUID cur : tagDefinitionUUIDs) {
    if (cur.equals(ControlTagType.AUTO_PAY_OFF.getId())) {
      isTagAutoPayOff = true;
      break;
    }
  }
  final UUID accountId = UUID.fromString(id);
  if (isTagAutoPayOff) {
    final Account account = accountUserApi.getAccountById(accountId, callContext);
    if (account.getPaymentMethodId() == null) {
      throw new TagApiException(ErrorCode.TAG_CANNOT_BE_REMOVED, ControlTagType.AUTO_PAY_OFF, " the account does not have a default payment method");
    }
  }
  return super.deleteTags(UUID.fromString(id), tagList, callContext);
}
origin: com.ning.billing/killbill-util

private TagDefinitionModelDao getTagDefinitionFromTransaction(final UUID tagDefinitionId, final EntitySqlDaoWrapperFactory<EntitySqlDao> entitySqlDaoWrapperFactory, final InternalTenantContext context) throws TagApiException {
  TagDefinitionModelDao tagDefintion = null;
  for (final ControlTagType t : ControlTagType.values()) {
    if (t.getId().equals(tagDefinitionId)) {
      tagDefintion = new TagDefinitionModelDao(t);
      break;
    }
  }
  if (tagDefintion == null) {
    final TagDefinitionSqlDao transTagDefintionSqlDao = entitySqlDaoWrapperFactory.become(TagDefinitionSqlDao.class);
    tagDefintion = transTagDefintionSqlDao.getById(tagDefinitionId.toString(), context);
  }
  if (tagDefintion == null) {
    throw new TagApiException(ErrorCode.TAG_DEFINITION_DOES_NOT_EXIST, tagDefinitionId);
  }
  return tagDefintion;
}
origin: com.ning.billing/killbill-util

  @Override
  public Void inTransaction(final EntitySqlDaoWrapperFactory<EntitySqlDao> entitySqlDaoWrapperFactory) throws Exception {
    final TagDefinitionModelDao tagDefinition = getTagDefinitionFromTransaction(tagDefinitionId, entitySqlDaoWrapperFactory, context);
    final TagSqlDao transactional = entitySqlDaoWrapperFactory.become(TagSqlDao.class);
    final List<TagModelDao> tags = transactional.getTagsForObject(objectId, objectType, context);
    TagModelDao tag = null;
    for (final TagModelDao cur : tags) {
      if (cur.getTagDefinitionId().equals(tagDefinitionId)) {
        tag = cur;
        break;
      }
    }
    if (tag == null) {
      throw new TagApiException(ErrorCode.TAG_DOES_NOT_EXIST, tagDefinition.getName());
    }
    // Delete the tag
    transactional.markTagAsDeleted(tag.getId().toString(), context);
    postBusEventFromTransaction(tag, tag, ChangeType.DELETE, entitySqlDaoWrapperFactory, context);
    return null;
  }
});
com.ning.billing.util.apiTagApiException<init>

Popular methods of TagApiException

  • getCode

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • setScale (BigDecimal)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • 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