@Override @SuppressWarnings("unchecked") public <T extends ModuleType> Collection<T> getByTags(Locale locale, String... tags) { Set<String> tagSet = tags != null ? new HashSet<String>(Arrays.asList(tags)) : null; Collection<T> result = new ArrayList<T>(20); forEach((provider, mType) -> { ModuleType mt = locale == null ? mType : ((ModuleTypeProvider) provider).getModuleType(mType.getUID(), locale); if (tagSet == null) { result.add((T) createCopy(mt)); } else if (mt.getTags().containsAll(tagSet)) { result.add((T) createCopy(mt)); } }); return result; }
@Override @SuppressWarnings("unchecked") public <T extends ModuleType> Collection<T> getByTag(String moduleTypeTag, Locale locale) { Collection<T> result = new ArrayList<T>(20); forEach((provider, mType) -> { ModuleType mt = locale == null ? mType : ((ModuleTypeProvider) provider).getModuleType(mType.getUID(), locale); Collection<String> tags = mt.getTags(); if (moduleTypeTag == null) { result.add((T) createCopy(mt)); } else if (tags.contains(moduleTypeTag)) { result.add((T) createCopy(mt)); } }); return result; }
protected static void fillProperties(final ModuleType from, final ModuleTypeDTO to) { to.uid = from.getUID(); to.visibility = from.getVisibility(); to.tags = from.getTags(); to.label = from.getLabel(); to.description = from.getDescription(); to.configDescriptions = ConfigDescriptionDTOMapper.mapParameters(from.getConfigurationDescriptions()); } }
moduleTypeProperty.set(1, getTagsRecord(moduleType.getTags())); moduleTypeContent.add(Utils.getRow(columnWidths, moduleTypeProperty));
CompositeTriggerType m = (CompositeTriggerType) mType; result = new CompositeTriggerType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getOutputs(), new ArrayList<>(m.getChildren())); TriggerType m = (TriggerType) mType; result = new TriggerType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getOutputs()); mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs(), new ArrayList<>(m.getChildren())); ConditionType m = (ConditionType) mType; result = new ConditionType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs()); mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs(), m.getOutputs(), new ArrayList<>(m.getChildren())); ActionType m = (ActionType) mType; result = new ActionType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs(), m.getOutputs()); } else { throw new IllegalArgumentException("Invalid template type:" + mType);