Skip to content

Commit

Permalink
add date to dataentry
Browse files Browse the repository at this point in the history
  • Loading branch information
firestar committed Oct 5, 2023
1 parent e0b290b commit bbbad9f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/nucleodb.app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'com.nucleodb'
version = '1.6.6'
version = '1.6.7'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/nucleodb.library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'com.nucleodb'
version = '1.8.1'
version = '1.8.2'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.UUID;

public class DataEntry implements Serializable, Comparable<DataEntry> {
Expand All @@ -17,18 +18,22 @@ public class DataEntry implements Serializable, Comparable<DataEntry> {
private JsonNode reference;
public Object data;
private transient String tableName;
private Date created;
private Date modified;

public DataEntry(Object obj) {
this.data = obj;
this.reference = Serializer.getObjectMapper().getOm().valueToTree(data);
this.key = UUID.randomUUID().toString();
this.created = new Date();
}

public DataEntry(Create create) throws ClassNotFoundException, JsonProcessingException {
this.data = Serializer.getObjectMapper().getOm().readValue(create.getData(), Class.forName(create.getMasterClass()));
this.version = create.getVersion();
this.reference = Serializer.getObjectMapper().getOm().valueToTree(data);
this.key = create.getKey();
this.created = new Date();
}


Expand All @@ -43,11 +48,13 @@ public DataEntry(DataEntry toCopy) {
}

public DataEntry() {
this.key = UUID.randomUUID().toString().replaceAll("-","");
this.key = UUID.randomUUID().toString();
this.created = new Date();
}

public DataEntry(String key) {
this.key = key;
this.created = new Date();
}

public String getKey(){
Expand All @@ -64,6 +71,7 @@ public long getVersion() {

public void versionIncrease(){
version+=1;
this.modified = new Date();
}

public void setVersion(long version) {
Expand Down Expand Up @@ -94,6 +102,14 @@ public void setTableName(String tableName) {
this.tableName = tableName;
}

public Date getCreated() {
return created;
}

public Date getModified() {
return modified;
}

@Override
public String toString() {
return "key='" + key;
Expand Down

0 comments on commit bbbad9f

Please sign in to comment.