diff --git a/src/main/java/org/wikitolearn/wikirating/model/Process.java b/src/main/java/org/wikitolearn/wikirating/model/Process.java index d703c3d..e1ae056 100644 --- a/src/main/java/org/wikitolearn/wikirating/model/Process.java +++ b/src/main/java/org/wikitolearn/wikirating/model/Process.java @@ -1,72 +1,85 @@ package org.wikitolearn.wikirating.model; import org.neo4j.ogm.annotation.GraphId; 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.ProcessResult; import org.wikitolearn.wikirating.util.enums.ProcessType; import java.util.Date; /** * 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; - private Date timestamp; private ProcessType processType; private ProcessResult processResult; @Relationship(type="PREVIOUS_PROCESS", direction = Relationship.OUTGOING) private Process previousProcess; + @DateLong + private Date beginOfProcess; + @DateLong + private Date endOfProcess; public Process() {} - public Process(Date timestamp, ProcessType processType, ProcessResult processResult) { - this.timestamp = timestamp; + public Process( ProcessType processType, ProcessResult processResult, Date beginOfProcess, Date endOfProcess) { this.processType = processType; this.processResult = processResult; + this.beginOfProcess = beginOfProcess; + this.endOfProcess = endOfProcess; } public Process(ProcessType processType){ - this.timestamp = new Date(); this.processType = processType; this.processResult = ProcessResult.ONGOING; - } - - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; + this.beginOfProcess = new Date(); } public ProcessType getProcessType() { return processType; } public void setProcessType(ProcessType processType) { this.processType = processType; } public ProcessResult getProcessResult() { return processResult; } public void setProcessResult(ProcessResult processResult) { this.processResult = processResult; } public Process getPreviousProcess() { return previousProcess; } public void setPreviousProcess(Process previousProcess) { this.previousProcess = previousProcess; } + + public Date getBeginOfProcess() { + return beginOfProcess; + } + + public void setBeginOfProcess(Date beginOfProcess) { + this.beginOfProcess = beginOfProcess; + } + + public Date getEndOfProcess() { + return endOfProcess; + } + + public void setEndOfProcess(Date endOfProcess) { + this.endOfProcess = endOfProcess; + } } diff --git a/src/main/java/org/wikitolearn/wikirating/model/Revision.java b/src/main/java/org/wikitolearn/wikirating/model/Revision.java index 65eff8d..eed0d13 100644 --- a/src/main/java/org/wikitolearn/wikirating/model/Revision.java +++ b/src/main/java/org/wikitolearn/wikirating/model/Revision.java @@ -1,312 +1,326 @@ package org.wikitolearn.wikirating.model; import org.neo4j.ogm.annotation.GraphId; import org.neo4j.ogm.annotation.Index; import org.neo4j.ogm.annotation.NodeEntity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.neo4j.ogm.annotation.Relationship; +import org.neo4j.ogm.annotation.typeconversion.DateLong; +import java.util.Date; import java.util.Set; /** * This class handles the data of the Revision of a page. * Created by valsdav on 14/03/17. */ @JsonIgnoreProperties(ignoreUnknown = true) @NodeEntity( label = "Revision" ) public class Revision { @GraphId private Long graphId; private int revid; + private String lang; private int userid; private int parentid; + @DateLong + private Date timestamp; private long length; private double changeCoefficient; private double currentMeanVote; private double currentVotesReliability; private double currentNormalisesVotesReliability; private double totalMeanVote; private double totalVotesReliability; private double totalNormalisesVotesReliability; private boolean validated; - private String lang; @Index(unique = true, primary=true) private String langRevId; @Relationship(type="PREVIOUS_REVISION", direction = Relationship.OUTGOING) private Revision previousRevision; @Relationship(type="VOTE", direction = Relationship.INCOMING) private Set votes; /** * */ public Revision() {} /** - * @param revid - * @param userid - * @param parentid - * @param length - * @param changeCoefficient - * @param currentMeanVote - * @param currentVotesReliability - * @param currentNormalisesVotesReliability - * @param totalMeanVote - * @param totalVotesReliability - * @param totalNormalisesVotesReliability - * @param validated - * @param lang - */ + * @param revid + * @param userid + * @param parentid + * @param length + * @param changeCoefficient + * @param currentMeanVote + * @param currentVotesReliability + * @param currentNormalisesVotesReliability + * @param totalMeanVote + * @param totalVotesReliability + * @param totalNormalisesVotesReliability + * @param validated + * @param lang + * @param timestamp + */ public Revision(int revid, int userid, int parentid, long length, double changeCoefficient, double currentMeanVote, - double currentVotesReliability, double currentNormalisesVotesReliability, double totalMeanVote, - double totalVotesReliability, double totalNormalisesVotesReliability, boolean validated, String lang) { + double currentVotesReliability, double currentNormalisesVotesReliability, double totalMeanVote, + double totalVotesReliability, double totalNormalisesVotesReliability, boolean validated, String lang, Date timestamp) { this.revid = revid; this.userid = userid; this.parentid = parentid; this.length = length; this.changeCoefficient = changeCoefficient; this.currentMeanVote = currentMeanVote; this.currentVotesReliability = currentVotesReliability; this.currentNormalisesVotesReliability = currentNormalisesVotesReliability; this.totalMeanVote = totalMeanVote; this.totalVotesReliability = totalVotesReliability; this.totalNormalisesVotesReliability = totalNormalisesVotesReliability; this.validated = validated; this.lang = lang; - } + this.timestamp = timestamp; + } /** * @return the revid */ public int getRevid() { return revid; } /** * @param revid the revid to set */ public void setRevid(int revid) { this.revid = revid; } /** * @return the userid */ public int getUserid() { return userid; } /** * @param userid the userid to set */ public void setUserid(int userid) { this.userid = userid; } /** * @return the parentid */ public int getParentid() { return parentid; } /** * @param parentid the parentid to set */ public void setParentid(int parentid) { this.parentid = parentid; } /** * @return the length */ public long getLength() { return length; } /** * @param length the length to set */ public void setLength(long length) { this.length = length; } /** * @return the changeCoefficient */ public double getChangeCoefficient() { return changeCoefficient; } /** * @param changeCoefficient the changeCoefficient to set */ public void setChangeCoefficient(double changeCoefficient) { this.changeCoefficient = changeCoefficient; } /** * @return the currentMeanVote */ public double getCurrentMeanVote() { return currentMeanVote; } /** * @param currentMeanVote the currentMeanVote to set */ public void setCurrentMeanVote(double currentMeanVote) { this.currentMeanVote = currentMeanVote; } /** * @return the currentVotesReliability */ public double getCurrentVotesReliability() { return currentVotesReliability; } /** * @param currentVotesReliability the currentVotesReliability to set */ public void setCurrentVotesReliability(double currentVotesReliability) { this.currentVotesReliability = currentVotesReliability; } /** * @return the currentNormalisesVotesReliability */ public double getCurrentNormalisesVotesReliability() { return currentNormalisesVotesReliability; } /** * @param currentNormalisesVotesReliability the currentNormalisesVotesReliability to set */ public void setCurrentNormalisesVotesReliability(double currentNormalisesVotesReliability) { this.currentNormalisesVotesReliability = currentNormalisesVotesReliability; } /** * @return the totalMeanVote */ public double getTotalMeanVote() { return totalMeanVote; } /** * @param totalMeanVote the totalMeanVote to set */ public void setTotalMeanVote(double totalMeanVote) { this.totalMeanVote = totalMeanVote; } /** * @return the totalVotesReliability */ public double getTotalVotesReliability() { return totalVotesReliability; } /** * @param totalVotesReliability the totalVotesReliability to set */ public void setTotalVotesReliability(double totalVotesReliability) { this.totalVotesReliability = totalVotesReliability; } /** * @return the totalNormalisesVotesReliability */ public double getTotalNormalisesVotesReliability() { return totalNormalisesVotesReliability; } /** * @param totalNormalisesVotesReliability the totalNormalisesVotesReliability to set */ public void setTotalNormalisesVotesReliability(double totalNormalisesVotesReliability) { this.totalNormalisesVotesReliability = totalNormalisesVotesReliability; } /** * @return the validated */ public boolean isValidated() { return validated; } /** * @param validated the validated to set */ public void setValidated(boolean validated) { this.validated = validated; } /** * @return the lang */ public String getLang() { return lang; } /** * @param lang the lang to set */ public void setLang(String lang) { this.lang = lang; } /** * @return the langRevId */ public String getLangRevId() { return langRevId; } /** * @param langRevId the langRevId to set */ public void setLangRevId(String langRevId) { this.langRevId = langRevId; } /** * * @return */ public Revision getPreviousRevision() { return previousRevision; } /** * * @param previousRevision */ public void setPreviousRevision(Revision previousRevision) { this.previousRevision = previousRevision; } public Set getVotes() { return votes; } public void setVotes(Set votes) { this.votes = votes; } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ @Override public String toString() { return "Revision [graphId=" + graphId + ", revid=" + revid + ", userid=" + userid + ", parentid=" + parentid + ", length=" + length + ", changeCoefficient=" + changeCoefficient + ", currentMeanVote=" + currentMeanVote + ", currentVotesReliability=" + currentVotesReliability + ", currentNormalisesVotesReliability=" + currentNormalisesVotesReliability + ", totalMeanVote=" + totalMeanVote + ", totalVotesReliability=" + totalVotesReliability + ", totalNormalisesVotesReliability=" + totalNormalisesVotesReliability + ", validated=" + validated + ", lang=" + lang + ", langRevId=" + langRevId + "]"; } } \ No newline at end of file diff --git a/src/main/java/org/wikitolearn/wikirating/model/TemporaryVote.java b/src/main/java/org/wikitolearn/wikirating/model/TemporaryVote.java index 99298b7..aac422d 100644 --- a/src/main/java/org/wikitolearn/wikirating/model/TemporaryVote.java +++ b/src/main/java/org/wikitolearn/wikirating/model/TemporaryVote.java @@ -1,68 +1,81 @@ package org.wikitolearn.wikirating.model; -import org.neo4j.ogm.annotation.EndNode; import org.neo4j.ogm.annotation.GraphId; import org.neo4j.ogm.annotation.NodeEntity; +import org.neo4j.ogm.annotation.typeconversion.DateLong; + +import java.util.Date; /** * This entity represents a Vote that has to be validating, * connecting the user and the Revision after a fetch of the mediawiki api. * Created by valsdav on 24/03/17. */ @NodeEntity (label="TempVote") public class TemporaryVote { @GraphId private Long graphId; private double value; private double reliability; private int userid; private int revid; private String langRevId; + @DateLong + private Date timestamp; - public TemporaryVote(double value, double reliability, int userid, int revid, String langRevId) { + public TemporaryVote(double value, double reliability, int userid, int revid, String langRevId, Date timestamp) { this.value = value; this.reliability = reliability; this.userid = userid; this.revid = revid; this.langRevId = langRevId; + this.timestamp = timestamp; } public double getValue() { return value; } public void setValue(double value) { this.value = value; } public double getReliability() { return reliability; } public void setReliability(double reliability) { this.reliability = reliability; } public int getUserid() { return userid; } public void setUserid(int userid) { this.userid = userid; } public int getRevid() { return revid; } public void setRevid(int revid) { this.revid = revid; } public String getLangRevId() { return langRevId; } public void setLangRevId(String langRevId) { this.langRevId = langRevId; } + + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } } diff --git a/src/main/java/org/wikitolearn/wikirating/model/Vote.java b/src/main/java/org/wikitolearn/wikirating/model/Vote.java index d95cfbb..3c999be 100644 --- a/src/main/java/org/wikitolearn/wikirating/model/Vote.java +++ b/src/main/java/org/wikitolearn/wikirating/model/Vote.java @@ -1,86 +1,101 @@ /** * */ package org.wikitolearn.wikirating.model; -import com.oracle.webservices.internal.api.EnvelopeStyle; import org.neo4j.ogm.annotation.*; +import org.neo4j.ogm.annotation.typeconversion.DateLong; + +import java.util.Date; /** * @author aletundo, valsdav * */ @RelationshipEntity( type = "VOTE") public class Vote { @GraphId private Long graphId; private double value; private double reliability; + @DateLong + private Date timestamp; @StartNode private User user; @EndNode private Revision revision; + /** * */ public Vote() {} /** * @param value * @param reliability + * @param timestamp */ - public Vote(double value, double reliability) { + public Vote(double value, double reliability, Date timestamp) { this.value = value; this.reliability = reliability; + this.timestamp = timestamp; } /** * @return the value */ public double getValue() { return value; } /** * @param value the value to set */ public void setValue(double value) { this.value = value; } /** * @return the reliability */ public double getReliability() { return reliability; } /** * @param reliability the reliability to set */ public void setReliability(double reliability) { this.reliability = reliability; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Revision getRevision() { return revision; } public void setRevision(Revision revision) { this.revision = revision; } + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + /* (non-Javadoc) - * @see java.lang.Object#toString() - */ + * @see java.lang.Object#toString() + */ @Override public String toString() { return "Vote [value=" + value + ", reliability=" + reliability + "]"; } }