org.springframework.data.jpa.domain.AbstractSerializable Maven / Gradle / Ivy
package org.springframework.data.jpa.domain;
import java.io.Serializable;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.util.StringUtils;
/**
* @see javax.persistence.AttributeOverride
* @see org.hibernate.annotations.OnDelete#(action = OnDeleteAction.CASCADE)
* @see org.springframework.data.domain.Auditable
* @see javax.persistence.AttributeConverter
* @see javax.persistence.EmbeddedId
* @see javax.persistence.Embeddable
* @see javax.persistence.Convert
* @see javax.persistence.Converter
* @see javax.persistence.PrePersist
* @see org.hibernate.annotations.DynamicUpdate
* @see org.hibernate.annotations.SelectBeforeUpdate
* @see javax.xml.bind.annotation.XmlRootElement
* @see javax.xml.bind.annotation.XmlAccessorType
*/
@EntityListeners(AuditingEntityListener.class)
@Access(AccessType.FIELD)
@MappedSuperclass
public abstract class AbstractSerializable implements Serializable {
private static final long serialVersionUID = -7110423642304887796L;
protected static final int COLUMN_LENGTH_ID = 36;
protected static final int COLUMN_LENGTH_USERNAME = 100;
protected static final int COLUMN_LENGTH_PASSWORD = 100;
protected static final int COLUMN_LENGTH_PHONE = 15;
protected static final int COLUMN_LENGTH_DESCRIPTION = 500;
protected static final int COLUMN_LENGTH_NAME = 150;
protected static final int COLUMN_LENGTH_KEY = 150;
protected static final int COLUMN_LENGTH_VALUE = 4096;
protected static final int COLUMN_LENGTH_TYPE = 25;
protected static final int COLUMN_LENGTH_ADDRESS = 45;
protected static final int COLUMN_LENGTH_URL = 2048;
protected String getID(Object... ids) {
return StringUtils.arrayToDelimitedString(ids, "_");
}
protected boolean isStatus(long origin, long status) {
return (origin & status) == status;
}
protected long setDisabled(long origin, long status) {
return origin & ~status;
}
protected long setEnabled(long origin, long status) {
return origin | status;
}
@Override
public abstract boolean equals(Object object);
@Override
public abstract int hashCode();
@Override
public abstract String toString();
}