Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

Commit

Permalink
feat: Allows to define permission to publish on a sharding tag
Browse files Browse the repository at this point in the history
  • Loading branch information
aelamrani authored and NicolasGeraud committed Apr 23, 2019
1 parent bd74697 commit b7aaeb7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public Tag update(Tag tag) throws TechnicalException {
//Update
tagMongo.setName(tag.getName());
tagMongo.setDescription(tag.getDescription());
tagMongo.setRestrictedGroups(tag.getRestrictedGroups());

TagMongo tagMongoUpdated = internalTagRepo.save(tagMongo);
return mapper.map(tagMongoUpdated, Tag.class);
Expand All @@ -111,13 +112,7 @@ public void delete(String tagId) throws TechnicalException {
public Set<Tag> findAll() throws TechnicalException {
final List<TagMongo> tags = internalTagRepo.findAll();
return tags.stream()
.map(tagMongo -> {
final Tag tag = new Tag();
tag.setId(tagMongo.getId());
tag.setName(tagMongo.getName());
tag.setDescription(tagMongo.getDescription());
return tag;
})
.map(tagMongo -> mapper.map(tagMongo, Tag.class))
.collect(Collectors.toSet());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;
import java.util.Objects;

/**
Expand All @@ -29,10 +30,9 @@ public class TagMongo {

@Id
private String id;

private String name;

private String description;
private List<String> restrictedGroups;

public String getId() {
return id;
Expand All @@ -58,6 +58,14 @@ public void setDescription(String description) {
this.description = description;
}

public List<String> getRestrictedGroups() {
return restrictedGroups;
}

public void setRestrictedGroups(List<String> restrictedGroups) {
this.restrictedGroups = restrictedGroups;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -77,6 +85,7 @@ public String toString() {
"id='" + id + '\'' +
", name='" + name + '\'' +
", description='" + description + '\'' +
", restrictedGroups=" + restrictedGroups +
'}';
}
}
Empty file.

0 comments on commit b7aaeb7

Please sign in to comment.