class AchatFabrication(EntityType): date_achat = Date() quantite = Int() quantite_plusieurs = Boolean(default=False, required=True, description='True if quantite is "plusieurs"') parure = SubjectRelation('Parure', cardinality='1*', inlined=True) avec_mat = SubjectRelation('FabriqueAvecMat', cardinality='*1') remarques = RichString(fulltextindexed=True, default_format='text/rest')
class Workflow(EntityType): __permissions__ = PUB_SYSTEM_ENTITY_PERMS name = String(required=True, indexed=True, internationalizable=True, maxsize=256) description = RichString( default_format='text/rest', description=_('semantic description of this workflow')) workflow_of = SubjectRelation( 'CWEType', cardinality='+*', description=_('entity types which may use this workflow'), constraints=[RQLConstraint('O final FALSE')]) initial_state = SubjectRelation( 'State', cardinality='?*', constraints=[ RQLConstraint('O state_of S', msg=_('state doesn\'t belong to this workflow')) ], description=_('initial state for this workflow'))
class Basket(EntityType): """a basket contains a set of other entities""" __permissions__ = { 'read': ( 'managers', ERQLExpression('X owned_by U'), ), 'add': ( 'managers', 'users', ), 'delete': ( 'managers', 'owners', ), 'update': ( 'managers', 'owners', ), } name = String(required=True, indexed=True, internationalizable=True, maxsize=128) description = RichString(fulltextindexed=True)
class State(EntityType): """used to associate simple states to an entity type and/or to define workflows """ __permissions__ = PUB_SYSTEM_ENTITY_PERMS __unique_together__ = [('name', 'state_of')] name = String(required=True, indexed=True, internationalizable=True, maxsize=256) description = RichString( default_format='text/rest', description=_('semantic description of this state')) # XXX should be on BaseTransition w/ AND/OR selectors when we will # implements #345274 allowed_transition = SubjectRelation( 'BaseTransition', cardinality='**', constraints=[ RQLConstraint( 'S state_of WF, O transition_of WF', msg=_( 'state and transition don\'t belong the the same workflow') ) ], description=_('allowed transitions from this state')) state_of = SubjectRelation( 'Workflow', cardinality='1*', composite='object', inlined=True, description=_('workflow to which this state belongs'))
class RestrictedFile(EntityType): """ A downloadable file which may contains binary data """ title = String(required=True, indexed=True, maxsize=256) data = Bytes(required=True, fulltextindexed=True, description=_('file to upload')) data_format = String( required=True, maxsize=128, description=_('MIME type of the file. Should be dynamically set at ' 'upload time.')) data_encoding = String( maxsize=32, description=_('encoding of the file when it applies (e.g. text). ' 'Should be dynamically set at upload time.')) data_name = String( required=True, fulltextindexed=True, description=_('name of the file. Should be dynamically set at upload ' 'time.')) data_sha1hex = String( maxsize=40, description=_('SHA1 sum of the file. May be set at upload time.')) description = RichString(fulltextindexed=True, internationalizable=True, default_format='text/rest')
class CWAttribute(EntityType): """define a final relation: link a final relation type from a non final entity to a final entity type. used to build the instance schema """ __permissions__ = PUB_SYSTEM_ENTITY_PERMS relation_type = SubjectRelation('CWRType', cardinality='1*', constraints=[RQLConstraint('O final TRUE')], composite='object') from_entity = SubjectRelation('CWEType', cardinality='1*', constraints=[RQLConstraint('O final FALSE')], composite='object') to_entity = SubjectRelation('CWEType', cardinality='1*', constraints=[RQLConstraint('O final TRUE')], composite='object') constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject') cardinality = String(maxsize=2, internationalizable=True, vocabulary=[_('?1'), _('11')], description=_('subject/object cardinality')) ordernum = Int(description=('control subject entity\'s relations order'), default=0) formula = String(maxsize=2048) indexed = Boolean(description=_('create an index for quick search on this attribute')) fulltextindexed = Boolean(description=_('index this attribute\'s value in the plain text index')) internationalizable = Boolean(description=_('is this attribute\'s value translatable')) defaultval = Bytes(description=_('default value as gziped pickled python object')) extra_props = Bytes(description=_('additional type specific properties')) description = RichString(internationalizable=True, description=_('semantic description of this attribute'))
class CWRelation(EntityType): """define a non final relation: link a non final relation type from a non final entity to a non final entity type. used to build the instance schema """ __permissions__ = PUB_SYSTEM_ENTITY_PERMS relation_type = SubjectRelation('CWRType', cardinality='1*', constraints=[RQLConstraint('O final FALSE')], composite='object') from_entity = SubjectRelation('CWEType', cardinality='1*', constraints=[RQLConstraint('O final FALSE')], composite='object') to_entity = SubjectRelation('CWEType', cardinality='1*', constraints=[RQLConstraint('O final FALSE')], composite='object') constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject') cardinality = String(maxsize=2, internationalizable=True, vocabulary=CARDINALITY_VOCAB, description=_('subject/object cardinality')) ordernum = Int(description=_('control subject entity\'s relations order'), default=0) composite = String(description=_('is the subject/object entity of the relation ' 'composed of the other ? This implies that when ' 'the composite is deleted, composants are also ' 'deleted.'), vocabulary=('', _('subject'), _('object')), maxsize=8, default=None) description = RichString(internationalizable=True, description=_('semantic description of this relation'))
class File(EntityType): """a downloadable file which may contains binary data""" title = String(fulltextindexed=True, maxsize=256) data = Bytes(required=True, description='file to upload') data_format = String( required=True, maxsize=128, description=('MIME type of the file. Should be dynamically set ' 'at upload time.')) data_encoding = String( maxsize=32, description=('encoding of the file when it applies (e.g. text). ' 'Should be dynamically set at upload time.')) data_name = String( required=True, fulltextindexed=True, description=('name of the file. Should be dynamically set ' 'at upload time.')) data_hash = String( maxsize=256, # max len of currently available hash alg + prefix is 140 description=('hash of the file. May be set at upload time.'), __permissions__={ 'read': ('managers', 'users', 'guests'), 'add': (), 'update': () }) description = RichString(fulltextindexed=True, internationalizable=True, default_format='text/rest')
class CWComputedRType(EntityType): """define a virtual relation type, used to build the instance schema""" __permissions__ = PUB_SYSTEM_ENTITY_PERMS name = String(required=True, indexed=True, internationalizable=True, unique=True, maxsize=64) description = RichString(internationalizable=True, description=_('semantic description of this relation type')) rule = String(required=True)
class CWEType(EntityType): """define an entity type, used to build the instance schema""" __permissions__ = PUB_SYSTEM_ENTITY_PERMS name = String(required=True, indexed=True, internationalizable=True, unique=True, maxsize=64) description = RichString(internationalizable=True, description=_('semantic description of this entity type')) # necessary to filter using RQL final = Boolean(default=False, description=_('automatic'))
class AchatMateriaux(EntityType): date_achat = Date() type_mesure = String(vocabulary=_TYPES_MESURE, fulltextindexed=True) quantite = Float() quantite_plusieurs = Boolean(default=False, required=True, description='True if quantite is "plusieurs"') unite = String(maxsize=255, fulltextindexed=True) provenance_mesure = String(maxsize=255, fulltextindexed=True) conversion = Float() materiaux = SubjectRelation('Materiaux', cardinality='1*', inlined=True) remarques = RichString(fulltextindexed=True, default_format='text/rest')
class Person(EntityType): """a physical person""" surname = String(required=True, fulltextindexed=True, indexed=True, maxsize=64) firstname = String(fulltextindexed=True, maxsize=64) civility = String(required=True, internationalizable=True, vocabulary=('Mr', 'Ms', 'Mrs'), default='Mr') description = RichString(fulltextindexed=True) birthday = Date()
class ForumThread(EntityType): __permissions__ = { 'read': ('managers', 'users'), 'add': ('managers', 'users'), 'update': ('managers', 'owners'), 'delete': ('managers', 'owners') } title = String(required=True, fulltextindexed=True, maxsize=256) content = RichString(required=True, fulltextindexed=True) in_forum = SubjectRelation('Forum', cardinality='1*', inlined=True, composite='object')
class Transaction(EntityType): date = Date() type_achat = String(maxsize=2) # a virer ? pagination = String(maxsize=255, fulltextindexed=True) date_ordre = Date() date_recette = Date() remarques = RichString(fulltextindexed=True, default_format='text/rest') intervenants = SubjectRelation('Intervenant', composite='subject', cardinality='*1') destinataires = SubjectRelation('Destinataire', composite='subject', cardinality='*1') travaux = SubjectRelation('Travail', composite='subject', cardinality='**') vendeurs = SubjectRelation('Vendeur', composite='subject', cardinality='*1') prix_partage = Boolean(required=True, default=False) base_paradox = Boolean(default=False, description='vient de la base Paradox')
class Travail(EntityType): artisan = SubjectRelation('Personne', cardinality='1*', composite='object', inlined=True) salaire_argent = SubjectRelation('Prix', cardinality='??', inlined=True, composite='subject') salaire_nature_qt = Int() salaire_nature_obj = String(maxsize=64, fulltextindexed=True) nombre_aides = Int() designation_aides = String(maxsize=64, fulltextindexed=True) salaire_aides = SubjectRelation('Prix', cardinality='??', inlined=True, composite='subject') tache = String(maxsize=255, fulltextindexed=True) duree = Int() date_travail = Date() remarques = RichString(fulltextindexed=True, default_format='text/rest') facon_et_etoffe = Boolean(default=False, required=True)
class CWRType(EntityType): """define a relation type, used to build the instance schema""" __permissions__ = PUB_SYSTEM_ENTITY_PERMS name = String(required=True, indexed=True, internationalizable=True, unique=True, maxsize=64) description = RichString(internationalizable=True, description=_('semantic description of this relation type')) symmetric = Boolean(description=_('is this relation equivalent in both direction ?')) inlined = Boolean(description=_('is this relation physically inlined? you should know what you\'re doing if you are changing this!')) fulltext_container = String(description=_('if full text content of subject/object entity ' 'should be added to other side entity (the container).'), vocabulary=('', _('subject'), _('object')), maxsize=8, default=None) final = Boolean(description=_('automatic'))
class Personne(EntityType): identite = String(maxsize=255, required=True, fulltextindexed=True, indexed=True) nom = String(maxsize=64, fulltextindexed=True) surnom = String(maxsize=64, fulltextindexed=True) diminutif = String(maxsize=64, fulltextindexed=True) #occupation = String(maxsize=30, default='inconnue', required=True, fulltextindexed=True) titre = String(maxsize=128, fulltextindexed=True) sexe = String(vocabulary=['M', 'F', '?'], required=True, default='M') ville_domicile = String(maxsize=255, fulltextindexed=True) # XXX ville_origine = String(maxsize=255, fulltextindexed=True) # XXX lieu_domicile = SubjectRelation('Lieu', cardinality='?*', inlined=True) lieu_origine = SubjectRelation('Lieu', cardinality='?*', inlined=True) remarques= RichString(fulltextindexed=True, default_format='text/rest') rattachement = String(maxsize=64, fulltextindexed=True) #maj_occupation= Boolean(default=True) base_paradox = Boolean(default=False, description='vient de la base Paradox')
class Card(EntityType): __permissions__ = { 'read': ('managers', 'users', 'guests'), 'add': ('managers', 'users'), 'delete': ('managers', 'owners'), 'update': ( 'managers', 'owners', ), } title = String(required=True, fulltextindexed=True, maxsize=256) synopsis = String(fulltextindexed=True, maxsize=512, description=("an abstract for this card")) content = RichString(fulltextindexed=True, internationalizable=True, default_format='text/rest') wikiid = String(maxsize=64, unique=True)
class BaseTransition(EntityType): """abstract base class for transitions""" __permissions__ = PUB_SYSTEM_ENTITY_PERMS __unique_together__ = [('name', 'transition_of')] name = String(required=True, indexed=True, internationalizable=True, maxsize=256) type = String(vocabulary=(_('normal'), _('auto')), default='normal') description = RichString( description=_('semantic description of this transition')) transition_of = SubjectRelation( 'Workflow', cardinality='1*', composite='object', inlined=True, description=_('workflow to which this transition belongs'))
class FakeFile(EntityType): title = String(fulltextindexed=True, maxsize=256) data = Bytes(required=True, fulltextindexed=True, description=_('file to upload')) data_format = String( required=True, maxsize=128, description=_( 'MIME type of the file. Should be dynamically set at upload time.') ) data_encoding = String( maxsize=32, description=_('encoding of the file when it applies (e.g. text). ' 'Should be dynamically set at upload time.')) data_name = String( required=True, fulltextindexed=True, description=_( 'name of the file. Should be dynamically set at upload time.')) description = RichString(fulltextindexed=True, internationalizable=True, default_format='text/rest')