-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
europeanaRole field added to organizations
- Loading branch information
1 parent
8fe1082
commit f95d62c
Showing
32 changed files
with
529 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...definitions/src/main/java/eu/europeana/entitymanagement/definitions/VocabularyFields.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package eu.europeana.entitymanagement.definitions; | ||
|
||
// Collection field names | ||
public class VocabularyFields { | ||
|
||
private VocabularyFields() { | ||
// private constructor to prevent instantiation | ||
} | ||
|
||
public static final String VOCABULARY_URI = "vocabularyUri"; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
...definitions/src/main/java/eu/europeana/entitymanagement/definitions/model/Vocabulary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package eu.europeana.entitymanagement.definitions.model; | ||
|
||
import static eu.europeana.entitymanagement.vocabulary.WebEntityFields.IN_SCHEME; | ||
import static eu.europeana.entitymanagement.vocabulary.WebEntityFields.PREF_LABEL; | ||
import java.util.Date; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.bson.types.ObjectId; | ||
import com.fasterxml.jackson.annotation.JsonGetter; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonSetter; | ||
import dev.morphia.annotations.EntityListeners; | ||
import dev.morphia.annotations.Id; | ||
import dev.morphia.annotations.IndexOptions; | ||
import dev.morphia.annotations.Indexed; | ||
import eu.europeana.entitymanagement.utils.VocabularyWatcher; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(value = JsonInclude.Include.NON_EMPTY) | ||
@dev.morphia.annotations.Entity("Vocabulary") | ||
@EntityListeners(VocabularyWatcher.class) | ||
public class Vocabulary { | ||
|
||
private String type = "Vocabulary"; | ||
|
||
@Id @JsonIgnore private ObjectId dbId; | ||
|
||
@Indexed(options = @IndexOptions(unique = true)) | ||
private String vocabularyUri; | ||
|
||
protected List<String> inScheme; | ||
|
||
protected Map<String, String> prefLabel; | ||
|
||
@JsonIgnore | ||
private Date created; | ||
|
||
@JsonIgnore | ||
private Date modified; | ||
|
||
public Vocabulary() { | ||
} | ||
|
||
public void setDbId(ObjectId dbId_param) { | ||
this.dbId = dbId_param; | ||
} | ||
|
||
public ObjectId getDbId() { | ||
return dbId; | ||
} | ||
|
||
public void setCreated(Date created) { | ||
this.created = created; | ||
} | ||
|
||
public Date getCreated() { | ||
return this.created; | ||
} | ||
|
||
public void setModified(Date modified) { | ||
this.modified = modified; | ||
} | ||
|
||
public Date getModified() { | ||
return this.modified; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("Vocabulary.vocabularyUri: %s", getVocabularyUri()); | ||
} | ||
|
||
@JsonGetter | ||
public String getVocabularyUri() { | ||
return vocabularyUri; | ||
} | ||
|
||
@JsonSetter | ||
public void setVocabularyUri(String vocabularyUri) { | ||
this.vocabularyUri = vocabularyUri; | ||
} | ||
|
||
@JsonGetter(IN_SCHEME) | ||
public List<String> getInScheme() { | ||
return inScheme; | ||
} | ||
|
||
@JsonSetter(IN_SCHEME) | ||
public void setInScheme(List<String> inScheme) { | ||
this.inScheme = inScheme; | ||
} | ||
|
||
@JsonGetter(PREF_LABEL) | ||
public Map<String, String> getPrefLabel() { | ||
return prefLabel; | ||
} | ||
|
||
@JsonSetter(PREF_LABEL) | ||
public void setPrefLabel(Map<String, String> prefLabel) { | ||
this.prefLabel = prefLabel; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ment-definitions/src/main/java/eu/europeana/entitymanagement/utils/VocabularyWatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package eu.europeana.entitymanagement.utils; | ||
|
||
import java.util.Date; | ||
import dev.morphia.annotations.PrePersist; | ||
import eu.europeana.entitymanagement.definitions.model.Vocabulary; | ||
|
||
/** Watches for Database operations on the Vocabulary collection */ | ||
public class VocabularyWatcher { | ||
|
||
/** | ||
* Invoked by Morphia when creating / updating a Vocabulary. Sets the created/modified time. | ||
* @param record Vocabulary | ||
*/ | ||
@PrePersist | ||
void prePersist(Vocabulary vocab) { | ||
Date now = new Date(); | ||
if (vocab.getCreated() == null) { | ||
vocab.setCreated(now); | ||
} | ||
vocab.setModified(now); | ||
} | ||
} |
Oops, something went wrong.