Build in data models — Camelot documentation

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot Documentation contents »
- Camelot Documentation »

# Build in data models

Release: | trunk
Date: | November 03, 2011

Camelot comes with a number of build in data models. To avoid boiler plate models needed in almost any application (like Persons, Addresses, etc.), the developer is encouraged to use these data models as a start for developing custom applications.

## Persons and Organizations

class `camelot.model.authentication.` `Address`(**kwargs)

  The Address to be given to a Party (a Person or an Organization)

  Fields :

  > - city : refers to City
  > - street1 : VARCHAR(128), required
  > - street2 : VARCHAR(128), not required

class `camelot.model.authentication.` `AddressAdmin`(app_admin, entity)

  Admin with only the Address information and not the Party information

class `camelot.model.authentication.` `City`(**kwargs)
  A subclass of GeographicBoundary used to store the name, the postal code
    and the Country of a city

  Fields :

  > - country : refers to Country

class `camelot.model.authentication.` `ContactMechanism`(**kwargs)

  Fields :

  > - party_contact_mechanisms : refers to PartyContactMechanism
  > - mechanism : VARCHAR(256), required
  > - party_address : refers to PartyAddress

class `camelot.model.authentication.` `Country`(**kwargs)
  A subclass of GeographicBoundary used to store the name and the
    ISO code of a country

  Fields :

class `camelot.model.authentication.` `DirectedDirector`(**kwargs)

  Relation from a directed organization to a director

class `camelot.model.authentication.` `EmployerEmployee`(**kwargs)

  Relation from employer to employee

class `camelot.model.authentication.` `GeographicBoundary`(**kwargs)

  The base class for Country and City

class `camelot.model.authentication.` `Organization`(**kwargs)
  An organization represents any internal or external organization. Organizations can include
    businesses and groups of individuals

  Fields :

  > - name : VARCHAR(50), required
  > - employees : refers to EmployerEmployee
  > - shareholders : refers to SharedShareholder
  > - directors : refers to DirectedDirector
  > - customers : refers to SupplierCustomer
  > - tax_id : VARCHAR(20), not required
  > - logo : VARCHAR(100), not required
  > - suppliers : refers to SupplierCustomer

class `camelot.model.authentication.` `Party`(**kwargs)

  Base class for persons and organizations. Use this base class to refer to either persons or organisations in building authentication systems, contact management or CRM

class `camelot.model.authentication.` `Person`(**kwargs)

  Person represents natural persons

  Fields :

  > - comment : TEXT, not required
  > - picture : VARCHAR(100), not required
  > - last_name : VARCHAR(40), required
  > - suffix : VARCHAR(3), not required
  > - first_name : VARCHAR(40), required
  > - sex : VARCHAR(1), not required
  > - is_staff : <class ‘sqlalchemy.types.Boolean’>, not required
  > - social_security_number : VARCHAR(12), not required
  > - employers : refers to EmployerEmployee
  > - middle_name : VARCHAR(40), not required
  > - passport_number : VARCHAR(20), not required
  > - birthdate : DATE, not required
  > - is_superuser : <class ‘sqlalchemy.types.Boolean’>, not required
  > - passport_expiry_date : DATE, not required
  > - personal_title : VARCHAR(10), not required
  > - martial_status : VARCHAR(1), not required

class `camelot.model.authentication.` `RepresentedRepresentor`(**kwargs)

  Relation from a representing party to the person representing the party

class `camelot.model.authentication.` `SharedShareholder`(**kwargs)

  Relation from a shared organization to a shareholder

class `camelot.model.authentication.` `SupplierCustomer`(**kwargs)

  Relation from supplier to customer

`camelot.model.authentication.` `getCurrentAuthentication`(_obj=None)

  Get the currently logged in person

`camelot.model.authentication.` `updateLastLogin`()

  Update the last login of the current person to now

## Batch Jobs

Most applications need to perform some scheduled jobs to process information. Users need to be able to monitor the functioning of those scheduled jobs.

These classes provide the means to store the result of batch jobs to enable the user to review or plan them.

class `camelot.model.batch_job.` `BatchJob`(**kwargs)

  Information the batch job that is planned, running or has run

  Fields :

  > - status : INTEGER, required
  > - host : VARCHAR(256), required
  > - date : <class ‘sqlalchemy.types.DateTime’>, required
  > - message : TEXT, not required
  > - type : refers to BatchJobType

  `add_exception_to_message`(exception)

    If an exception occurs in a batch job, this method can be used to add the stack trace of the exception to the message

  `add_strings_to_message`(strings)

    Parameters: | strings – a list or generator of strings

  `is_canceled`()

    Verifies if this Batch Job is canceled. Returns `True` if it is. This verification is done without using the ORM, so the verification has no impact on the current session or the objects itself. This method is thus suited to call inside a running batch job to verifiy if another user has canceled the running job.

    Returns: | `True` or `False`

class `camelot.model.batch_job.` `BatchJobType`(**kwargs)
  The type of batch job, the user will be able to filter his
    jobs based on their type. A type might be ‘Create management reports’

  Fields :

  > - name : VARCHAR(256), required
  > - parent : refers to BatchJobType

## Auditing

class `camelot.model.memento.` `BeforeDelete`(**kwargs)

  The state of the object before it is deleted

class `camelot.model.memento.` `BeforeUpdate`(**kwargs)

  The state of the object before an update took place

class `camelot.model.memento.` `Create`(**kwargs)

  Marks the creation of an object

class `camelot.model.memento.` `Memento`(**kwargs)

  Keeps information on the previous state of objects, to keep track of changes and enable restore to that previous state

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot Documentation contents »
- Camelot Documentation »

Comments
blog comments powered by Disqus