Package org.pipservices3.commons.data
Interface ITrackable
public interface ITrackable
Interface for data objects that can track their changes, including logical deletion.
### Example ###
public class MyData implements IStringIdentifiable, ITrackable {
private String id;
public String field1;
public int field2;
...
public String getId() {...}
public void setId(String newId) {...}
public ZonedDateTime getCreateTime(){...};
public void setCreateTime(){...};
public ZonedDateTime getLastChangeTime(){...};
public void setLastChangeTime(){...};
public boolean isDeleted(){...};
public void setDeleted(){...};
}
-
Method Summary
Modifier and TypeMethodDescriptionGets the time when the object was createdGets the last time when the object was changed (created, updated or deleted)boolean
Gets the logical deletion flagvoid
setCreateTime
(ZonedDateTime value) Sets a time when the object was createdvoid
setDeleted
(boolean value) Sets the logical deletion flagvoid
setLastChangeTime
(ZonedDateTime value) Sets the last time when the object was changed (created, updated or deleted)
-
Method Details
-
getCreateTime
ZonedDateTime getCreateTime()Gets the time when the object was created- Returns:
- UTC date and time then object was created
-
setCreateTime
Sets a time when the object was created- Parameters:
value
- UTC date and time then object was created
-
getLastChangeTime
ZonedDateTime getLastChangeTime()Gets the last time when the object was changed (created, updated or deleted)- Returns:
- UTC date and time when the last change occurred
-
setLastChangeTime
Sets the last time when the object was changed (created, updated or deleted)- Parameters:
value
- UTC date and time when the last change occurred
-
isDeleted
boolean isDeleted()Gets the logical deletion flag- Returns:
true
if the object was deleted andfalse
if the object is still active
-
setDeleted
void setDeleted(boolean value) Sets the logical deletion flag- Parameters:
value
- boolean value to set
-