server/src/main/java/org/iri_research/renkan/models/ProjectRevision.java
branchuser_management
changeset 232 b7000ff4989b
parent 222 6ac00231ee34
child 298 2f35c2ae7de8
equal deleted inserted replaced
231:e65766f81b15 232:b7000ff4989b
     3 import java.util.ArrayList;
     3 import java.util.ArrayList;
     4 import java.util.Date;
     4 import java.util.Date;
     5 import java.util.List;
     5 import java.util.List;
     6 
     6 
     7 import org.bson.types.ObjectId;
     7 import org.bson.types.ObjectId;
       
     8 import org.joda.time.DateTime;
     8 import org.slf4j.Logger;
     9 import org.slf4j.Logger;
     9 import org.slf4j.LoggerFactory;
    10 import org.slf4j.LoggerFactory;
    10 import org.springframework.data.mongodb.core.mapping.DBRef;
    11 import org.springframework.data.mongodb.core.mapping.DBRef;
    11 import org.springframework.data.mongodb.core.mapping.Document;
    12 import org.springframework.data.mongodb.core.mapping.Document;
    12 
    13 
    23 
    24 
    24     @DBRef
    25     @DBRef
    25     private Project project;
    26     private Project project;
    26 
    27 
    27     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone = "GMT")
    28     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone = "GMT")
    28     private Date created;
    29     private DateTime created;
    29 
    30 
    30     // Nodes
    31     // Nodes
    31     private List<Node> nodes = new ArrayList<Node>();
    32     private List<Node> nodes = new ArrayList<Node>();
    32 
    33 
    33     // Edgess
    34     // Edgess
    47             String uri, Project project, int revision, Date created) {
    48             String uri, Project project, int revision, Date created) {
    48         super(id, title, description, uri, null);
    49         super(id, title, description, uri, null);
    49         this.project = project;
    50         this.project = project;
    50         this.revision = revision;
    51         this.revision = revision;
    51         if (created == null) {
    52         if (created == null) {
    52             this.created = new Date(System.currentTimeMillis());
    53             this.created = new DateTime(System.currentTimeMillis());
    53         }
    54         }
    54     }
    55     }
    55 
    56 
    56     public int getRevision() {
    57     public int getRevision() {
    57         return revision;
    58         return revision;
    68     public List<Edge> getEgdes() {
    69     public List<Edge> getEgdes() {
    69         return edges;
    70         return edges;
    70     }
    71     }
    71 
    72 
    72     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone = "GMT")
    73     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone = "GMT")
    73     public Date getCreated() {
    74     public DateTime getCreated() {
    74         return created;
    75         return created;
    75     }
    76     }
    76 
    77 
    77     @Override
    78     @Override
    78     protected String getRawKeyPart() {
    79     protected String getRawKeyPart() {
    79         return Long.toString(this.getCreated().getTime());
    80         return Long.toString(this.getCreated().getMillis());
    80     }
    81     }
    81 
    82 
    82 }
    83 }