Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2629. #2648

Merged
merged 1 commit into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ List<Attachment> getAttachmentsByTag(ModelId modelId, Tag attachmentTag,
* @param tags
* @return
*/
List<Attachment> getAttachmentsByTags(ModelId modelId, Set<Tag> tags)
List<Attachment> getAttachmentsByTags(ModelId modelId, List<Tag> tags)
throws NotAuthorizedException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,9 @@ public List<Attachment> getAttachmentsByTag(final ModelId modelId, final Tag tag
}

@Override
public List<Attachment> getAttachmentsByTags(final ModelId modelId, final Set<Tag> tag) {
public List<Attachment> getAttachmentsByTags(final ModelId modelId, final List<Tag> tag) {
return getAttachments(modelId).stream()
.filter(attachment -> attachment.getTags().size() == tag.size())
.filter(attachment -> attachment.getTags().containsAll(tag))
.collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,20 @@
*/
package org.eclipse.vorto.repository.plugin.generator.impl;

import com.google.common.collect.Sets;
import com.google.common.collect.Lists;
import org.eclipse.vorto.model.ModelId;
import org.eclipse.vorto.repository.core.*;
import org.eclipse.vorto.repository.plugin.generator.GeneratedOutput;
import org.eclipse.vorto.repository.plugin.generator.GeneratorPluginConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.eclipse.vorto.model.ModelId;
import org.eclipse.vorto.repository.core.Attachment;
import org.eclipse.vorto.repository.core.FileContent;
import org.eclipse.vorto.repository.core.IModelRepository;
import org.eclipse.vorto.repository.core.IModelRepositoryFactory;
import org.eclipse.vorto.repository.core.IUserContext;
import org.eclipse.vorto.repository.core.ModelInfo;
import org.eclipse.vorto.repository.core.Tag;
import org.eclipse.vorto.repository.core.impl.PrivilegedUserContextProvider;
import org.eclipse.vorto.repository.plugin.generator.GeneratedOutput;
import org.eclipse.vorto.repository.plugin.generator.GeneratorPluginConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
* @author kolotu This class handles the querying and the saving of attachments that contain the
Expand Down Expand Up @@ -86,7 +80,7 @@ Optional<GeneratedOutput> getGeneratedOutputFromAttachment(ModelInfo modelInfo,

List<Attachment> attachments = repository
.getAttachmentsByTags(modelInfo.getId(),
Sets.newHashSet(
Lists.newArrayList(
GeneratedOutputAttachmentHandler.tagsForRequest(plugin, requestParams)));
if (Objects.nonNull(attachments)) {
return attachments.stream()
Expand Down