diff --git a/src/main/java/org/wikitolearn/wikirating/model/Process.java b/src/main/java/org/wikitolearn/wikirating/model/Process.java index 564ca69..eb2dbbe 100644 --- a/src/main/java/org/wikitolearn/wikirating/model/Process.java +++ b/src/main/java/org/wikitolearn/wikirating/model/Process.java @@ -1,103 +1,103 @@ package org.wikitolearn.wikirating.model; import org.neo4j.ogm.annotation.GraphId; import org.neo4j.ogm.annotation.Index; import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.Relationship; import org.neo4j.ogm.annotation.typeconversion.DateLong; import org.wikitolearn.wikirating.util.enums.ProcessStatus; import org.wikitolearn.wikirating.util.enums.ProcessType; import java.util.Date; import java.util.UUID; /** * This class represents a Process happened in the engine. * It has a definite type and can have different results. It is saved in the DB * as a Process vertex. * @author aletundo * @author valsdav */ @NodeEntity( label = "Process") public class Process { @GraphId private Long graphId; @Index(unique = true, primary = true) private String processId; private ProcessType processType; private ProcessStatus processStatus; @Relationship(type="PREVIOUS_PROCESS", direction = Relationship.OUTGOING) private Process previousProcess; @DateLong - private Date beginOfProcess; + private Date startOfProcess; @DateLong private Date endOfProcess; public Process() {} public Process(String processId, ProcessType processType, - ProcessStatus processStatus, Date beginOfProcess, Date endOfProcess) { + ProcessStatus processStatus, Date startOfProcess, Date endOfProcess) { this.processId = processId; this.processType = processType; this.processStatus = processStatus; - this.beginOfProcess = beginOfProcess; + this.startOfProcess = startOfProcess; this.endOfProcess = endOfProcess; } public Process(ProcessType processType){ this.processId = UUID.randomUUID().toString(); this.processType = processType; this.processStatus = ProcessStatus.ONGOING; - this.beginOfProcess = new Date(); + this.startOfProcess = new Date(); } public ProcessType getProcessType() { return processType; } public void setProcessType(ProcessType processType) { this.processType = processType; } public ProcessStatus getProcessStatus() { return processStatus; } public void setProcessStatus(ProcessStatus processStatus) { this.processStatus = processStatus; } public Process getPreviousProcess() { return previousProcess; } public void setPreviousProcess(Process previousProcess) { this.previousProcess = previousProcess; } - public Date getBeginOfProcess() { - return beginOfProcess; + public Date getStartOfProcess() { + return startOfProcess; } - public void setBeginOfProcess(Date beginOfProcess) { - this.beginOfProcess = beginOfProcess; + public void setStartOfProcess(Date startOfProcess) { + this.startOfProcess = startOfProcess; } public Date getEndOfProcess() { return endOfProcess; } public void setEndOfProcess(Date endOfProcess) { this.endOfProcess = endOfProcess; } @Override public String toString() { return "Process[" + "processId='" + processId + '\'' + ", processType=" + processType + ", processStatus=" + processStatus + - ", beginOfProcess=" + beginOfProcess + + ", startOfProcess=" + startOfProcess + ", endOfProcess=" + endOfProcess + ']'; } } diff --git a/src/main/java/org/wikitolearn/wikirating/service/ProcessService.java b/src/main/java/org/wikitolearn/wikirating/service/ProcessService.java index 6470efd..80fb0b8 100644 --- a/src/main/java/org/wikitolearn/wikirating/service/ProcessService.java +++ b/src/main/java/org/wikitolearn/wikirating/service/ProcessService.java @@ -1,57 +1,57 @@ package org.wikitolearn.wikirating.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.wikitolearn.wikirating.model.Process; import org.wikitolearn.wikirating.repository.ProcessRepository; import org.wikitolearn.wikirating.util.enums.ProcessStatus; import org.wikitolearn.wikirating.util.enums.ProcessType; import java.util.Date; /** * Created by valsdav on 29/03/17. */ @Service public class ProcessService { @Autowired private MetadataService metadataService; @Autowired private ProcessRepository processRepository; /** * This method creates a new process of the specified * type and adds it on the top of the processes chain. * @param type Type of process requested * @return returns the created process */ public Process createNewProcess(ProcessType type){ Process proc = new Process(type); metadataService.addProcess(proc); processRepository.save(proc); return proc; } /** * This method modify the status of the last opened process * and saves it. * @param status Final status of the process * @return returns the closed process */ public Process closeCurrentProcess(ProcessStatus status){ Process currentProcess = processRepository.getLastProcess(); currentProcess.setProcessStatus(status); currentProcess.setEndOfProcess(new Date()); processRepository.save(currentProcess); return currentProcess; } public Date getLastProcessBeginDate(){ - return processRepository.getLastProcess().getBeginOfProcess(); + return processRepository.getLastProcess().getStartOfProcess(); } - public Date getLastProcessBeginDateByType(ProcessType type){ - return processRepository.getLastProcessByType(type).getBeginOfProcess(); + public Date getLastProcessStartDateByType(ProcessType type){ + return processRepository.getLastProcessByType(type).getStartOfProcess(); } }