Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.crm
Class Company

    java.lang.Object
      com.knowgate.dataobjs.DBPersist
          com.knowgate.crm.Company

All Implemented Interfaces:
  java.io.Serializable, java.util.Map

    public class Company

extends DBPersist

Company

Copyright: Copyright (c) KnowGate 2003

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface java.util.Map
`java.util.Map.Entry<K,V>`

Field Summary
`static short` | `ClassId`

Fields inherited from class com.knowgate.dataobjs.DBPersist
`AllVals, sAuditCls, sAuditUsr, sTransactId`

Constructor Summary
`Company()` Create Empty Company.
`Company(JDCConnection oConn, java.lang.String sCompanyId)` Create Company and load fields from database.
`Company(java.lang.String sCompanyId)` Create Company and set gu_company field.

Method Summary
`boolean` | `addAddress(JDCConnection oConn, java.lang.String sAddrGUID)` Add an Address to this Company If contact is already associated to the given address a foreign key violation SQLExceception is raised.
`boolean` | `addBankAccount(JDCConnection oConn, java.lang.String sFullBankAccount)` Add a bank account to this Company If company is already associated to the given bank account then a foreign key violation SQLException is thrown
`static boolean` | `addLookupCompanyType(java.sql.Connection oConn, java.lang.String sGuWorkArea, java.lang.String sIdType, java.util.HashMap oTranslations)` Add a Company Type lookup value
`static boolean` | `addLookupSector(java.sql.Connection oConn, java.lang.String sGuWorkArea, java.lang.String sIdSector, java.util.HashMap oTranslations)` Add a Company Sector lookup value
`int` | `addToACLGroups(JDCConnection oConn, java.lang.String sGroupList)` Add Company to a set of security restrictions groups.
`int` | `clearACLGroups(JDCConnection oConn)` Remove company from all security restrictions groups
`boolean` | `delete(JDCConnection oConn)` Delete Company
`static boolean` | `delete(JDCConnection oConn, java.lang.String sCompanyGUID)` Delete Company.
`boolean` | `exists(JDCConnection oConn)` Find out whether or not a company exists at database Look up company by GUID or by legal name and work area.
`static Company` | `forAddress(JDCConnection oConn, java.lang.String sGuAddr)`
`DBSubset` | `getActiveAddresses(JDCConnection oConn)` Get Company Addresses
`DBSubset` | `getActiveBankAccounts(JDCConnection oConn)` Get active bank accounts for this Company
`Address` | `getAddress(JDCConnection oConn, java.lang.String sTpLocation)` Get address by location type
`DBSubset` | `getAddresses(JDCConnection oConn)` Get Company Addresses
`DBSubset` | `getAllBankAccounts(JDCConnection oConn)` Get all bank accounts associated with Company
`DBSubset` | `getGroups(JDCConnection oConn)` Get groups that may have access to this company.
`static java.lang.String` | `getIdFromLegalNum(java.sql.Connection oConn, java.lang.String sLegalId, java.lang.String sWorkArea)` Get company GUID given its legal number
`static java.lang.String` | `getIdFromName(java.sql.Connection oConn, java.lang.String sLegalName, java.lang.String sWorkArea)` Get company GUID given its legal name
`static java.lang.String` | `getIdFromRef(java.sql.Connection oConn, java.lang.String sReference, java.lang.String sWorkArea)` Get company GUID given its external reference
`DBSubset` | `getUnactiveBankAccounts(JDCConnection oConn)` Get unactive bank accounts for this Company
`int` | `removeFromACLGroup(JDCConnection oConn, java.lang.String sIdGroup)` Remove Company from security restrictions group.
`boolean` | `store(JDCConnection oConn)` Store Company Automatically generates gu_company GUID and dt_modified DATE if not explicitly set.
`java.lang.String` | `toXML(JDCConnection oConn, java.lang.String sIdent, java.lang.String sDelim)` Get an XML dump for Company and its associated addresses

Methods inherited from class com.knowgate.dataobjs.DBPersist
`allcaps, allcaps, changelog, clear, clone, containsKey, containsValue, entrySet, get, get, getAuditClassName, getCreationDate, getDate, getDateFormated, getDateShort, getDateTime, getDateTime24, getDecimal, getDecimalFormated, getDecimalFormated, getDouble, getDoubleFormated, getFloat, getFloatFormated, getInt, getInteger, getIntervalPart, getItemMap, getItems, getMoney, getShort, getSQLDate, getSQLTime, getString, getStringHtml, getStringNull, getTable, getTable, getTableName, getTime, getTimeOfDay, getTimestamp, getUIdFromName, isEmpty, isNull, iterator, keySet, load, load, parseXML, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAll, remove, remove, replace, replace, replace, replace, replace, replace, replace, replace, setAuditTransact, setAuditUser, setCreationDate, size, toLowerCase, toUpperCase, toXML, toXML, toXML, toXML, values`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Field Detail

### ClassId

    public static final short ClassId

See Also:
  Constant Field Values

Constructor Detail

### Company

    public Company()

  Create Empty Company.

### Company

    public Company(java.lang.String sCompanyId)

  Create Company and set gu_company field. Does not load other fields from database.

  Parameters:
    `sCompanyId` - Company GUID

### Company

    public Company(JDCConnection oConn,
                   java.lang.String sCompanyId)
            throws java.sql.SQLException

  Create Company and load fields from database.

  Parameters:
    `oConn` - JDCConnection
    `sCompanyId` - Company GUID
  Throws:
    `java.sql.SQLException`

Method Detail

### getGroups

    public DBSubset getGroups(JDCConnection oConn)
                       throws java.sql.SQLException

  Get groups that may have access to this company.

  Parameters:
    `oConn` - Database Connection
  Returns:
    A `DBSubset` with a 1 column containing each group unique identifier (gu_acl_group).
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### addToACLGroups

    public int addToACLGroups(JDCConnection oConn,
                              java.lang.String sGroupList)
                       throws java.sql.SQLException

  Add Company to a set of security restrictions groups.

  Insert new registers at k_x_group_company table.

  Parameters:
    `oConn` - Database Connection
    `sGroupList` - A string of comma delimited ACLGroup GUIDs to with this ACLUser must be added.
  Throws:
    `java.sql.SQLException` - May throw a primary key constraint violation if company already belongs to group.
  Since:
    4.0

### clearACLGroups

    public int clearACLGroups(JDCConnection oConn)
                       throws java.sql.SQLException

  Remove company from all security restrictions groups

  Parameters:
    `oConn` - Database Connection
  Returns:
    Count of groups from witch user was removed.
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### removeFromACLGroup

    public int removeFromACLGroup(JDCConnection oConn,
                                  java.lang.String sIdGroup)
                           throws java.sql.SQLException

  Remove Company from security restrictions group.

  remove register from k_x_group_user table.

  Parameters:
    `oConn` - Database Connection
    `sIdGroup` - Group Unique Identifier.
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### addBankAccount

    public boolean addBankAccount(JDCConnection oConn,
                                  java.lang.String sFullBankAccount)
                           throws java.sql.SQLException

  Add a bank account to this Company

  If company is already associated to the given bank account then a foreign key violation SQLException is thrown

  Parameters:
    `oConn` - Database Connection
  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### getAllBankAccounts

    public DBSubset getAllBankAccounts(JDCConnection oConn)
                                throws java.sql.SQLException,
                                       java.lang.IllegalStateException

  Get all bank accounts associated with Company

  Parameters:
    `oConn` - JDCConnection
  Returns:
    DBSubset nu_bank_acc,dt_created,bo_active,tp_account,nm_bank,tx_addr,nm_cardholder,nu_card,tp_card,tx_expire,nu_pin,nu_cvv2,im_credit_limit,de_bank_acc
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException` - if gu_company or gu_workarea are not set
  Since:
    3.0

### getActiveBankAccounts

    public DBSubset getActiveBankAccounts(JDCConnection oConn)
                                   throws java.sql.SQLException,
                                          java.lang.IllegalStateException

  Get active bank accounts for this Company

  Parameters:
    `oConn` - JDCConnection
  Returns:
    DBSubset nu_bank_acc,dt_created,tp_account,nm_bank,tx_addr,nm_cardholder,nu_card,tp_card,tx_expire,nu_pin,nu_cvv2,im_credit_limit,de_bank_acc
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException` - if gu_company or gu_workarea are not set
  Since:
    3.0

### getUnactiveBankAccounts

    public DBSubset getUnactiveBankAccounts(JDCConnection oConn)
                                     throws java.sql.SQLException,
                                            java.lang.IllegalStateException

  Get unactive bank accounts for this Company

  Parameters:
    `oConn` - JDCConnection
  Returns:
    DBSubset nu_bank_acc,dt_created,tp_account,nm_bank,tx_addr,nm_cardholder,nu_card,tp_card,tx_expire,nu_pin,nu_cvv2,im_credit_limit,de_bank_acc
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException` - if gu_company or gu_workarea are not set
  Since:
    3.0

### store

    public boolean store(JDCConnection oConn)
                  throws java.sql.SQLException

  Store Company Automatically generates gu_company GUID and dt_modified DATE if not explicitly set.

  Overrides:
    `store` in class `DBPersist`
  Parameters:
    `oConn` - Database Connection
  Returns:
    boolean true if register was stored for the first time, false if register already existed.
  Throws:
    `java.sql.SQLException`

### delete

    public boolean delete(JDCConnection oConn)
                   throws java.sql.SQLException

  Delete Company

  Overrides:
    `delete` in class `DBPersist`
  Parameters:
    `oConn` - Database Connection
  Returns:
    true if register was successfully erased, false if not.
  Throws:
    `java.sql.SQLException`

### exists

    public boolean exists(JDCConnection oConn)
                   throws java.sql.SQLException

  Find out whether or not a company exists at database

  Look up company by GUID or by legal name and work area.

  Overrides:
    `exists` in class `DBPersist`
  Parameters:
    `oConn` - database connection
  Returns:
    true if a company with such GUID or legal name+work area is found.
  Throws:
    `java.sql.SQLException`

### addAddress

    public boolean addAddress(JDCConnection oConn,
                              java.lang.String sAddrGUID)
                       throws java.sql.SQLException

  Add an Address to this Company

  If contact is already associated to the given address a foreign key violation SQLExceception is raised.

  Parameters:
    `oConn` - Database Connection
  Throws:
    `java.sql.SQLException`

### getAddress

    public Address getAddress(JDCConnection oConn,
                              java.lang.String sTpLocation)
                       throws java.sql.SQLException,
                              java.lang.IllegalStateException

  Get address by location type

  Parameters:
    `oConn` - JDCConnection
    `sTpLocation` - String Value for column tp_location from k_addresses table
  Returns:
    Address or null is no address with such location type was found
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException` - if gu_company property is not set
  Since:
    3.0

### getAddresses

    public DBSubset getAddresses(JDCConnection oConn)
                          throws java.sql.SQLException,
                                 java.lang.IllegalStateException

  Get Company Addresses

  Parameters:
    `oConn` - Database Connection
  Returns:
    A DBSubset with all columns from k_addresses for Company
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException` - if gu_company property is not set

### getActiveAddresses

    public DBSubset getActiveAddresses(JDCConnection oConn)
                                throws java.sql.SQLException,
                                       java.lang.IllegalStateException

  Get Company Addresses

  Parameters:
    `oConn` - Database Connection
  Returns:
    A DBSubset with all columns from k_addresses for Company
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException` - if gu_company property is not set
  Since:
    4.0

### toXML

    public java.lang.String toXML(JDCConnection oConn,
                                  java.lang.String sIdent,
                                  java.lang.String sDelim)
                           throws java.lang.IllegalStateException,
                                  java.sql.SQLException

  Get an XML dump for Company and its associated addresses

  Parameters:
    `sIdent` - Number of blank spaces for left padding at every line.
    `sDelim` - Line delimiter (usually "\n" or "\r\n")
  Throws:
    `java.lang.IllegalStateException` - If XML method is invoked before Company object is loaded
    `java.sql.SQLException`
  Since:
    4.0

### delete

    public static boolean delete(JDCConnection oConn,
                                 java.lang.String sCompanyGUID)
                          throws java.sql.SQLException

  Delete Company.

  Delete all associated contacts and call k_sp_del_company stored procedure.
  If k_orders table exists, then Orders for this Company are deleted.
  If k_projects table exists, then Projects for this Company are deleted.

  Parameters:
    `oConn` - Database Connection
    `sCompanyGUID` - Company GUID
  Throws:
    `java.sql.SQLException`

### addLookupSector

    public static boolean addLookupSector(java.sql.Connection oConn,
                                          java.lang.String sGuWorkArea,
                                          java.lang.String sIdSector,
                                          java.util.HashMap oTranslations)
                                   throws java.sql.SQLException

  Add a Company Sector lookup value

  Parameters:
    `oConn` - Connection
    `sGuWorkArea` - String GUID of WorkArea
    `sDeTitle` - String Sector Internal Identifier
    `oTranslations` - HashMap with one entry for each language
  Returns:
    boolean true if new sector was added, false if it already existed
  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### addLookupCompanyType

    public static boolean addLookupCompanyType(java.sql.Connection oConn,
                                               java.lang.String sGuWorkArea,
                                               java.lang.String sIdType,
                                               java.util.HashMap oTranslations)
                                        throws java.sql.SQLException

  Add a Company Type lookup value

  Parameters:
    `oConn` - Connection
    `sGuWorkArea` - String GUID of WorkArea
    `sDeTitle` - String Company Type Internal Identifier
    `oTranslations` - HashMap with one entry for each language
  Returns:
    boolean true if new sector was added, false if it already existed
  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### getIdFromName

    public static java.lang.String getIdFromName(java.sql.Connection oConn,
                                                 java.lang.String sLegalName,
                                                 java.lang.String sWorkArea)
                                          throws java.sql.SQLException

  Get company GUID given its legal name

  Parameters:
    `oConn` - Connection
    `sLegalName` - String Legal name of sought Company
    `sWorkArea` - String GUID of WorkArea where to search
  Returns:
    String Company GUID or null if no company with such legal name was found at given work area
  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### getIdFromRef

    public static java.lang.String getIdFromRef(java.sql.Connection oConn,
                                                java.lang.String sReference,
                                                java.lang.String sWorkArea)
                                         throws java.sql.SQLException

  Get company GUID given its external reference

  Parameters:
    `oConn` - Connection
    `sLegalName` - String External reference of sought Company
    `sWorkArea` - String GUID of WorkArea where to search
  Returns:
    String Company GUID or null if no company with such reference was found at given work area
  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### getIdFromLegalNum

    public static java.lang.String getIdFromLegalNum(java.sql.Connection oConn,
                                                     java.lang.String sLegalId,
                                                     java.lang.String sWorkArea)
                                              throws java.sql.SQLException

  Get company GUID given its legal number

  Parameters:
    `oConn` - Connection
    `sLegalName` - String Legal Number of sought Company
    `sWorkArea` - String GUID of WorkArea where to search
  Returns:
    String Company GUID or null if no company with such legal number was found at given work area
  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### forAddress

    public static Company forAddress(JDCConnection oConn,
                                     java.lang.String sGuAddr)
                              throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD