Package com.aoindustries.aoserv.client
Class AoservObject<K,T extends AoservObject<K,T>>
java.lang.Object
com.aoindustries.aoserv.client.AoservObject<K,T>
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AoservReadable,AoservStreamable,AoservWritable
- Direct Known Subclasses:
BackupReport,BankTransaction,CachedObject,FileReplicationLog,FilesystemCachedObject,GlobalObject,Process,ServerStat,SpamMessage
public abstract class AoservObject<K,T extends AoservObject<K,T>>
extends Object
implements Row, AoservStreamable
An
AoservObject is the lowest level object
for all data in the system. Each AoservObject
belongs to a AoservTable, and each table
contains AoservObjects.- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDeprecated, for removal: This API element is subject to removal in a future version.Only required for implementation, do not use directly. -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompare(int i1, int i2) Deprecated.This method moved toComparatorUtils.compare(int, int)static intcompare(long l1, long l2) Deprecated.This method moved toComparatorUtils.compare(long, long)static intcompare(short s1, short s2) Deprecated.This method moved toComparatorUtils.compare(short, short)static <T extends Comparable<T>>
intcompare(T obj1, T obj2) Compares two objects allowing for nulls, sorts non-null before null.static intDeprecated.final intcompareTo(AoservConnector conn, AoservObject<?, ?> other, SqlExpression[] sortExpressions, boolean[] sortOrders) final intcompareTo(AoservConnector conn, Comparable<?> value, SqlExpression[] sortExpressions, boolean[] sortOrders) final intcompareTo(AoservConnector conn, Object[] objects, SqlExpression[] sortExpressions, boolean[] sortOrders) booleanprotected static Account.NamegetAccountingCode(AccountName accounting) null-safe accounting code conversion.final ObjectgetColumn(int i) protected abstract ObjectgetColumnImpl(int i) getColumns(AoservConnector connector) final intgetColumns(AoservConnector connector, List<Object> buff) protected static DomainLabelgetDomainLabel(DomainLabel domainLabel) null-safe domain label conversion.protected static DomainLabelsgetDomainLabels(DomainLabels domainLabels) null-safe domain labels conversion.protected static DomainNamegetDomainName(DomainName domainName) null-safe domain name conversion.protected static <B> BgetDto(DtoFactory<B> dtoFactory) null-safe getDto.protected static Emailnull-safe email conversion.protected static User.Gecosnull-safe GECOS conversion.protected static Group.NamegetGroupId(LinuxGroupName gid) null-safe group id conversion.protected static HashedKeygetHashedKey(HashedKey hashedKey) null-safe hashed key conversion.protected static HashedPasswordgetHashedPassword(HashedPassword hashedPassword) null-safe hashed password conversion.protected static HostAddressgetHostname(HostAddress hostname) null-safe hostname conversion.protected static InetAddressgetInetAddress(InetAddress inetAddress) null-safe inet address conversion.abstract KgetKey()protected static LinuxIdgetLinuxId(LinuxId lid) null-safe Linux id conversion.protected static User.NamegetLinuxUserName(LinuxUserName linuxUserName) null-safe Linux user name conversion.protected static MacAddressgetMacAddress(MacAddress macAddress) null-safe MAC address conversion.protected static Database.NamegetMysqlDatabaseName(MysqlDatabaseName databaseName) null-safe MySQL database name conversion.protected static Server.NamegetMysqlServerName(MysqlServerName serverName) null-safe MySQL server name conversion.protected static User.NamegetMysqlUserName(MysqlUserName mysqlUserId) null-safe MySQL user name conversion.protected static Portnull-safe port conversion.protected static Database.NamegetPostgresDatabaseName(PostgresDatabaseName databaseName) null-safe PostgreSQL database name conversion.protected static Server.NamegetPostgresServerName(PostgresServerName serverName) null-safe PostgreSQL server name conversion.protected static User.NamegetPostgresUserId(PostgresUserName postgresUserId) null-safe PostgreSQL user id conversion.abstract Table.TableIdfinal TablegetTableSchema(AoservConnector connector) protected static LonggetTimeMillis(Calendar datetime) null-safe conversion from Calendar to Long.protected static LonggetTimeMillis(Date date) null-safe conversion from Date to Long.protected static PosixPathgetUnixPath(PosixPath unixPath) null-safe Unix path conversion.protected static User.Namenull-safe user id conversion.inthashCode()abstract voidInitializes this object from the raw database contents.abstract voidread(StreamableInput in, AoservProtocol.Version protocolVersion) final voidread(StreamableInput in, String protocolVersion) Deprecated.This is maintained only for compatibility with theStreamableinterface.final StringtoString()toString()implementation that is allowed to throw exceptions.abstract voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion) final voidwrite(StreamableOutput out, String protocolVersion) Deprecated.This is maintained only for compatibility with theStreamableinterface.
-
Field Details
-
USE_SQL_DATA
public static final boolean USE_SQL_DATAEnables the use ofSQLData. This currently requires our forked PostgreSQL JDBC driver to function correctly. See Issue #641 for more details.- See Also:
-
USE_SQL_DATA_WRITE
public static final boolean USE_SQL_DATA_WRITEEnables the use ofSQLDataon writeObject. This currently requires our forked PostgreSQL JDBC driver to function correctly. See Pull request #1377 for more details.- See Also:
-
USE_ARRAY_OF_DOMAIN
public static final boolean USE_ARRAY_OF_DOMAINEnables the use of arrays of domains. This is currently not supported by PostgreSQL.- See Also:
-
-
Constructor Details
-
AoservObject
Deprecated, for removal: This API element is subject to removal in a future version.Only required for implementation, do not use directly.- See Also:
-
-
Method Details
-
compareIgnoreCaseConsistentWithEquals
Deprecated. -
compare
Deprecated.This method moved toComparatorUtils.compare(int, int) -
compare
Deprecated.This method moved toComparatorUtils.compare(short, short) -
compare
Deprecated.This method moved toComparatorUtils.compare(long, long) -
compare
Compares two objects allowing for nulls, sorts non-null before null. -
compareTo
public final int compareTo(AoservConnector conn, AoservObject<?, ?> other, SqlExpression[] sortExpressions, boolean[] sortOrders) throws IllegalArgumentException, SQLException, UnknownHostException, IOException -
compareTo
public final int compareTo(AoservConnector conn, Comparable<?> value, SqlExpression[] sortExpressions, boolean[] sortOrders) throws IllegalArgumentException, SQLException, UnknownHostException, IOException -
compareTo
public final int compareTo(AoservConnector conn, Object[] objects, SqlExpression[] sortExpressions, boolean[] sortOrders) throws IllegalArgumentException, SQLException, UnknownHostException, IOException -
getDto
null-safe getDto. -
getAccountingCode
null-safe accounting code conversion.- Throws:
ValidationException
-
getDomainLabel
null-safe domain label conversion.- Throws:
ValidationException
-
getDomainLabels
null-safe domain labels conversion.- Throws:
ValidationException
-
getDomainName
null-safe domain name conversion.- Throws:
ValidationException
-
getEmail
null-safe email conversion.- Throws:
ValidationException
-
getGecos
null-safe GECOS conversion.- Throws:
ValidationException
-
getGroupId
null-safe group id conversion.- Throws:
ValidationException
-
getHashedKey
null-safe hashed key conversion.- Throws:
IllegalArgumentException
-
getHashedPassword
protected static HashedPassword getHashedPassword(HashedPassword hashedPassword) throws IllegalArgumentException null-safe hashed password conversion.- Throws:
IllegalArgumentException
-
getHostname
null-safe hostname conversion.- Throws:
ValidationException
-
getInetAddress
null-safe inet address conversion.- Throws:
ValidationException
-
getLinuxId
null-safe Linux id conversion.- Throws:
ValidationException
-
getLinuxUserName
null-safe Linux user name conversion.- Throws:
ValidationException
-
getMacAddress
null-safe MAC address conversion.- Throws:
ValidationException
-
getMysqlDatabaseName
protected static Database.Name getMysqlDatabaseName(MysqlDatabaseName databaseName) throws ValidationException null-safe MySQL database name conversion.- Throws:
ValidationException
-
getMysqlServerName
protected static Server.Name getMysqlServerName(MysqlServerName serverName) throws ValidationException null-safe MySQL server name conversion.- Throws:
ValidationException
-
getMysqlUserName
null-safe MySQL user name conversion.- Throws:
ValidationException
-
getPort
null-safe port conversion.- Throws:
ValidationException
-
getPostgresDatabaseName
protected static Database.Name getPostgresDatabaseName(PostgresDatabaseName databaseName) throws ValidationException null-safe PostgreSQL database name conversion.- Throws:
ValidationException
-
getPostgresServerName
protected static Server.Name getPostgresServerName(PostgresServerName serverName) throws ValidationException null-safe PostgreSQL server name conversion.- Throws:
ValidationException
-
getPostgresUserId
protected static User.Name getPostgresUserId(PostgresUserName postgresUserId) throws ValidationException null-safe PostgreSQL user id conversion.- Throws:
ValidationException
-
getTimeMillis
null-safe conversion from Date to Long. -
getTimeMillis
null-safe conversion from Calendar to Long. -
getUnixPath
null-safe Unix path conversion.- Throws:
ValidationException
-
getUserId
null-safe user id conversion.- Throws:
ValidationException
-
equals
Implementation Note:
This default implementation considers the object equal when it is the same class (viaObject.getClass()and has equal keys (viagetKey()). -
getColumn
-
getColumnImpl
- Throws:
IOExceptionSQLException
-
getColumns
- Throws:
IOExceptionSQLException
-
getColumns
public final int getColumns(AoservConnector connector, List<Object> buff) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getKey
-
getTableId
-
getTableSchema
- Throws:
IOExceptionSQLException
-
hashCode
public int hashCode()Implementation Note:
This default implementation callshashCode()on the key (fromgetKey()). -
init
Initializes this object from the raw database contents.- Parameters:
results- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
Deprecated.This is maintained only for compatibility with theStreamableinterface.- Specified by:
readin interfaceAoservStreamable- Specified by:
readin interfaceStreamable- Specified by:
readin interfaceStreamReadable- Throws:
IOException- See Also:
-
read
public abstract void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException - Specified by:
readin interfaceAoservReadable- Specified by:
readin interfaceAoservStreamable- Throws:
IOException
-
toString
Implementation Note:
This default implementation callstoStringImpl(), which is allowed to throw exceptions.- Overrides:
toStringin classObject- Throws:
WrappedException- whentoStringImpl()throws an exception- See Also:
-
toStringImpl
toString()implementation that is allowed to throw exceptions.Implementation Note:
This default implementation callstoString()on the key (fromgetKey()). When the key isnull, uses the default implementation fromObject.toString().- Throws:
IOExceptionSQLException
-
write
@Deprecated public final void write(StreamableOutput out, String protocolVersion) throws IOException Deprecated.This is maintained only for compatibility with theStreamableinterface.- Specified by:
writein interfaceAoservStreamable- Specified by:
writein interfaceStreamable- Specified by:
writein interfaceStreamWritable- Throws:
IOException- See Also:
-
write
public abstract void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException - Specified by:
writein interfaceAoservStreamable- Specified by:
writein interfaceAoservWritable- Throws:
IOException
-
