Skip to content

Package: KapuaUpdatableEntity

KapuaUpdatableEntity

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.model;
14:
15: import org.eclipse.kapua.entity.EntityPropertiesReadException;
16: import org.eclipse.kapua.entity.EntityPropertiesWriteException;
17: import org.eclipse.kapua.model.id.KapuaId;
18: import org.eclipse.kapua.model.id.KapuaIdAdapter;
19: import org.eclipse.kapua.model.xml.DateXmlAdapter;
20:
21: import javax.xml.bind.annotation.XmlElement;
22: import javax.xml.bind.annotation.XmlTransient;
23: import javax.xml.bind.annotation.XmlType;
24: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
25: import java.util.Date;
26: import java.util.Properties;
27:
28: /**
29: * {@link KapuaUpdatableEntity} definition.
30: *
31: * @since 1.0.0
32: */
33: @XmlType(propOrder = {
34: "modifiedOn",
35: "modifiedBy",
36: "optlock"
37: })
38: public interface KapuaUpdatableEntity extends KapuaEntity {
39:
40: /**
41: * Gets the last date that this {@link KapuaEntity} has been updated.
42: *
43: * @return the last date that this {@link KapuaEntity} has been updated.
44: * @since 1.0.0
45: */
46: @XmlElement(name = "modifiedOn")
47: @XmlJavaTypeAdapter(DateXmlAdapter.class)
48: Date getModifiedOn();
49:
50: /**
51: * Get the last identity {@link KapuaId} that has updated this {@link KapuaEntity}
52: *
53: * @return the last identity {@link KapuaId} that has updated this {@link KapuaEntity}
54: * @since 1.0.0
55: */
56: @XmlElement(name = "modifiedBy")
57: @XmlJavaTypeAdapter(KapuaIdAdapter.class)
58: KapuaId getModifiedBy();
59:
60: /**
61: * Gets the optlock
62: *
63: * @return the optlock
64: * @since 1.0.0
65: */
66: @XmlElement(name = "optlock")
67: int getOptlock();
68:
69: /**
70: * Sets the optlock
71: *
72: * @param optlock the optlock
73: * @since 1.0.0
74: */
75: void setOptlock(int optlock);
76:
77: /**
78: * Gets the attributes
79: *
80: * @return the attributes
81: * @throws EntityPropertiesReadException If there are error while reading {@link Properties}
82: */
83: @XmlTransient
84: Properties getEntityAttributes() throws EntityPropertiesReadException;
85:
86: /**
87: * Sets the attributes
88: *
89: * @param props the attributes
90: * @throws EntityPropertiesWriteException If there are error while writing {@link Properties}
91: * @since 1.0.0
92: */
93: void setEntityAttributes(Properties props) throws EntityPropertiesWriteException;
94:
95: /**
96: * Gets the property entities
97: *
98: * @return the property entities
99: * @throws EntityPropertiesReadException If there are error while reading {@link Properties}
100: * @since 1.0.0
101: */
102: @XmlTransient
103: Properties getEntityProperties() throws EntityPropertiesReadException;
104:
105: /**
106: * Sets the property entities
107: *
108: * @param props the property entities
109: * @throws EntityPropertiesWriteException If there are error while writing {@link Properties}
110: * @since 1.0.0
111: */
112: void setEntityProperties(Properties props) throws EntityPropertiesWriteException;
113: }