Validates tag

@param tag tag
@throws MolgenisValidationException if tag is not valid
328132
@SuppressWarnings("MethodMayBeStatic")
  public void validate(Tag tag) {
    String relationIri = tag.getRelationIri();
    Relation relation = Relation.forIRI(relationIri);
    if (relation == null) {
      throw new MolgenisValidationException(
          new ConstraintViolation(format("Unknown relation IRI [%s]", relationIri)));
    }
  }
17604
public static void i(String tag, String msg) {
        if (logger != null && isLoggingEnabled(tag, INFO)) {
            logger.i(tag, msg);
        }
    }
1104625
public boolean isValid() {
    if (mValues.isEmpty()) {
      return false;
    }

    // Check required tags
    for (Tag tag : REQUIRED_TAGS) {
      if (!mValues.containsKey(tag)) {
        return false;
      }
    }

    return true;
  }
349721
public void validate() {
    if (metric == null || metric.isEmpty()) {
      throw new IllegalArgumentException("missing or empty metric");
    }

    if (id == null || id.isEmpty()) {
      throw new IllegalArgumentException("missing or empty id");
    }
    Query.validateId(id);

    if (time_offset != null) {
      DateTime.parseDateTimeString(time_offset, null);
    }
    
    if (aggregator != null && !aggregator.isEmpty()) {
      try {
        Aggregators.get(aggregator.toLowerCase());
      } catch (final NoSuchElementException e) {
        throw new IllegalArgumentException("Invalid aggregator");
      }
    }

    if (fill_policy != null) {
      fill_policy.validate();
    }
  }
157139
public void setTags(java.util.Collection<Tag> tags) {
        if (tags == null) {
            this.tags = null;
            return;
        }

        this.tags = new java.util.ArrayList<Tag>(tags);
    }
872408
@SuppressWarnings("unchecked")
    public T addTag(String tag) {
        if (this.tags_ == null) {
            tags_ = new ArrayList<>();
        }
        this.tags_.add(tag);
        return (T) this;
    }
620273
protected void addTag(IcyTag tag)
	{
		tags.put(tag.getName(), tag);
		fireTagParsed(this, tag);
	}
954218
public void writeTag(Tag tag) throws IOException {
        byte[] hb = tag.encode();
        bytesWritten += hb.length;
        dataFile.write(hb);
    }
1015736
public void setTag(String tag) throws IllegalArgumentException {
		if (tag == null
				|| (tag != null && (tag.length() < 1 || tag.length() > 32))) {
			throw new IllegalArgumentException(
					"The tag must not be null, the length between 1..32");
		}

		this.tag = tag;
	}
159322
static void validateLabelAttribute(EntityType entityType) {
    if (entityType.getLabelAttribute() != null && !entityType.getLabelAttribute().isVisible()) {
      throw new MolgenisValidationException(
          new ConstraintViolation(
              format(
                  "Label attribute [%s] of EntityType [%s] must be visible.",
                  entityType.getLabelAttribute().getName(), entityType.getId())));
    }

    if (!entityType.isAbstract()
        && !entityType.getIdAttribute().isVisible()
        && (entityType.getLabelAttribute() == null)) {
      throw new MolgenisValidationException(
          new ConstraintViolation(
              format(
                  "EntityType [%s] must define a label attribute because the identifier is hidden",
                  entityType.getId())));
    }
  }
1158444
@Deprecated
	@Override
	public void setTag(final String tag) {
		ComponentModel model = getOrCreateComponentModel();
		model.setTag(tag);
	}
963300
private boolean validateExistingTopicTags(final ITopicNode topicNode, final BaseTopicWrapper<?> topic) {
        // Ignore validating revision topics
        if (topicNode.getRevision() != null) {
            return true;
        }

        boolean valid = true;
        final List<String> tagNames = topicNode.getTags(true);
        if (!tagNames.isEmpty()) {
            final Set<TagWrapper> tags = new HashSet<TagWrapper>();
            for (final String tagName : tagNames) {
                // Check if the app should be shutdown
                if (isShuttingDown.get()) {
                    shutdown.set(true);
                    return false;
                }
                // Get the tag from the database
                TagWrapper tag = null;
                try {
                    tag = tagProvider.getTagByName(tagName);
                } catch (NotFoundException e) {

                }

                // Check that it exists
                if (tag != null) {
                    tags.add(tag);
                }
            }

            // Add all the existing tags
            if (topic.getTags() != null) {
                tags.addAll(topic.getTags().getItems());
            }

            // Check that the mutex value entered is correct
            final Map<Integer, List<TagWrapper>> mapping = EntityUtilities.getCategoryMappingFromTagList(tags);
            for (final Entry<Integer, List<TagWrapper>> catEntry : mapping.entrySet()) {
                final CategoryWrapper cat = categoryProvider.getCategory(catEntry.getKey());
                final List<TagWrapper> catTags = catEntry.getValue();

                // Check if the app should be shutdown
                if (isShuttingDown.get()) {
                    shutdown.set(true);
                    return false;
                }

                // Check that only one tag has been set if the category is mutually exclusive
                if (cat.isMutuallyExclusive() && catTags.size() > 1) {
                    log.error(String.format(ProcessorConstants.ERROR_TOPIC_TOO_MANY_CATS_MSG, topicNode.getLineNumber(), cat.getName(),
                            topicNode.getText()));
                    valid = false;
                }
            }
        }
        return valid;
    }
88763
public void writeTag(Tag<?> tag) throws IOException {
        String name = tag.getName();
        byte[] nameBytes = name.getBytes(NBTConstants.CHARSET.name());

        os.writeByte(tag.getType().getId());
        os.writeShort(nameBytes.length);
        os.write(nameBytes);

        if (tag.getType() == TagType.TAG_END) {
            throw new IOException("Named TAG_End not permitted.");
        }

        writeTagPayload(tag);
    }
1190837
static void validateEntityLabel(EntityType entityType) {
    String label = entityType.getLabel();
    if (label != null) {
      if (label.isEmpty()) {
        throw new MolgenisValidationException(
            new ConstraintViolation(
                format("Label of EntityType [%s] is empty", entityType.getId())));
      } else if (label.trim().equals("")) {
        throw new MolgenisValidationException(
            new ConstraintViolation(
                format("Label of EntityType [%s] contains only white space", entityType.getId())));
      }
    }
  }
661873
public void setTags(java.util.Collection<String> tags) {
        if (tags == null) {
            this.tags = null;
            return;
        }

        this.tags = new java.util.ArrayList<String>(tags);
    }
1356937
public static void e(String tag, String msg) {
        if (sLevel > LEVEL_ERROR) {
            return;
        }
        Log.e(tag, msg);
    }
702703
private static function validateTag($tag)
    {
        if (!is_string($tag)) {
            throw new \InvalidArgumentException(sprintf('RouteTags have to be strings, %s given', is_object($tag) ? get_class($tag) : gettype($tag)), 1512553153);
        }
        if (preg_match(self::PATTERN_TAG, $tag) !== 1) {
            throw new \InvalidArgumentException(sprintf('The given string "%s" is not a valid tag', $tag), 1511807639);
        }
    }