use of io.apicurio.datamodels.core.models.common.Tag in project apicurio-data-models by Apicurio.
the class DeleteAllTagsCommand method undo.
/**
* @see io.apicurio.datamodels.cmd.ICommand#undo(io.apicurio.datamodels.core.models.Document)
*/
@Override
public void undo(Document document) {
LoggerCompat.info("[DeleteAllTagsCommand] Reverting.");
if (this._oldTags.size() == 0) {
return;
}
OasDocument odoc = (OasDocument) document;
if (this.isNullOrUndefined(document.tags)) {
odoc.tags = new ArrayList<>();
}
this._oldTags.forEach(oldTag -> {
Tag tag = document.createTag();
Library.readNode(oldTag, tag);
document.tags.add(tag);
});
}
use of io.apicurio.datamodels.core.models.common.Tag in project apicurio-data-models by Apicurio.
the class TagUniquenessValidationRule method visitTag.
/**
* @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitTag(io.apicurio.datamodels.core.models.common.Tag)
*/
@Override
public void visitTag(Tag node) {
List<Tag> tags = node.ownerDocument().tags;
int tcount = 0;
for (Tag tag : tags) {
if (equals(tag.name, node.name)) {
tcount++;
}
}
this.reportIf(tcount > 1, node, node.name, map("tagName", node.name));
}
Aggregations