Skip to content

Commit

Permalink
org europena role field improved
Browse files Browse the repository at this point in the history
  • Loading branch information
SrdjanStevanetic committed Feb 22, 2024
1 parent f2eb5c5 commit 7b1e746
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ private VocabularyFields() {
// private constructor to prevent instantiation
}

public static final String URI = "uri";
public static final String ID = "id";

}
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public List<Vocabulary> getEuropeanaRole() {
europeanaRole=new ArrayList<>();
for(String roleId : europeanaRoleIds) {
Vocabulary vocab = new Vocabulary();
vocab.setUri(roleId);
vocab.setId(roleId);
europeanaRole.add(vocab);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
*/
public class Vocabulary {

private String type = "Vocabulary";
private String type = "Concept";

@Id @JsonIgnore private ObjectId dbId;

@Indexed(options = @IndexOptions(unique = true))
private String uri;
private String id;

protected List<String> inScheme;

Expand Down Expand Up @@ -75,17 +75,17 @@ public Date getModified() {

@Override
public String toString() {
return String.format("Vocabulary.uri: %s", getUri());
return String.format("Vocabulary.id: %s", getId());
}

@JsonGetter
public String getUri() {
return uri;
public String getId() {
return id;
}

@JsonSetter
public void setUri(String vocabularyUri) {
this.uri = vocabularyUri;
public void setId(String id) {
this.id = id;
}

@JsonGetter(IN_SCHEME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public XmlOrganizationImpl(Organization organization) {
List<XmlConceptImpl> orgXmlRole= new ArrayList<>();
for(Vocabulary vocab : orgRole) {
XmlConceptImpl xmlConcept = new XmlConceptImpl();
xmlConcept.setAbout(vocab.getUri());
xmlConcept.setAbout(vocab.getId());
xmlConcept.setPrefLabel(RdfXmlUtils.convertMapToXmlMultilingualString(vocab.getPrefLabel()));
xmlConcept.setInScheme(RdfXmlUtils.convertToRdfResource(vocab.getInScheme()));
orgXmlRole.add(xmlConcept);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package eu.europeana.entitymanagement.mongo.repository;

import static dev.morphia.query.experimental.filters.Filters.in;
import static eu.europeana.entitymanagement.definitions.VocabularyFields.URI;
import static eu.europeana.entitymanagement.definitions.VocabularyFields.ID;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
Expand All @@ -19,13 +19,13 @@ public class VocabularyRepository {
Datastore datastore;

/**
* retrieve records by their URI/id
* @param vocabularyUris
* retrieve records by their id
* @param vocabularyIds
* @return
*/
public List<Vocabulary> findByUri(List<String> vocabularyUris) {
public List<Vocabulary> findByUri(List<String> vocabularyIds) {
List<Filter> filters = new ArrayList<>();
filters.add(in(URI, vocabularyUris));
filters.add(in(ID, vocabularyIds));
return datastore.find(Vocabulary.class)
.filter(filters.toArray(Filter[]::new))
.iterator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void ensureDatabaseInitialization() throws ApplicationInitializationExcep
for(XmlBaseEntityImpl<?> xmlEntity : xmlEntities) {
XmlConceptImpl xmlConcept = (XmlConceptImpl) xmlEntity;
Vocabulary vocab = new Vocabulary();
vocab.setUri(xmlConcept.getAbout());
vocab.setId(xmlConcept.getAbout());
vocab.setInScheme(RdfXmlUtils.toStringList(xmlConcept.getInScheme()));
vocab.setPrefLabel(RdfXmlUtils.toLanguageMap(xmlConcept.getPrefLabel()));
roles.add(vocab);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void saveVocabulariesToMongo() throws Exception {
XmlConceptImpl xmlConcept = (XmlConceptImpl) xmlEntity;
Concept concept = xmlConcept.toEntityModel();
Vocabulary vocab = new Vocabulary();
vocab.setUri(concept.getEntityId());
vocab.setId(concept.getEntityId());
vocab.setInScheme(concept.getInScheme());
vocab.setPrefLabel(concept.getPrefLabel());
vocabularyRepo.save(vocab);
Expand Down

0 comments on commit 7b1e746

Please sign in to comment.