Skip to content

Commit

Permalink
Merge pull request #2648 from bosch-io/2629_generator_cache_fix
Browse files Browse the repository at this point in the history
Fixes #2629.
  • Loading branch information
kolotu authored Oct 16, 2020
2 parents 387dbeb + 95e8b95 commit b626525
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
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

0 comments on commit b626525

Please sign in to comment.