Class Administrator
- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<User.Name,V>
-
- com.aoindustries.aoserv.client.account.CachedObjectUserNameKey<Administrator>
-
- com.aoindustries.aoserv.client.account.Administrator
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,Disablable,PasswordProtected,Removable,SingleTableObject<User.Name,Administrator>,Comparable<Administrator>
public final class Administrator extends CachedObjectUserNameKey<Administrator> implements PasswordProtected, Removable, Disablable, Comparable<Administrator>
AnAdministratoris a username and password pair, usually representing an individual or an application, that has administrative control over all resources in anAccountor any any of its child businesses.- Author:
- AO Industries, Inc.
- See Also:
Account
-
-
Field Summary
-
Fields inherited from class com.aoindustries.aoserv.client.account.CachedObjectUserNameKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
Fields inherited from interface com.aoindustries.aoserv.client.password.PasswordProtected
ALL, NONE, SOME
-
-
Constructor Summary
Constructors Constructor Description Administrator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intarePasswordsSet()booleancanDisable()booleancanEnable()booleancanSetPassword()booleancanSwitchUser(Administrator other)booleancanSwitchUsers()static List<PasswordChecker.Result>checkPassword(User.Name username, String password)Validates a password and returns a description of the problem.List<PasswordChecker.Result>checkPassword(String password)intcompareTo(Administrator o)Sorts by username.voiddisable(DisableLog dl)Validates a password and returns a description of the problem.voidenable()StringgetAddress1()StringgetAddress2()DategetBirthday()List<CannotRemoveReason<?>>getCannotRemoveReasons()Lists the reasons an object may not be removed.StringgetCellPhone()StringgetCity()protected ObjectgetColumnImpl(int i)CountryCodegetCountry()UnmodifiableTimestampgetCreated()List<Ticket>getCreatedTickets()DisableLoggetDisableLog()EmailgetEmail()StringgetFax()StringgetHomePhone()UsergetMasterUser()List<MonthlyCharge>getMonthlyCharges()StringgetName()HashedPasswordgetPassword()Gets the hashed password for this business_administrator.List<AdministratorPermission>getPermissions()StringgetState()StringgetSupportCode()Table.TableIDgetTableID()List<Action>getTicketActions()List<Assignment>getTicketAssignments()StringgetTitle()List<Transaction>getTransactions()Deprecated.UsergetUsername()User.NamegetUsername_userId()StringgetWorkPhone()StringgetZIP()booleanhasPermission(Permission permission)Checks if this business administrator has the provided permission.booleanhasPermission(Permission.Name permission)Checks if this business administrator has the provided permission.booleanhasPermission(String permission)Checks if this business administrator has the provided permission.voidinit(ResultSet result)Initializes this object from the raw database contents.booleanisActiveAccounting()booleanisActiveBankAccounting()booleanisActiveDNSAdmin()booleanisActiveTableInvalidator()booleanisActiveWebAdmin()booleanisDisabled()Checks if this object is disabled.booleanisPreferred()booleanisPrivate()voidread(StreamableInput in, AoservProtocol.Version protocolVersion)voidremove()Removes this object, and all dependant objects, from the system.voidsetPassword(String plaintext)Sets the password for thisAdministrator.voidsetProfile(String name, String title, Date birthday, boolean isPrivate, String workPhone, String homePhone, String cellPhone, String fax, Email email, String address1, String address2, String city, String state, String country, String zip)voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.account.CachedObjectUserNameKey
equals, getKey, hashCode, toStringImpl
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Method Detail
-
arePasswordsSet
public int arePasswordsSet() throws IOException, SQLException- Specified by:
arePasswordsSetin interfacePasswordProtected- Throws:
IOExceptionSQLException
-
canDisable
public boolean canDisable() throws SQLException, IOException- Specified by:
canDisablein interfaceDisablable- Throws:
SQLExceptionIOException
-
canSwitchUsers
public boolean canSwitchUsers()
-
getSupportCode
public String getSupportCode()
-
canSwitchUser
public boolean canSwitchUser(Administrator other) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
canEnable
public boolean canEnable() throws SQLException, IOException- Specified by:
canEnablein interfaceDisablable- Throws:
SQLExceptionIOException
-
checkPassword
public List<PasswordChecker.Result> checkPassword(String password) throws IOException
- Specified by:
checkPasswordin interfacePasswordProtected- Throws:
IOException
-
checkPassword
public static List<PasswordChecker.Result> checkPassword(User.Name username, String password) throws IOException
Validates a password and returns a description of the problem. If the password is valid, thennullis returned.- Throws:
IOException
-
disable
public void disable(DisableLog dl) throws IOException, SQLException
Validates a password and returns a description of the problem. If the password is valid, thennullis returned.- Specified by:
disablein interfaceDisablable- Throws:
IOExceptionSQLException
-
enable
public void enable() throws IOException, SQLException- Specified by:
enablein interfaceDisablable- Throws:
IOExceptionSQLException
-
getTicketActions
public List<Action> getTicketActions() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getTicketAssignments
public List<Assignment> getTicketAssignments() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getAddress1
public String getAddress1()
-
getAddress2
public String getAddress2()
-
getBirthday
public Date getBirthday()
-
getCellPhone
public String getCellPhone()
-
getCity
public String getCity()
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<User.Name,Administrator>
-
getCountry
public CountryCode getCountry() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getCreated
public UnmodifiableTimestamp getCreated()
-
getCreatedTickets
public List<Ticket> getCreatedTickets() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
isDisabled
public boolean isDisabled()
Description copied from interface:DisablableChecks if this object is disabled. This should execute very quickly (not incur any round-trip to any database) and thus does not throw any checked exceptions.- Specified by:
isDisabledin interfaceDisablable
-
getDisableLog
public DisableLog getDisableLog() throws SQLException, IOException
- Specified by:
getDisableLogin interfaceDisablable- Throws:
SQLExceptionIOException
-
getEmail
public Email getEmail()
-
getFax
public String getFax()
-
getHomePhone
public String getHomePhone()
-
getMasterUser
public User getMasterUser() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMonthlyCharges
public List<MonthlyCharge> getMonthlyCharges() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getName
public String getName()
-
getPassword
public HashedPassword getPassword()
Gets the hashed password for this business_administrator. This information is only available if all communication has been over secure connections. Otherwise, all passwords will be changed toNO_PASSWORD.- See Also:
AOServConnector.isSecure()
-
getState
public String getState()
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<User.Name,Administrator>
-
getTitle
public String getTitle()
-
getTransactions
@Deprecated public List<Transaction> getTransactions() throws IOException, SQLException
Deprecated.- Throws:
IOExceptionSQLException
-
getUsername_userId
public User.Name getUsername_userId()
-
getUsername
public User getUsername() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getWorkPhone
public String getWorkPhone()
-
getZIP
public String getZIP()
-
isActiveAccounting
public boolean isActiveAccounting() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
isActiveBankAccounting
public boolean isActiveBankAccounting() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
isActiveDNSAdmin
public boolean isActiveDNSAdmin() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
isActiveTableInvalidator
public boolean isActiveTableInvalidator() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
isActiveWebAdmin
public boolean isActiveWebAdmin() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
isPreferred
public boolean isPreferred()
-
isPrivate
public boolean isPrivate()
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<User.Name,Administrator>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<User.Name,Administrator>- Throws:
IOException
-
getCannotRemoveReasons
public List<CannotRemoveReason<?>> getCannotRemoveReasons() throws SQLException, IOException
Description copied from interface:RemovableLists the reasons an object may not be removed.- Specified by:
getCannotRemoveReasonsin interfaceRemovable- Returns:
- an empty
List<CannotRemoveReason>if this object may be removed, or a list of descriptions - Throws:
SQLExceptionIOException
-
remove
public void remove() throws IOException, SQLExceptionDescription copied from interface:RemovableRemoves this object, and all dependant objects, from the system.- Specified by:
removein interfaceRemovable- Throws:
IOExceptionSQLException
-
setPassword
public void setPassword(String plaintext) throws IOException, SQLException
Sets the password for thisAdministrator. All connections must be over secure protocols for this method to work. If the connections are not secure, anIOExceptionis thrown.- Specified by:
setPasswordin interfacePasswordProtected- Throws:
IOExceptionSQLException
-
setProfile
public void setProfile(String name, String title, Date birthday, boolean isPrivate, String workPhone, String homePhone, String cellPhone, String fax, Email email, String address1, String address2, String city, String state, String country, String zip) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<User.Name,Administrator>- Throws:
IOException
-
canSetPassword
public boolean canSetPassword()
- Specified by:
canSetPasswordin interfacePasswordProtected
-
getPermissions
public List<AdministratorPermission> getPermissions() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
hasPermission
public boolean hasPermission(Permission permission) throws IOException, SQLException
Checks if this business administrator has the provided permission.- Throws:
IOExceptionSQLException
-
hasPermission
public boolean hasPermission(Permission.Name permission) throws IOException, SQLException
Checks if this business administrator has the provided permission.- Throws:
IOExceptionSQLException
-
hasPermission
public boolean hasPermission(String permission) throws IOException, SQLException
Checks if this business administrator has the provided permission.- Throws:
IOExceptionSQLException
-
compareTo
public int compareTo(Administrator o)
Sorts by username. TODO: Consider handling comparisons at the AOServTable and making all AOServObject's comparable. We could then return things as sets where appropriate. Maybe have getMap, getList, getSet, and getSortedSet as appropriate?- Specified by:
compareToin interfaceComparable<Administrator>
-
-