wffweb/src/main/java/com/webfirmframework/wffweb/tag/repository/TagRepository.java
public static AbstractHtml findTagById(final boolean parallel,
            final String id, final AbstractHtml... fromTags)
            throws NullValueException {

        if (id == null) {
            throw new NullValueException("The id should not be null");
        }

        if (fromTags == null) {
            throw new NullValueException("The fromTags should not be null");
        }

        final Collection<Lock> locks = getReadLocks(fromTags);
        for (final Lock lock : locks) {
            lock.lock();
        }

        try {
            final Stream<AbstractHtml> stream = getAllNestedChildrenIncludingParent(
                    parallel, fromTags);

            final Optional<AbstractHtml> any = stream.filter(child -> {

                final AbstractAttribute idAttr = child
                        .getAttributeByName(AttributeNameConstants.ID);

                return idAttr != null && id.equals(idAttr.getAttributeValue());

            }).findAny();

            if (any.isPresent()) {
                return any.get();
            }
            return null;
        } finally {
            for (final Lock lock : locks) {
                lock.unlock();
            }
        }
    }
public static AbstractHtml findTagById(final boolean parallel,
            final String id, final AbstractHtml... fromTags)
            throws NullValueException {

        if (id == null) {
            throw new NullValueException("The id should not be null");
        }

        if (fromTags == null) {
            throw new NullValueException("The fromTags should not be null");
        }

        final Collection<Lock> locks = getReadLocks(fromTags);
        for (final Lock lock : locks) {
            lock.lock();
        }

        try {
            final Stream<AbstractHtml> stream = getAllNestedChildrenIncludingParent(
                    parallel, fromTags);

            final Optional<AbstractHtml> any = stream.filter(child -> {

                final AbstractAttribute idAttr = child
                        .getAttributeByName(AttributeNameConstants.ID);

                return idAttr != null && id.equals(idAttr.getAttributeValue());

            }).findAny();

            if (any.isPresent()) {
                return any.get();
            }
            return null;
        } finally {
            for (final Lock lock : locks) {
                lock.unlock();
            }
        }
    }
Finds and returns the first tag matching with the given id.

@param parallel
true to internally use parallel stream. If true it
will split the finding task to different batches and
will execute the batches in different threads in
parallel consuming all CPUs. It will perform faster
in finding from extremely large number of tags but at
the same time it will less efficient in finding from
small number of tags.
@param id
the value of id attribute.
@param fromTags
from the given tags and its nested children the
finding to be done.
@return the first found tag with the given id
@throws NullValueException
if the {@code id} or {@code fromTags} is
null
@since 3.0.0
@author WFF