Example #1
0
  /**
   * Checks if a topic has any null unique identifiers (base name, name, and UUID)
   *
   * @param topic
   * @return <code>true</code> if any unique identifier is null, otherwise <code>false</code>
   */
  private boolean isValidTopic(JMSTopic topic) {
    if (StringUtils.isNotBlank(topic.getBaseName())
        && StringUtils.isNotBlank(topic.getName())
        && topic.getId() != null) {
      return true;
    }

    return false;
  }
Example #2
0
  /**
   * Whether or not a topic already exists in the space with the same base name or UUID.
   *
   * @param topic The topic to check if exists
   * @param transaction The transaction in which the check will take place
   * @return <code>true</code> if a match by either base name or UUID, otherwise <code>false</code>
   */
  private boolean topicExistsInSpace(JMSTopic topic, Transaction transaction) {
    try {
      JMSTopic template = new JMSTopic();
      template.setBaseName(topic.getBaseName());
      JMSTopic topicBaseNameMatch = (JMSTopic) space.readIfExists(template, transaction, 2000);

      template = new JMSTopic();
      template.setId(topic.getId());
      JMSTopic topicIdMatch = (JMSTopic) space.readIfExists(template, transaction, 2000);

      if (topicBaseNameMatch != null || topicIdMatch != null) {
        return true;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return false;
  }