Package com.elasticinbox.core

Examples of com.elasticinbox.core.IllegalLabelException


      throw new ExistingLabelException("This is reserved label and can't be modified");
    }

    // check if label id exists
    if (!existingLabels.containsId(label.getId())) {
      throw new IllegalLabelException("Label does not exist");
    }

    // begin batch operation
    Mutator<String> mutator = createMutator(keyspace, strSe);
View Full Code Here


  @Override
  public void delete(final Mailbox mailbox, final Integer labelId)
  {
    // check if label reserved
    if(ReservedLabels.contains(labelId)) {
      throw new IllegalLabelException("This is reserved label and can't be modified");
    }

    // get message DAO object
    MessageDAO messageDAO = new CassandraMessageDAO(keyspace);
View Full Code Here

  @Override
  public void modify(Mailbox mailbox, List<UUID> messageIds, MessageModification mod)
  {
    // label "all" cannot be removed from message
    if (mod.getLabelsToRemove().contains(ReservedLabels.ALL_MAILS.getId())) {
      throw new IllegalLabelException("This label cannot be removed");
    }

    // begin batch operation
    ThrottlingMutator<String> mutator = new ThrottlingMutator<String>(keyspace, strSe,
        BatchConstants.BATCH_WRITES, BatchConstants.BATCH_WRITE_INTERVAL);
View Full Code Here

    {
      for (Entry<String, String> labelAttr : label.getAttributes().entrySet())
      {
        // custom label attribute should not contain separator char
        if (labelAttr.getKey().contains(CN_SEPARATOR)) {
          throw new IllegalLabelException("Invalid character detected in the custom label attribute name.");
        }

        String labelAttrKey = getLabelAttributeKey(label.getId(), labelAttr.getKey());
       
        if (labelAttr.getValue() != null && !labelAttr.getValue().isEmpty()) {
View Full Code Here

    while (existingLabels.contains(labelId))
    {
      if (attempts > MAX_NEW_LABEL_ID_ATTEMPTS)
      {
        // too many attempts to get new random id! too many labels?
        throw new IllegalLabelException("Too many labels");
      }

      labelId = LabelUtils.getNewLabelId();
      attempts++;
    }
View Full Code Here

   */
  public static void validateLabelName(final String labelName, final LabelMap existingLabels)
  {
    // check total length of label
    if (labelName.length() > LabelConstants.MAX_LABEL_NAME_LENGTH) {
      throw new IllegalLabelException("Label name exceeds maximum allowed length");
    }

    // check if label already exists
    if (existingLabels.containsName(labelName)) {
      throw new ExistingLabelException("Label with this name already exists");
    }

    // check if starts with reserved label
    for (Label l : ReservedLabels.getAll())
    {
      if (labelName.startsWith(l.getName() + LabelConstants.NESTED_LABEL_SEPARATOR.toString()))
        throw new IllegalLabelException("Netsted labels are not allowed under reserved labels");
    }

    if (labelName.contains(LabelConstants.NESTED_LABEL_SEPARATOR.toString() + LabelConstants.NESTED_LABEL_SEPARATOR.toString()))
    {
      throw new IllegalLabelException("Illegal use of nested label separator");
    }

    // check special symbols? for now we allow any symbol
  }
View Full Code Here

TOP

Related Classes of com.elasticinbox.core.IllegalLabelException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.