Commit 28d830c5 authored by Martin Lowe's avatar Martin Lowe 🇨🇦
Browse files

#422 - Update datetime to use Java8 time rather than old Date object

parent be309639
......@@ -11,10 +11,9 @@
*/
package org.eclipsefoundation.react.bootstrap;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.Random;
......@@ -147,8 +146,7 @@ public class DataLoader {
wg.setParticipationLevel(
config.getParticipationLevels().get(r.nextInt(config.getParticipationLevels().size())));
// get a random instance of time
Instant inst = Instant.now().minus(r.nextInt(1000000), ChronoUnit.SECONDS);
wg.setEffectiveDate(new Date(inst.getEpochSecond()));
wg.setEffectiveDate(OffsetDateTime.now().minus(r.nextInt(1000000), ChronoUnit.SECONDS));
wg.setContact(generateContact(form, Optional.empty()));
wg.setForm(form);
wgs.add(wg);
......
......@@ -11,7 +11,7 @@
*/
package org.eclipsefoundation.react.dto;
import java.util.Date;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects;
......@@ -56,7 +56,7 @@ public class FormWorkingGroup extends BareNode implements TargetedClone<FormWork
@NotBlank(message = "Participation level cannot be blank")
private String participationLevel;
@NotNull(message = "Effective date cannot be blank")
private Date effectiveDate;
private OffsetDateTime effectiveDate;
// form entity
@OneToOne(targetEntity = MembershipForm.class)
......@@ -128,14 +128,14 @@ public class FormWorkingGroup extends BareNode implements TargetedClone<FormWork
/**
* @return the effectiveDate
*/
public Date getEffectiveDate() {
public OffsetDateTime getEffectiveDate() {
return effectiveDate;
}
/**
* @param effectiveDate the effectiveDate to set
*/
public void setEffectiveDate(Date effectiveDate) {
public void setEffectiveDate(OffsetDateTime effectiveDate) {
this.effectiveDate = effectiveDate;
}
......
package org.eclipsefoundation.react.model;
import java.util.Date;
import java.time.OffsetDateTime;
import javax.annotation.Nullable;
......@@ -16,7 +16,7 @@ public abstract class FormWorkingGroupData {
@Nullable
public abstract String getFormId();
public abstract String getParticipationLevel();
public abstract Date getEffectiveDate();
public abstract OffsetDateTime getEffectiveDate();
public abstract String getWorkingGroup();
public abstract ContactData getContact();
......@@ -30,7 +30,7 @@ public abstract class FormWorkingGroupData {
public abstract Builder setId(@Nullable String id);
public abstract Builder setFormId(@Nullable String formId);
public abstract Builder setParticipationLevel(String participationLevel);
public abstract Builder setEffectiveDate(Date effectiveDate);
public abstract Builder setEffectiveDate(OffsetDateTime effectiveDate);
public abstract Builder setWorkingGroup(String workingGroup);
public abstract Builder setContact(ContactData contact);
public abstract FormWorkingGroupData build();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment