no message
parent
f2bfd402f8
commit
e0c302e67e
@ -0,0 +1,46 @@
|
||||
package eu.eudat.data.converters;
|
||||
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Converter;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/25/2018.
|
||||
*/
|
||||
@Converter
|
||||
public class DateToUTCConverter implements AttributeConverter<Date, Date> {
|
||||
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(Date attribute) {
|
||||
if(attribute == null) return null;
|
||||
DateFormat formatterIST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
formatterIST.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
String date = formatterIST.format(attribute);
|
||||
return formatterIST.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date convertToEntityAttribute(Date dbData) {
|
||||
if(dbData == null) return null;
|
||||
DateFormat formatterIST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
formatterIST.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
String date = formatterIST.format(dbData);
|
||||
return formatterIST.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.types.project.ProjectStateType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 10/2/2018.
|
||||
*/
|
||||
public class DatasetPublicCriteria extends Criteria<Dataset>{
|
||||
public ProjectStateType projectStatus;
|
||||
public List<UUID> projects;
|
||||
public List<UUID> datasetProfile;
|
||||
public List<String> dmpOrganisations;
|
||||
|
||||
public ProjectStateType getProjectStatus() {
|
||||
return projectStatus;
|
||||
}
|
||||
|
||||
public void setProjectStatus(ProjectStateType projectStatus) {
|
||||
this.projectStatus = projectStatus;
|
||||
}
|
||||
|
||||
public List<UUID> getProjects() {
|
||||
return projects;
|
||||
}
|
||||
|
||||
public void setProjects(List<UUID> projects) {
|
||||
this.projects = projects;
|
||||
}
|
||||
|
||||
public List<UUID> getDatasetProfile() {
|
||||
return datasetProfile;
|
||||
}
|
||||
|
||||
public void setDatasetProfile(List<UUID> datasetProfile) {
|
||||
this.datasetProfile = datasetProfile;
|
||||
}
|
||||
|
||||
public List<String> getDmpOrganisations() {
|
||||
return dmpOrganisations;
|
||||
}
|
||||
|
||||
public void setDmpOrganisations(List<String> dmpOrganisations) {
|
||||
this.dmpOrganisations = dmpOrganisations;
|
||||
}
|
||||
}
|