Commit e0c302e6 authored by Ioannis Kalyvas's avatar Ioannis Kalyvas
Browse files

no message

parent f2bfd402
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,3 +33,4 @@ final/
temp/
*.jar
*.lst
dmp-frontend/.vscode/
+46 −0
Original line number Diff line number Diff line
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;
    }
}
+49 −0
Original line number Diff line number Diff line
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;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.jpa.hibernatequeryablelist.QueryableHibernateList;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Content;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.UUID;
@@ -27,6 +28,7 @@ public class ContentDaoImpl extends DatabaseAccess<Content> implements ContentDa
    }

    @Override
    @Async
    public CompletableFuture<Content> createOrUpdateAsync(Content item) {
        return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
    }
Loading