add created, updated in DmpReference
This commit is contained in:
parent
e4203a3bb4
commit
7508cf8698
|
@ -5,6 +5,7 @@ import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -26,6 +27,15 @@ public class DmpReferenceEntity {
|
||||||
|
|
||||||
@Column(name = "data")
|
@Column(name = "data")
|
||||||
private String data;
|
private String data;
|
||||||
|
|
||||||
|
@Column(name = "created_at", nullable = false)
|
||||||
|
private Instant createdAt;
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "updated_at", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
public static final String _data = "data";
|
public static final String _data = "data";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
@ -59,4 +69,20 @@ public class DmpReferenceEntity {
|
||||||
public void setData(String data) {
|
public void setData(String data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.model;
|
package eu.eudat.model;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DmpReference {
|
public class DmpReference {
|
||||||
|
@ -16,6 +17,13 @@ public class DmpReference {
|
||||||
private String data;
|
private String data;
|
||||||
public static final String _data = "data";
|
public static final String _data = "data";
|
||||||
|
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -47,4 +55,12 @@ public class DmpReference {
|
||||||
public void setData(String data) {
|
public void setData(String data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() { return createdAt;}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {this.createdAt = createdAt;}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {return updatedAt;}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {this.updatedAt = updatedAt;}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,8 @@ public class DmpReferenceBuilder extends BaseBuilder<DmpReference, DmpReferenceE
|
||||||
DmpReference m = new DmpReference();
|
DmpReference m = new DmpReference();
|
||||||
if (fields.hasField(this.asIndexer(DmpReference._id))) m.setId(d.getId());
|
if (fields.hasField(this.asIndexer(DmpReference._id))) m.setId(d.getId());
|
||||||
if (fields.hasField(this.asIndexer(DmpReference._data))) m.setData(d.getData());
|
if (fields.hasField(this.asIndexer(DmpReference._data))) m.setData(d.getData());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpReference._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpReference._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
|
||||||
if(!referenceFields.isEmpty() && referenceItemsMap != null && referenceItemsMap.containsKey(d.getReferenceId())){
|
if(!referenceFields.isEmpty() && referenceItemsMap != null && referenceItemsMap.containsKey(d.getReferenceId())){
|
||||||
m.setReference(referenceItemsMap.get(d.getReferenceId()));
|
m.setReference(referenceItemsMap.get(d.getReferenceId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.query;
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
import eu.eudat.data.DmpReferenceEntity;
|
import eu.eudat.data.DmpReferenceEntity;
|
||||||
|
import eu.eudat.model.DmpReference;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -14,6 +15,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -137,15 +139,19 @@ public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
||||||
item.setReferenceId(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._dmpId, UUID.class));
|
item.setReferenceId(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._dmpId, UUID.class));
|
||||||
item.setReferenceId(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._referenceId, UUID.class));
|
item.setReferenceId(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._referenceId, UUID.class));
|
||||||
item.setData(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._data, String.class));
|
item.setData(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._data, String.class));
|
||||||
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._createdAt, Instant.class));
|
||||||
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._updatedAt, Instant.class));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String fieldNameOf(FieldResolver item) {
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
if (item.match(DmpReferenceEntity._id)) return DmpReferenceEntity._id;
|
if (item.match(DmpReference._id)) return DmpReferenceEntity._id;
|
||||||
else if (item.prefix(DmpReferenceEntity._dmpId)) return DmpReferenceEntity._dmpId;
|
else if (item.prefix(DmpReference._dmp)) return DmpReferenceEntity._dmpId;
|
||||||
else if (item.prefix(DmpReferenceEntity._referenceId)) return DmpReferenceEntity._referenceId;
|
else if (item.prefix(DmpReference._reference)) return DmpReferenceEntity._referenceId;
|
||||||
else if (item.match(DmpReferenceEntity._data)) return DmpReferenceEntity._data;
|
else if (item.match(DmpReference._data)) return DmpReferenceEntity._data;
|
||||||
|
else if (item.match(DmpReference._createdAt)) return DmpReferenceEntity._createdAt;
|
||||||
|
else if (item.match(DmpReference._updatedAt)) return DmpReferenceEntity._updatedAt;
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue