-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EA-3236 add other functionality like datsource, repository, controlle…
…r and application. Also added interfaces
- Loading branch information
1 parent
6a844a1
commit 130793d
Showing
51 changed files
with
1,541 additions
and
251 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ | |
<maven.compiler.target>${java.version}</maven.compiler.target> | ||
</properties> | ||
|
||
|
||
</project> |
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 |
---|---|---|
|
@@ -3,4 +3,6 @@ | |
public interface Literal<T> { | ||
|
||
T getValue(); | ||
|
||
void setValue(T value); | ||
} |
6 changes: 6 additions & 0 deletions
6
record-api-definitions/src/main/java/eu/europeana/api/record/model/Agent.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,6 @@ | ||
package eu.europeana.api.record.model; | ||
|
||
public interface Agent { | ||
|
||
String getType(); | ||
} |
22 changes: 22 additions & 0 deletions
22
record-api-definitions/src/main/java/eu/europeana/api/record/model/Aggregation.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.api.record.model; | ||
|
||
import eu.europeana.api.record.datatypes.Literal; | ||
import eu.europeana.api.record.datatypes.ObjectReference; | ||
|
||
import java.util.List; | ||
|
||
public interface Aggregation { | ||
|
||
Literal<String> getType(); | ||
|
||
Literal<String> getIsShownBy(); | ||
|
||
List<ObjectReference> getHasViews(); | ||
|
||
void setType(Literal<String> type); | ||
|
||
void setIsShownBy(Literal<String> isShownBy); | ||
|
||
void setHasViews(List<ObjectReference> hasViews); | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
record-api-definitions/src/main/java/eu/europeana/api/record/model/EdmEntity.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,8 @@ | ||
package eu.europeana.api.record.model; | ||
|
||
public interface EdmEntity { | ||
|
||
String getAbout(); | ||
|
||
void setAbout(String about); | ||
} |
16 changes: 16 additions & 0 deletions
16
record-api-definitions/src/main/java/eu/europeana/api/record/model/Entity.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,16 @@ | ||
package eu.europeana.api.record.model; | ||
|
||
import eu.europeana.api.record.datatypes.Literal; | ||
|
||
import java.util.Map; | ||
|
||
public interface Entity { | ||
|
||
String getAbout(); | ||
|
||
void setAbout(String about); | ||
|
||
Literal<String> getPrefLabel(String language); | ||
|
||
void setPrefLabel(Map<String, Literal<String>> prefLabel); | ||
} |
10 changes: 10 additions & 0 deletions
10
record-api-definitions/src/main/java/eu/europeana/api/record/model/EuropeanaAggregation.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,10 @@ | ||
package eu.europeana.api.record.model; | ||
|
||
import eu.europeana.api.record.datatypes.Literal; | ||
|
||
public interface EuropeanaAggregation { | ||
|
||
Literal<String> getType(); | ||
|
||
void setType(Literal<String> type); | ||
} |
8 changes: 8 additions & 0 deletions
8
record-api-definitions/src/main/java/eu/europeana/api/record/model/ProvidedCHO.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,8 @@ | ||
package eu.europeana.api.record.model; | ||
|
||
public interface ProvidedCHO { | ||
|
||
String getType(); | ||
|
||
void setType(String type); | ||
} |
52 changes: 52 additions & 0 deletions
52
record-api-definitions/src/main/java/eu/europeana/api/record/model/Proxy.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,52 @@ | ||
package eu.europeana.api.record.model; | ||
|
||
import eu.europeana.api.record.datatypes.Literal; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public interface Proxy { | ||
|
||
Literal<String> getType(); | ||
|
||
EuropeanaAggregation getProxyIn(); | ||
|
||
Literal<String> getProxyFor(); | ||
|
||
Literal<String> getTitle(String language); | ||
|
||
Literal<String> getCreator(String language); | ||
|
||
Literal<String> getAlternative(String language); | ||
|
||
Literal<String> getDescription(String language); | ||
|
||
Literal<String> getIdentifier(String language); | ||
|
||
List<Literal<String>> getTitles(); | ||
|
||
List<Literal<String>> getAlternatives(); | ||
|
||
List<Literal<String>> getCreators(); | ||
|
||
List<Literal<String>> getIdentifiers(); | ||
|
||
List<Literal<String>> getDescriptions(); | ||
|
||
void setType(Literal<String> type); | ||
|
||
void setTitle(Map<String, List<Literal<String>>> title); | ||
|
||
void setAlternative(Map<String, List<Literal<String>>> alternative); | ||
|
||
void setDescription(Map<String, List<Literal<String>>> description); | ||
|
||
void setCreator(Map<String, List<Literal<String>>> creator); | ||
|
||
void setIdentifier(Map<String, List<Literal<String>>> identifier); | ||
|
||
void setProxyIn(EuropeanaAggregation proxyIn); | ||
|
||
void setProxyFor(Literal<String> proxyFor); | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
record-api-definitions/src/main/java/eu/europeana/api/record/model/TechMetadata.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,8 @@ | ||
package eu.europeana.api.record.model; | ||
|
||
public interface TechMetadata { | ||
|
||
Long getFileByteSize(); | ||
|
||
void setFileByteSize(Long fileByteSize); | ||
} |
14 changes: 14 additions & 0 deletions
14
record-api-definitions/src/main/java/eu/europeana/api/record/model/WebResource.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,14 @@ | ||
package eu.europeana.api.record.model; | ||
|
||
import eu.europeana.api.record.datatypes.Literal; | ||
|
||
public interface WebResource { | ||
|
||
Literal<String> getType(); | ||
|
||
void setType(Literal<String> type); | ||
|
||
TechMetadata getTechMetadata(); | ||
|
||
void setTechMetadata(TechMetadata techMetadata); | ||
} |
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
99 changes: 99 additions & 0 deletions
99
record-api-impl/src/main/java/eu/europeana/api/record/Record.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,99 @@ | ||
package eu.europeana.api.record; | ||
|
||
import com.fasterxml.jackson.annotation.JsonGetter; | ||
import com.fasterxml.jackson.annotation.JsonSetter; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import dev.morphia.annotations.Entity; | ||
import dev.morphia.annotations.Id; | ||
import eu.europeana.api.record.impl.*; | ||
import eu.europeana.api.record.model.*; | ||
|
||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import static eu.europeana.api.record.vocabulary.RecordFields.*; | ||
|
||
@Entity | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(value = JsonInclude.Include.NON_EMPTY) | ||
// TODO add custom validators later once we know field validations | ||
public class Record { | ||
|
||
@Id | ||
private String id; | ||
|
||
// @JsonDeserialize(as = ProvidedCHOImpl.class) | ||
// private ProvidedCHO providedCHO; | ||
|
||
@JsonDeserialize(contentAs = ProxyImpl.class) | ||
private List<? extends Proxy> proxies; | ||
|
||
@JsonDeserialize(as = AggregationImpl.class) | ||
private Aggregation aggregation; | ||
|
||
@JsonDeserialize(contentAs = WebResourceImpl.class) | ||
private List<? extends WebResource> webResources; | ||
|
||
@JsonDeserialize(contentAs = AgentImpl.class) | ||
private List<? extends Agent> agents; | ||
|
||
protected Record() {} | ||
|
||
|
||
@JsonGetter(CONTEXT) | ||
public String getContext() { | ||
return EDM_CONTEXT; | ||
} | ||
|
||
@JsonGetter(ID) | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
@JsonSetter(ID) | ||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
// public ProvidedCHO getProvidedCHO() { | ||
// return providedCHO; | ||
// } | ||
// | ||
// public void setProvidedCHO(ProvidedCHO providedCHO) { | ||
// this.providedCHO = providedCHO; | ||
// } | ||
|
||
public List<? extends Proxy> getProxies() { | ||
return proxies; | ||
} | ||
|
||
public void setProxies(List<? extends Proxy> proxies) { | ||
this.proxies = proxies; | ||
} | ||
|
||
public Aggregation getAggregation() { | ||
return aggregation; | ||
} | ||
|
||
public void setAggregation(Aggregation aggregation) { | ||
this.aggregation = aggregation; | ||
} | ||
|
||
public List<? extends WebResource> getWebResources() { | ||
return webResources; | ||
} | ||
|
||
public void setWebResources(List<? extends WebResource> webResources) { | ||
this.webResources = webResources; | ||
} | ||
|
||
public List<? extends Agent> getAgents() { | ||
return agents; | ||
} | ||
|
||
public void setAgents(List<? extends Agent> agents) { | ||
this.agents = agents; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
record-api-impl/src/main/java/eu/europeana/api/record/codec/LiteralCodec.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,36 @@ | ||
package eu.europeana.api.record.codec; | ||
|
||
import eu.europeana.api.record.datatypes.Literal; | ||
import eu.europeana.api.record.impl.LiteralImpl; | ||
import org.bson.BsonReader; | ||
import org.bson.BsonWriter; | ||
import org.bson.codecs.Codec; | ||
import org.bson.codecs.DecoderContext; | ||
import org.bson.codecs.EncoderContext; | ||
|
||
public class LiteralCodec implements Codec<Literal> { | ||
|
||
// @Override | ||
// public void encode(final BsonWriter writer, final Literal<String> value, final EncoderContext encoderContext) { | ||
// writer.writeString(value.getValue()); | ||
// } | ||
|
||
@Override | ||
public void encode(BsonWriter bsonWriter, Literal literal, EncoderContext encoderContext) { | ||
bsonWriter.writeString(String.valueOf(literal.getValue())); | ||
|
||
} | ||
|
||
@Override | ||
public Class<Literal> getEncoderClass() { | ||
return Literal.class; | ||
} | ||
|
||
@Override | ||
public Literal<String> decode(final BsonReader reader, final DecoderContext decoderContext) { | ||
Literal<String> literal = new LiteralImpl<>(); | ||
literal.setValue(reader.readString()); | ||
return literal; | ||
} | ||
|
||
} |
Oops, something went wrong.