diff --git a/record-api-mongo/src/main/java/dev/morphia/query/ProjectionNew.java b/record-api-mongo/src/main/java/dev/morphia/query/ProjectionNew.java
index b5bb976..b7d58a6 100644
--- a/record-api-mongo/src/main/java/dev/morphia/query/ProjectionNew.java
+++ b/record-api-mongo/src/main/java/dev/morphia/query/ProjectionNew.java
@@ -8,8 +8,6 @@
import com.mongodb.lang.Nullable;
import dev.morphia.mapping.Mapper;
-import dev.morphia.query.FindOptions;
-import dev.morphia.query.Projection;
/**
* @author Hugo
@@ -34,6 +32,7 @@ public ProjectionNew(FindOptions options) {
* @return this
* @see Project Fields to Return from Query
*/
+ @Override
public FindOptions include(String... fields) {
if (projection == null) { projection = new Document(); }
for ( String field : fields ) {
@@ -41,7 +40,7 @@ public FindOptions include(String... fields) {
}
return super.include(fields);
}
-
+ @Override
@Nullable
public Document map(Mapper mapper, Class> type) {
return projection;
diff --git a/record-api-mongo/src/main/java/eu/europeana/api/record/db/repository/RecordRepository.java b/record-api-mongo/src/main/java/eu/europeana/api/record/db/repository/RecordRepository.java
index 114c6cd..c6d459c 100644
--- a/record-api-mongo/src/main/java/eu/europeana/api/record/db/repository/RecordRepository.java
+++ b/record-api-mongo/src/main/java/eu/europeana/api/record/db/repository/RecordRepository.java
@@ -1,7 +1,6 @@
package eu.europeana.api.record.db.repository;
import dev.morphia.Datastore;
-import dev.morphia.internal.DatastoreHolder;
import dev.morphia.query.FindOptions;
import dev.morphia.query.MorphiaCursor;
import dev.morphia.query.filters.Filter;
@@ -28,11 +27,11 @@ public class RecordRepository {
/**
* Saves the given record to the database.
*
- * @param record record to save
+ * @param recordItem record to save
* @return saved record
*/
- public ProvidedCHO save(ProvidedCHO record) {
- return datastore.save(record);
+ public ProvidedCHO save(ProvidedCHO recordItem) {
+ return datastore.save(recordItem);
}
@@ -74,11 +73,12 @@ public ProvidedCHO findById(String recordId) {
*/
public ProvidedCHO findById(String recordId, FindOptions opts) {
List filters = new ArrayList<>();
- filters.add(Filters.eq("id", recordId));
+ filters.add(Filters.eq("id", recordId).isValidating(false));
return datastore
.find(ProvidedCHO.class)
.filter(filters.toArray(Filter[]::new))
+ .disableValidation()
.iterator(opts)
.tryNext();
}
@@ -112,15 +112,5 @@ public Datastore getDatastore() {
return datastore;
}
- // public void save(EDMClass o)
-// {
-// if ( o != null ) {
-// long count = datastore.find(o.getClass()).filter(Filters.eq("id", o.getID())).count();
-// if ( count > 0 ) { return; }
-//
-// datastore.save(o);
-// }
-// }
-
}
diff --git a/record-api-web/src/main/java/eu/europeana/api/record/profile/ViewProfileRegistry.java b/record-api-web/src/main/java/eu/europeana/api/record/profile/ViewProfileRegistry.java
index 8d2b849..e3d1066 100644
--- a/record-api-web/src/main/java/eu/europeana/api/record/profile/ViewProfileRegistry.java
+++ b/record-api-web/src/main/java/eu/europeana/api/record/profile/ViewProfileRegistry.java
@@ -4,7 +4,6 @@
package eu.europeana.api.record.profile;
import java.lang.reflect.Field;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -26,7 +25,6 @@ public class ViewProfileRegistry
static {
//Metadata profiles
- newProfile("external");
Profile metaBasic = newProfile("meta.basic").expand("id").expandBase("proxies"
, "id", "type", "title", "description", "creator", "edmType"
@@ -165,13 +163,8 @@ public static Profile buildProfile(String... profileNames) {
public static FindOptions getProjection(String... profileNames) {
FindOptions opts = new FindOptions();
- Profile profile = buildProfile(profileNames);
- if ( !profile.isEmpty() ) {
- newProjection(opts).include(profile.toArray(String[]::new));
- }
- else if ( Arrays.asList(profileNames).contains("external") ) {
- opts.projection().exclude("proxies");
- }
+ Projection proj = newProjection(opts);
+ proj.include(buildProfile(profileNames).toArray(new String[] {}));
return opts;
}
@@ -244,12 +237,4 @@ protected Profile clean() {
return this;
}
}
-
- public static final void main(String[] args) {
- Profile profile = ViewProfileRegistry.buildProfile("meta.full", "prov.full", "media.full");
- profile.clean();
- for ( String field : profile ) {
- System.out.println(field);
- }
- }
}