def __init__(self, name, profile, supports_documents=True, layer_display=''): Entity.__init__(self, name, profile, supports_documents=supports_documents) self.user_editable = False self._party = None self._spatial_unit = None self._view_name = u'{0}_{1}'.format( self.profile.name.replace(' ', '_').lower(), SocialTenure.BASE_STR_VIEW ) self.party_foreign_key = ForeignKeyColumn('party_id', self) self.spatial_unit_foreign_key = ForeignKeyColumn('spatial_unit_id', self) self.tenure_type_lookup = LookupColumn('tenure_type', self) self.layer_display_name = layer_display self._value_list = self._prepare_tenure_type_value_list() #Add the value list to the table collection self.profile.add_entity(self._value_list) #Add columns to the collection self.add_column(self.party_foreign_key) self.add_column(self.spatial_unit_foreign_key) self.add_column(self.tenure_type_lookup) #Specify if a spatial unit should only be linked to one party self.multi_party = True LOGGER.debug('Social Tenure Relationship initialized for %s profile.', self.profile.name)
def __init__(self, name, profile, **kwargs): Entity.__init__(self, name, profile, supports_documents=False) self.user_editable = False self.is_associative = True self.first_reference_column = None self.second_reference_column = None self.first_parent = kwargs.get('first_parent', None) self.second_parent = kwargs.get('second_parent', None)
def __init__(self, profile): Entity.__init__(self, 'auto_generate_code', profile, is_global=False, is_proxy=False, supports_documents=False) self.user_editable = False self.auto_generate_code_name = VarCharColumn('code', self, maximum=50) LOGGER.debug('%s Auto Generate Code entity initialized.', self.name) # Add columns self.add_column(self.auto_generate_code_name)
def __init__(self, name, profile, supports_documents=True, layer_display=''): Entity.__init__(self, name, profile, supports_documents=supports_documents) self.user_editable = False self._party = None self._spatial_unit = None self._view_name = None self.party_foreign_key = ForeignKeyColumn('party_id', self) self.spatial_unit_foreign_key = ForeignKeyColumn( 'spatial_unit_id', self) self.tenure_type_lookup = LookupColumn('tenure_type', self) # Added in v1.5 self.validity_start_column = DateColumn('validity_start', self, index=True) self.validity_end_column = DateColumn('validity_end', self, index=True) self.tenure_share_column = PercentColumn('tenure_share', self) self.layer_display_name = layer_display self._value_list = self._prepare_tenure_type_value_list() # Add the value list to the table collection self.profile.add_entity(self._value_list) # Add columns to the collection self.add_column(self.spatial_unit_foreign_key) self.add_column(self.tenure_type_lookup) self.add_column(self.validity_start_column) self.add_column(self.validity_end_column) self.add_column(self.tenure_share_column) # Added in v1.5 self._party_fk_columns = OrderedDict() #Names of party entities that have been removed self.removed_parties = [] # Specify if a spatial unit should only be linked to one party self.multi_party = True LOGGER.debug('Social Tenure Relationship initialized for %s profile.', self.profile.name)
def __init__(self, name, profile): #Assert if 'check' prefix has been appended. name = self._append_check(name) Entity.__init__(self, name, profile, supports_documents=False) self.user_editable = False self.code_column = VarCharColumn('code', self, minimum=0, maximum=5) self.value_column = VarCharColumn('value', self, minimum=2, maximum=50) self.values = OrderedDict() #Attach columns self.add_column(self.code_column) self.add_column(self.value_column) LOGGER.debug('%s ValueList initialized.', self.name)
def __init__(self, name, profile): # Assert if 'check' prefix has been appended. name = self._append_check(name) Entity.__init__(self, name, profile, supports_documents=False) self.user_editable = False self.code_column = VarCharColumn('code', self, minimum=0, maximum=5) self.value_column = VarCharColumn('value', self, minimum=2, maximum=50) self.values = OrderedDict() self._hash = hashlib # Attach columns self.add_column(self.code_column) self.add_column(self.value_column) LOGGER.debug('%s ValueList initialized.', self.name)
def __init__(self, profile): Entity.__init__(self, 'admin_spatial_unit_set', profile, is_global=True, is_proxy=True, supports_documents=False) self.user_editable = False self.admin_unit_name = VarCharColumn('name', self, maximum=70) self.admin_unit_code = VarCharColumn('code', self, maximum=10) LOGGER.debug('%s Administrative Spatial Unit set initialized.', self.name) #Add columns self.add_column(self.admin_unit_name) self.add_column(self.admin_unit_code)
def __init__(self, profile): Entity.__init__(self, 'admin_spatial_unit_set', profile, is_global=True, is_proxy=True, supports_documents=False) self.user_editable = False self.admin_unit_name = VarCharColumn('name', self, maximum=70) self.admin_unit_code = VarCharColumn('code', self, maximum=10) self.admin_parent_id = ForeignKeyColumn('parent_id', self) self.admin_parent_id.set_entity_relation_attr('parent', self) self.admin_parent_id.set_entity_relation_attr('parent_column', 'id') LOGGER.debug('%s Administrative Spatial Unit set initialized.', self.name) # Add columns self.add_column(self.admin_unit_name) self.add_column(self.admin_unit_code) self.add_column(self.admin_parent_id)
def __init__(self, profile): Entity.__init__(self, 'supporting_document', profile, supports_documents=False) self.user_editable = False self.creation_date = DateTimeColumn('creation_date', self) self.document_identifier = VarCharColumn('document_identifier', self, maximum=50) self.document_type = VarCharColumn('source_entity', self, maximum=150) self.document_size = IntegerColumn('document_size', self) self.filename = VarCharColumn('filename', self, maximum=200) LOGGER.debug('%s supporting document initialized.', self.name) # Add columns to the entity self.add_column(self.creation_date) self.add_column(self.document_identifier) self.add_column(self.document_type) self.add_column(self.document_size) self.add_column(self.filename)