Пример #1
0
  public void preUpdateTagByGuid(String guid, final RangerTag tag) throws Exception {
    if (StringUtils.isBlank(tag.getType())) {
      throw new Exception("Tag has no type");
    }

    RangerTag existing = tagStore.getTagByGuid(guid);
    if (existing == null) {
      throw new Exception("Attempt to update nonexistent tag, guid=" + guid);
    }

    tag.setId(existing.getId());
    tag.setGuid(existing.getGuid());
  }
Пример #2
0
  public RangerTag preCreateTag(final RangerTag tag) throws Exception {
    if (StringUtils.isBlank(tag.getType())) {
      throw new Exception("Tag has no type");
    }

    RangerTag ret = null;

    String guid = tag.getGuid();
    if (!StringUtils.isBlank(guid)) {
      ret = tagStore.getTagByGuid(guid);
    }

    return ret;
  }
Пример #3
0
  public void preUpdateTag(final Long id, final RangerTag tag) throws Exception {
    if (StringUtils.isBlank(tag.getType())) {
      throw new Exception("Tag has no type");
    }

    if (id == null) {
      throw new Exception("Invalid/null id");
    }

    RangerTag existing = tagStore.getTag(id);

    if (existing == null) {
      throw new Exception("Attempt to update nonexistant tag, id=" + id);
    }

    tag.setId(existing.getId());
    tag.setGuid(existing.getGuid());
  }