- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<Account.Name,V>
-
- com.aoindustries.aoserv.client.account.CachedObjectAccountNameKey<Account>
-
- com.aoindustries.aoserv.client.account.Account
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,Disablable,SingleTableObject<Account.Name,Account>,Comparable<Account>
public final class Account extends CachedObjectAccountNameKey<Account> implements Disablable, Comparable<Account>
AnAccountis one distinct set of packages, resources, and permissions. Some businesses may have child businesses associated with them. When that is the case, the top level business is ultimately responsible for all actions taken and resources used by itself and all child businesses.- Author:
- AO Industries, Inc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAccount.NameThe unique, case-insensitive identifier for anAccount.
-
Field Summary
Fields Modifier and Type Field Description static intMAXIMUM_BUSINESS_TREE_DEPTHThe maximum depth of the business tree.-
Fields inherited from class com.aoindustries.aoserv.client.account.CachedObjectAccountNameKey
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
-
-
Constructor Summary
Constructors Constructor Description Account()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intaddAccountHost(Host server)intaddCreditCard(Processor processor, String groupName, String cardInfo, byte expirationMonth, short expirationYear, String providerUniqueId, String firstName, String lastName, String companyName, Email email, String phone, String fax, String customerId, String customerTaxId, String streetAddress1, String streetAddress2, String city, String state, String postalCode, CountryCode countryCode, String principalName, String description, String cardNumber)intaddDisableLog(String disableReason)voidaddNoticeLog(String billingContact, Email emailAddress, String type, int transid)intaddPackage(Account.Name name, PackageDefinition packageDefinition)intaddPackageDefinition(PackageCategory category, String name, String version, String display, String description, Money setupFee, TransactionType setupFeeTransactionType, Money monthlyRate, TransactionType monthlyRateTransactionType)intaddPayment(Processor processor, String groupName, boolean testMode, int duplicateWindow, String orderNumber, Money amount, Money taxAmount, boolean taxExempt, Money shippingAmount, Money dutyAmount, String shippingFirstName, String shippingLastName, String shippingCompanyName, String shippingStreetAddress1, String shippingStreetAddress2, String shippingCity, String shippingState, String shippingPostalCode, String shippingCountryCode, boolean emailCustomer, Email merchantEmail, String invoiceNumber, String purchaseOrderNumber, String description, Administrator creditCardCreatedBy, String creditCardPrincipalName, Account creditCardAccount, String creditCardGroupName, String creditCardProviderUniqueId, String creditCardMaskedCardNumber, Byte creditCard_expirationMonth, Short creditCard_expirationYear, String creditCardFirstName, String creditCardLastName, String creditCardCompanyName, Email creditCardEmail, String creditCardPhone, String creditCardFax, String creditCardCustomerId, String creditCardCustomerTaxId, String creditCardStreetAddress1, String creditCardStreetAddress2, String creditCardCity, String creditCardState, String creditCardPostalCode, String creditCardCountryCode, String creditCardComments, long authorizationTime, String authorizationPrincipalName)intaddProfile(String name, boolean isPrivate, String phone, String fax, String address1, String address2, String city, String state, String country, String zip, boolean sendInvoice, String billingContact, Set<Email> billingEmail, Profile.EmailFormat billingEmailFormat, String technicalContact, Set<Email> technicalEmail, Profile.EmailFormat technicalEmailFormat)intaddTransaction(int timeType, Timestamp time, Account sourceAccount, Administrator business_administrator, TransactionType type, String description, int quantity, Money rate, PaymentType paymentType, String paymentInfo, Processor processor, byte payment_confirmed)booleanbillParent()booleancanAddAccounts()booleancanAddBackupServer()booleancanCancel()voidcancel(String cancelReason)booleancanDisable()booleancanEnable()booleancanSeePrices()intcompareTo(Account o)voiddisable(DisableLog dl)voidenable()MoniesgetAccountBalance()Deprecated.MoniesgetAccountBalance(Timestamp before)Deprecated.StringgetAccountBalanceString()Deprecated.Please usegetAccountBalance()andMonies.toString()insteadStringgetAccountBalanceString(Timestamp before)Deprecated.Please usegetAccountBalance(java.sql.Timestamp)andMonies.toString()insteadAccountHostgetAccountHost(Host host)List<AccountHost>getAccountHosts()Map<PackageCategory,List<PackageDefinition>>getActivePackageDefinitions()Gets all active package definitions for this business.booleangetAutoEnable()MoniesgetAutoEnableMinimumPayment()AccountgetBillingAccount()Gets theAccountthat is responsible for paying the bills created by this business.List<MonthlyCharge>getBillingMonthlyCharges()Gets all monthly charges billed to this account.MoniesgetBillingMonthlyRate()Gets an approximation of the monthly rate billed to this account.BrandgetBrand()Gets the Brand for this business ornullif not a brand.UnmodifiableTimestampgetCanceled()StringgetCancelReason()List<Account>getChildAccounts()protected ObjectgetColumnImpl(int i)MoniesgetConfirmedAccountBalance()Deprecated.MoniesgetConfirmedAccountBalance(Timestamp before)Deprecated.StringgetContractVersion()UnmodifiableTimestampgetCreated()List<Processor>getCreditCardProcessors()List<CreditCard>getCreditCards()HostgetDefaultHost()DisableLoggetDisableLog()StringgetDoNotDisableReason()List<Domain>getEmailDomains()List<Forwarding>getEmailForwarding()List<List>getEmailLists()List<EncryptionKey>getEncryptionKeys()Gets all of the encryption keys for this business.PaymentgetLastCreditCardTransaction()Gets the most recent credit card transaction.GroupServergetLinuxServerGroup(Server aoServer)List<User>getMailAccounts()List<MonthlyCharge>getMonthlyCharges()Gets all monthly charges from this account.CreditCardgetMonthlyCreditCard()MoniesgetMonthlyRate()Gets an approximation of the monthly rate from this account.Account.NamegetName()List<NoticeLog>getNoticeLogs()PackageDefinitiongetPackageDefinition(PackageCategory category, String name, String version)List<PackageDefinition>getPackageDefinitions(PackageCategory category)List<Package>getPackages()AccountgetParent()Account.NamegetParent_name()ProfilegetProfile()Gets theProfilewith the highest priority.List<Profile>getProfiles()Table.TableIDgetTableID()List<Ticket>getTickets()AccountgetTopLevelAccount()Gets theAccountin the account tree that is one level down from the top level account.List<Transaction>getTransactions()Deprecated.Please useTransactionTable.getTransactions(com.aoindustries.aoserv.client.account.Account)directlyList<Transaction>getTransactionsFrom()Deprecated.List<WhoisHistoryAccount>getWhoisHistoryAccounts()voidinit(ResultSet result)Initializes this object from the raw database contents.booleanisAccountOrParent(Account other)Deprecated.Please useisAccountOrParentOf(com.aoindustries.aoserv.client.account.Account)instead.booleanisAccountOrParentOf(Account other)Determines if thisAccountis the other account or a parent of it.booleanisDisabled()Checks if this object is disabled.booleanisParentOf(Account other)Determines if thisAccountis a parent of the other business.booleanisRootAccount()voidmove(Server from, Server to, TerminalWriter out)voidread(StreamableInput in, AoservProtocol.Version protocolVersion)voidsetName(Account.Name name)voidsetUseMonthlyCreditCard(CreditCard creditCard)Sets the credit card that will be used monthly.voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.account.CachedObjectAccountNameKey
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
-
-
-
-
Field Detail
-
MAXIMUM_BUSINESS_TREE_DEPTH
public static final int MAXIMUM_BUSINESS_TREE_DEPTH
The maximum depth of the business tree.- See Also:
- Constant Field Values
-
-
Method Detail
-
addProfile
public int addProfile(String name, boolean isPrivate, String phone, String fax, String address1, String address2, String city, String state, String country, String zip, boolean sendInvoice, String billingContact, Set<Email> billingEmail, Profile.EmailFormat billingEmailFormat, String technicalContact, Set<Email> technicalEmail, Profile.EmailFormat technicalEmailFormat) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addAccountHost
public int addAccountHost(Host server) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addCreditCard
public int addCreditCard(Processor processor, String groupName, String cardInfo, byte expirationMonth, short expirationYear, String providerUniqueId, String firstName, String lastName, String companyName, Email email, String phone, String fax, String customerId, String customerTaxId, String streetAddress1, String streetAddress2, String city, String state, String postalCode, CountryCode countryCode, String principalName, String description, String cardNumber) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addPayment
@Deprecated public int addPayment(Processor processor, String groupName, boolean testMode, int duplicateWindow, String orderNumber, Money amount, Money taxAmount, boolean taxExempt, Money shippingAmount, Money dutyAmount, String shippingFirstName, String shippingLastName, String shippingCompanyName, String shippingStreetAddress1, String shippingStreetAddress2, String shippingCity, String shippingState, String shippingPostalCode, String shippingCountryCode, boolean emailCustomer, Email merchantEmail, String invoiceNumber, String purchaseOrderNumber, String description, Administrator creditCardCreatedBy, String creditCardPrincipalName, Account creditCardAccount, String creditCardGroupName, String creditCardProviderUniqueId, String creditCardMaskedCardNumber, Byte creditCard_expirationMonth, Short creditCard_expirationYear, String creditCardFirstName, String creditCardLastName, String creditCardCompanyName, Email creditCardEmail, String creditCardPhone, String creditCardFax, String creditCardCustomerId, String creditCardCustomerTaxId, String creditCardStreetAddress1, String creditCardStreetAddress2, String creditCardCity, String creditCardState, String creditCardPostalCode, String creditCardCountryCode, String creditCardComments, long authorizationTime, String authorizationPrincipalName) throws IOException, SQLException
Adds a transaction in the pending state.- Throws:
IOExceptionSQLException
-
addDisableLog
public int addDisableLog(String disableReason) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addNoticeLog
@Deprecated public void addNoticeLog(String billingContact, Email emailAddress, String type, int transid) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addPackage
public int addPackage(Account.Name name, PackageDefinition packageDefinition) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addTransaction
@Deprecated public int addTransaction(int timeType, Timestamp time, Account sourceAccount, Administrator business_administrator, TransactionType type, String description, int quantity, Money rate, PaymentType paymentType, String paymentInfo, Processor processor, byte payment_confirmed) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
canAddBackupServer
public boolean canAddBackupServer()
-
canAddAccounts
public boolean canAddAccounts()
-
cancel
public void cancel(String cancelReason) throws IllegalArgumentException, IOException, SQLException
-
canCancel
public boolean canCancel() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
isRootAccount
public boolean isRootAccount() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
canDisable
public boolean canDisable() throws IOException, SQLException- Specified by:
canDisablein interfaceDisablable- Throws:
IOExceptionSQLException
-
canEnable
public boolean canEnable() throws SQLException, IOException- Specified by:
canEnablein interfaceDisablable- Throws:
SQLExceptionIOException
-
canSeePrices
public boolean canSeePrices()
-
disable
public void disable(DisableLog dl) throws IOException, SQLException
- Specified by:
disablein interfaceDisablable- Throws:
IOExceptionSQLException
-
enable
public void enable() throws IOException, SQLException- Specified by:
enablein interfaceDisablable- Throws:
IOExceptionSQLException
-
getAccountBalance
@Deprecated public Monies getAccountBalance() throws IOException, SQLException
Deprecated.- Throws:
IOExceptionSQLException
-
getAccountBalance
@Deprecated public Monies getAccountBalance(Timestamp before) throws IOException, SQLException
Deprecated.- Throws:
IOExceptionSQLException
-
getAccountBalanceString
@Deprecated public String getAccountBalanceString() throws IOException, SQLException
Deprecated.Please usegetAccountBalance()andMonies.toString()insteadGets a comma-separated list of account balances.- Throws:
IOExceptionSQLException- See Also:
getAccountBalance()
-
getAccountBalanceString
@Deprecated public String getAccountBalanceString(Timestamp before) throws IOException, SQLException
Deprecated.Please usegetAccountBalance(java.sql.Timestamp)andMonies.toString()insteadGets a comma-separated list of account balances before a given time.- Throws:
IOExceptionSQLException- See Also:
getAccountBalance(java.sql.Timestamp)
-
getName
public Account.Name getName()
-
getAutoEnable
public boolean getAutoEnable()
-
billParent
public boolean billParent()
-
getAutoEnableMinimumPayment
public Monies getAutoEnableMinimumPayment() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getDoNotDisableReason
public String getDoNotDisableReason()
-
getTopLevelAccount
public Account getTopLevelAccount() throws IOException, SQLException
Gets theAccountin the account tree that is one level down from the top level account.- Throws:
IOExceptionSQLException
-
getBillingAccount
public Account getBillingAccount() throws SQLException, IOException
Gets theAccountthat is responsible for paying the bills created by this business.- Throws:
SQLExceptionIOException
-
getProfile
public Profile getProfile() throws IOException, SQLException
Gets theProfilewith the highest priority.- Throws:
IOExceptionSQLException
-
getProfiles
public List<Profile> getProfiles() throws IOException, SQLException
Gets a list of allprofilesfor thisAccountsorted with the highest priority profile at the zero index.- Throws:
IOExceptionSQLException
-
getAccountHost
public AccountHost getAccountHost(Host host) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getAccountHosts
public List<AccountHost> getAccountHosts() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getCanceled
public UnmodifiableTimestamp getCanceled()
-
getCancelReason
public String getCancelReason()
-
getChildAccounts
public List<Account> getChildAccounts() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<Account.Name,Account>
-
getConfirmedAccountBalance
@Deprecated public Monies getConfirmedAccountBalance() throws IOException, SQLException
Deprecated.- Throws:
IOExceptionSQLException
-
getConfirmedAccountBalance
@Deprecated public Monies getConfirmedAccountBalance(Timestamp before) throws IOException, SQLException
Deprecated.- Throws:
IOExceptionSQLException
-
getContractVersion
public String getContractVersion()
-
getCreated
public UnmodifiableTimestamp getCreated()
-
getCreditCardProcessors
public List<Processor> getCreditCardProcessors() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getCreditCards
public List<CreditCard> getCreditCards() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getDefaultHost
public Host getDefaultHost() 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
-
getEmailForwarding
public List<Forwarding> getEmailForwarding() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getEmailLists
public List<List> getEmailLists() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxServerGroup
public GroupServer getLinuxServerGroup(Server aoServer) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMailAccounts
public List<User> getMailAccounts() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMonthlyCreditCard
public CreditCard getMonthlyCreditCard() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMonthlyCharges
public List<MonthlyCharge> getMonthlyCharges() throws SQLException, IOException
Gets all monthly charges from this account.- Throws:
SQLExceptionIOException- See Also:
getMonthlyRate()
-
getBillingMonthlyCharges
public List<MonthlyCharge> getBillingMonthlyCharges() throws SQLException, IOException
Gets all monthly charges billed to this account.- Throws:
SQLExceptionIOException- See Also:
getBillingMonthlyRate()
-
getMonthlyRate
public Monies getMonthlyRate() throws SQLException, IOException
Gets an approximation of the monthly rate from this account. This is not guaranteed to be exactly the same as the underlying billing database processes.- Returns:
- the total monthly rate of all
PackageDefinitionandMonthlyChargefrom this account ornullif unavailable. - Throws:
SQLExceptionIOException- See Also:
getMonthlyCharges()
-
getBillingMonthlyRate
public Monies getBillingMonthlyRate() throws SQLException, IOException
Gets an approximation of the monthly rate billed to this account. This is not guaranteed to be exactly the same as the underlying billing database processes.- Returns:
- the total monthly rate of all
PackageDefinitionandMonthlyChargebilled to this account ornullif unavailable. - Throws:
SQLExceptionIOException- See Also:
getBillingMonthlyCharges()
-
getNoticeLogs
public List<NoticeLog> getNoticeLogs() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPackages
public List<Package> getPackages() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getParent_name
public Account.Name getParent_name()
-
getParent
public Account getParent() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailDomains
public List<Domain> getEmailDomains() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<Account.Name,Account>
-
getTransactions
@Deprecated public List<Transaction> getTransactions() throws IOException, SQLException
Deprecated.Please useTransactionTable.getTransactions(com.aoindustries.aoserv.client.account.Account)directlyGets transactions that have this account as their applied-to.- Throws:
IOExceptionSQLException
-
getTransactionsFrom
@Deprecated public List<Transaction> getTransactionsFrom() throws IOException, SQLException
Deprecated.Gets transactions that have this account as their source.- Throws:
IOExceptionSQLException
-
getWhoisHistoryAccounts
public List<WhoisHistoryAccount> getWhoisHistoryAccounts() throws IOException, SQLException
-
isAccountOrParent
@Deprecated public boolean isAccountOrParent(Account other) throws IOException, SQLException
Deprecated.Please useisAccountOrParentOf(com.aoindustries.aoserv.client.account.Account)instead.- Throws:
IOExceptionSQLException
-
isAccountOrParentOf
public boolean isAccountOrParentOf(Account other) throws IOException, SQLException
Determines if thisAccountis the other account or a parent of it. This is often used for access control between accounts.- Throws:
IOExceptionSQLException
-
isParentOf
public boolean isParentOf(Account other) throws IOException, SQLException
Determines if thisAccountis a parent of the other business. This is often used for access control between accounts.- Throws:
IOExceptionSQLException
-
move
public void move(Server from, Server to, TerminalWriter out) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<Account.Name,Account>- 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<Account.Name,Account>- Throws:
IOException
-
setName
public void setName(Account.Name name) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<Account.Name,Account>- Throws:
IOException
-
getTickets
public List<Ticket> getTickets() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getEncryptionKeys
public List<EncryptionKey> getEncryptionKeys() throws IOException, SQLException
Gets all of the encryption keys for this business.- Throws:
IOExceptionSQLException
-
setUseMonthlyCreditCard
public void setUseMonthlyCreditCard(CreditCard creditCard) throws IOException, SQLException
Sets the credit card that will be used monthly. Any other selected card will be deselected. IfcreditCardis null, none will be used automatically.- Throws:
IOExceptionSQLException
-
getLastCreditCardTransaction
public Payment getLastCreditCardTransaction() throws IOException, SQLException
Gets the most recent credit card transaction.- Throws:
IOExceptionSQLException
-
getBrand
public Brand getBrand() throws IOException, SQLException
Gets the Brand for this business ornullif not a brand.- Throws:
IOExceptionSQLException
-
addPackageDefinition
@Deprecated public int addPackageDefinition(PackageCategory category, String name, String version, String display, String description, Money setupFee, TransactionType setupFeeTransactionType, Money monthlyRate, TransactionType monthlyRateTransactionType) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPackageDefinition
public PackageDefinition getPackageDefinition(PackageCategory category, String name, String version) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPackageDefinitions
public List<PackageDefinition> getPackageDefinitions(PackageCategory category) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getActivePackageDefinitions
public Map<PackageCategory,List<PackageDefinition>> getActivePackageDefinitions() throws IOException, SQLException
Gets all active package definitions for this business.- Throws:
IOExceptionSQLException
-
compareTo
public int compareTo(Account o)
- Specified by:
compareToin interfaceComparable<Account>
-
-