this.rootProjectId = guessRootProjectId(resource, parent);
}
+ public Snapshot(ResourceModel resource, boolean last, String status, Date date) {
+ this();
+ setResource(resource);
+ this.status = status;
+ this.last = last;
+ this.createdAt = date.getTime();
+ }
+
private static Integer guessRootProjectId(ResourceModel resource, Snapshot parent) {
Integer result;
if (parent == null) {
return session.save(this);
}
- public Snapshot(ResourceModel resource, boolean last, String status, Date date) {
- this();
- setResource(resource);
- this.status = status;
- this.last = last;
- this.createdAt = date.getTime();
- }
-
/**
* Insertion date (technical)
*
return longToDate(buildDate);
}
- public Long getBuildDateMs() {
- return buildDate;
- }
-
/**
* Insertion date (technical)
*
return this;
}
+ public Long getBuildDateMs() {
+ return buildDate;
+ }
+
public Snapshot setBuildDateMs(Long d) {
this.buildDate = d;
return this;
return longToDate(createdAt);
}
- public Long getCreatedAtMs() {
- return createdAt;
- }
-
public Snapshot setCreatedAt(Date createdAt) {
this.createdAt = dateToLong(createdAt);
return this;
}
+ public Long getCreatedAtMs() {
+ return createdAt;
+ }
+
public Snapshot setCreatedAtMs(Long createdAt) {
this.createdAt = createdAt;
return this;
return depth;
}
- public Integer getRootProjectId() {
- return rootProjectId;
- }
-
- public Snapshot setRootProjectId(Integer rootProjectId) {
- this.rootProjectId = rootProjectId;
- return this;
- }
-
/**
* Sets the depth of the snapshot
*
this.depth = depth;
}
+ public Integer getRootProjectId() {
+ return rootProjectId;
+ }
+
+ public Snapshot setRootProjectId(Integer rootProjectId) {
+ this.rootProjectId = rootProjectId;
+ return this;
+ }
+
public String getPeriod1Mode() {
return period1Mode;
}
return longToDate(period1Date);
}
- public Long getPeriod1DateMs() {
- return period1Date;
- }
-
/**
* For internal use.
*
return this;
}
+ public Long getPeriod1DateMs() {
+ return period1Date;
+ }
+
public Snapshot setPeriod1DateMs(Long period1Date) {
this.period1Date = period1Date;
return this;
return longToDate(period2Date);
}
- public Long getPeriod2DateMs() {
- return period2Date;
- }
-
/**
* For internal use.
*
return this;
}
+ public Long getPeriod2DateMs() {
+ return period2Date;
+ }
+
public Snapshot setPeriod2DateMs(Long period2Date) {
this.period2Date = period2Date;
return this;
return longToDate(period3Date);
}
- public Long getPeriod3DateMs() {
- return period3Date;
- }
-
/**
* For internal use.
*
return this;
}
+ public Long getPeriod3DateMs() {
+ return period3Date;
+ }
+
public Snapshot setPeriod3DateMs(Long period3Date) {
this.period3Date = period3Date;
return this;
return longToDate(period4Date);
}
- public Long getPeriod4DateMs() {
- return period4Date;
- }
-
/**
* For internal use.
*
return this;
}
+ public Long getPeriod4DateMs() {
+ return period4Date;
+ }
+
public Snapshot setPeriod4DateMs(Long period4Date) {
this.period4Date = period4Date;
return this;
return longToDate(period5Date);
}
- public Long getPeriod5DateMs() {
- return period5Date;
- }
-
/**
* For internal use.
*
return this;
}
+ public Long getPeriod5DateMs() {
+ return period5Date;
+ }
+
public Snapshot setPeriod5DateMs(Long period5Date) {
this.period5Date = period5Date;
return this;
period5Mode = s;
break;
default:
- throw new IndexOutOfBoundsException("Index of Snapshot.periodMode is between 1 and 5");
+ throw newPeriodIndexOutOfBoundsException("periodMode");
}
return this;
}
case 5:
return period5Mode;
default:
- throw new IndexOutOfBoundsException("Index of Snapshot.periodMode is between 1 and 5");
+ throw newPeriodIndexOutOfBoundsException("periodMode");
}
}
period5Param = s;
break;
default:
- throw new IndexOutOfBoundsException("Index of Snapshot.periodModeParameter is between 1 and 5");
+ throw newPeriodIndexOutOfBoundsException("periodParameter");
}
return this;
}
case 5:
return period5Param;
default:
- throw new IndexOutOfBoundsException("Index of Snapshot.periodModeParameter is between 1 and 5");
+ throw newPeriodIndexOutOfBoundsException("periodParameter");
}
}
period5Date = time;
break;
default:
- throw new IndexOutOfBoundsException("Index of Snapshot.periodDate is between 1 and 5");
+ throw newPeriodIndexOutOfBoundsException("periodDate");
}
return this;
}
period5Date = date;
break;
default:
- throw new IndexOutOfBoundsException("Index of Snapshot.periodDate is between 1 and 5");
+ throw newPeriodIndexOutOfBoundsException("periodDate");
}
return this;
}
case 5:
return longToDate(period5Date);
default:
- throw new IndexOutOfBoundsException("Index of Snapshot.periodDate is between 1 and 5");
+ throw newPeriodIndexOutOfBoundsException("periodDate");
}
}
case 5:
return period5Date;
default:
- throw new IndexOutOfBoundsException("Index of Snapshot.periodDate is between 1 and 5");
+ throw newPeriodIndexOutOfBoundsException("periodDate");
}
}
+ private IndexOutOfBoundsException newPeriodIndexOutOfBoundsException(String field) {
+ return new IndexOutOfBoundsException(String.format("Index of Snapshot.%s is between 1 and 5", field));
+ }
+
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Snapshot)) {