
org.nuiton.topia.persistence.TopiaEntity Maven / Gradle / Ivy
The newest version!
package org.nuiton.topia.persistence;
/*
* #%L
* ToPIA Extension :: API
* %%
* Copyright (C) 2018 - 2022 Ultreia.io
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* .
* #L%
*/
import java.io.Serializable;
import java.util.Date;
/**
*
* The TopiaEntity is the main interface for each generated entity.
*
*
* An entity is just a persistent bean mapped with Hibernate. The manipulation on entities (create, update, delete,
* find) is made by the associated {@link org.nuiton.topia.persistence.TopiaDao}.
*
* Setter methods have to be used only in internal. They are in the interface to make easier their usages in internal.
*
* @author Benjamin Poussin - [email protected]
* @author Florian Desbois- [email protected]
*/
public interface TopiaEntity extends Serializable {
String PROPERTY_TOPIA_ID = "topiaId";
/**
* @deprecated since 3.0, will be removed in 3.1, use {@link TopiaEntity#PROPERTY_TOPIA_ID} instead
*/
@Deprecated
String TOPIA_ID = PROPERTY_TOPIA_ID;
String PROPERTY_TOPIA_CREATE_DATE = "topiaCreateDate";
/**
* @deprecated since 3.0, will be removed in 3.1, use {@link TopiaEntity#PROPERTY_TOPIA_CREATE_DATE} instead
*/
@Deprecated
String TOPIA_CREATE_DATE = PROPERTY_TOPIA_CREATE_DATE;
String PROPERTY_TOPIA_VERSION = "topiaVersion";
/**
* @deprecated since 3.0, will be removed in 3.1, use {@link TopiaEntity#PROPERTY_TOPIA_VERSION} instead
*/
@Deprecated
String TOPIA_VERSION = PROPERTY_TOPIA_VERSION;
/**
* @deprecated since 3.0, will be removed in 3.1, unused
*/
@Deprecated
String COMPOSITE = "composite";
/**
* @deprecated since 3.0, will be removed in 3.1, unused
*/
@Deprecated
String AGGREGATE = "aggregate";
/**
* Unique technical Id of the entity. This id contains the fully qualified name of the entity interface. This id
* also has an index and is used to uniquely identify the entity in the database.
*
* @return the technical Id of the entity
*/
String getTopiaId();
/**
* Set the technical {@code id} of the entity. Make sure to use this method only for copy. The technical id is
* generated by ToPIA when the entity is persisted using the {@link org.nuiton.topia.persistence.TopiaDao#create()}
* methods.
*
* @param id technical id to set
*/
void setTopiaId(String id);
/**
* Technical property to keep versionning of the entity. The version is incremented on each change of the entity.
*
* @return the current version of the entity
*/
long getTopiaVersion();
/**
* Set the technical {@code version} of the entity. Make sure to use this method only for copy. The version is
* automatically incremented on entity changes.
*
* @param version technical version to set
*/
void setTopiaVersion(long version);
/**
* Technical date creation of the entity. This date doesn't change through time and was initialized on entity
* creation when using the {@link org.nuiton.topia.persistence.TopiaDao#create()} methods.
*
* @return the creation date of the entity
*/
Date getTopiaCreateDate();
/**
* Set the technical creation {@code date} of the entity. Make sure to use this method only for copy. This date is
* immutable and was created on entity creation.
*
* @param date technical create date to set
*/
void setTopiaCreateDate(Date date);
/**
* This method must be used to know if the current entity is present on the persistent support. If the entity is not
* yet persisted or if the entity has been removed, this method will return false.
*
* @return true if the entity is persisted and not yet deleted
* @since 3.0
*/
boolean isPersisted();
/**
* @return Is the entity was removed from persistent support ?
* @since 3.0
*/
boolean isDeleted();
/**
* Notifies the current entity instance than it has been removed from the persistent support.
*
* @since 3.0
*/
void notifyDeleted();
/**
* Route the entity using a {@code visitor}.
*
* @param visitor to used
*/
void accept(TopiaEntityVisitor visitor);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy