Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into
Browse files Browse the repository at this point in the history
EA-3720_zoho_eu_migration
  • Loading branch information
gsergiu committed Feb 22, 2024
2 parents de73011 + 277c90c commit 12626f8
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 28 deletions.

This file was deleted.

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 @@ -15,6 +15,7 @@
import dev.morphia.annotations.Id;
import dev.morphia.annotations.IndexOptions;
import dev.morphia.annotations.Indexed;
import dev.morphia.annotations.Transient;
import eu.europeana.entitymanagement.utils.VocabularyWatcher;

@JsonIgnoreProperties(ignoreUnknown = true)
Expand All @@ -26,12 +27,13 @@
*/
public class Vocabulary {

private String type = "Vocabulary";
@Transient
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 +77,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,6 @@
package eu.europeana.entitymanagement.mongo.repository;

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

@Resource(name = AppConfigConstants.BEAN_EM_DATA_STORE)
Datastore datastore;

private static final String ID = "id";

/**
* 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 12626f8

Please sign in to comment.