871 |
871 |
872 def generate(self, entity, rtype): |
872 def generate(self, entity, rtype): |
873 return getattr(self, 'gen_%s' % rtype)(entity) |
873 return getattr(self, 'gen_%s' % rtype)(entity) |
874 |
874 |
875 def gen_cwuri(self, entity): |
875 def gen_cwuri(self, entity): |
876 return u'%seid/%s' % (self.baseurl, entity.eid) |
876 return u'%s%s' % (self.baseurl, entity.eid) |
877 |
877 |
878 def gen_creation_date(self, entity): |
878 def gen_creation_date(self, entity): |
879 return self.time |
879 return self.time |
880 def gen_modification_date(self, entity): |
880 def gen_modification_date(self, entity): |
881 return self.time |
881 return self.time |
1113 self._append_to_entities(sql, attrs) |
1113 self._append_to_entities(sql, attrs) |
1114 |
1114 |
1115 def _handle_source_relation_sql(self, session, sql, attrs): |
1115 def _handle_source_relation_sql(self, session, sql, attrs): |
1116 self._append_to_entities(sql, attrs) |
1116 self._append_to_entities(sql, attrs) |
1117 |
1117 |
1118 # XXX add_info is similar to the one in NativeSQLSource. It is rewritten |
1118 # add_info is _copypasted_ from the one in NativeSQLSource. We want it |
1119 # here to correctly used the _handle_xxx of the SQLGenSourceWrapper. This |
1119 # there because it will use the _handlers of the SQLGenSourceWrapper, which |
1120 # part should be rewritten in a more clearly way. |
1120 # are not like the ones in the native source. |
1121 def add_info(self, session, entity, source, extid, complete): |
1121 def add_info(self, session, entity, source, extid, complete): |
1122 """add type and source info for an eid into the system table""" |
1122 """add type and source info for an eid into the system table""" |
1123 # begin by inserting eid/type/source/extid into the entities table |
1123 # begin by inserting eid/type/source/extid into the entities table |
1124 if extid is not None: |
1124 if extid is not None: |
1125 assert isinstance(extid, str) |
1125 assert isinstance(extid, str) |