import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.time.OffsetDateTime;
+import java.time.format.DateTimeFormatter;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
public class CompositeState {
@JsonProperty("cm-handle-state")
- private CmHandleState cmhandleState;
+ private CmHandleState cmHandleState;
@JsonProperty("lock-reason")
private LockReason lockReason;
@JsonProperty("datastores")
private DataStores dataStores;
+ /**
+ * Date and Time in the format of yyyy-MM-dd'T'HH:mm:ss.SSSZ
+ */
+ public static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+
+
+ /**
+ * This will specify the latest lock reason for a specific cm handle. If a cm handle is in a state other than LOCKED
+ * it specifies the last lock reason.
+ * This can be used to track retry attempts as part of the lock details.
+ */
@Data
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class LockReason {
@JsonProperty("reason")
- private String reason;
+ private LockReasonCategory lockReasonCategory;
@JsonProperty("details")
private String details;
@JsonProperty("operational")
private Operational operationalDataStore;
-
- @JsonProperty("running")
- private Running runningDataStore;
}
@Data
private String lastSyncTime;
}
+ /**
+ * The date and time format used for the cm handle sync state.
+ *
+ * @return the date and time in the format of yyyy-MM-dd'T'HH:mm:ss.SSSZ
+ */
+ public static String nowInSyncTimeFormat() {
+ return dateTimeFormatter.format(OffsetDateTime.now());
+ }
+
+ /**
+ * Sets the last updated date and time for the cm handle sync state.
+ */
+ public void setLastUpdateTimeNow() {
+ lastUpdateTime = CompositeState.nowInSyncTimeFormat();
+ }
+
}