Changeset 8274 for mauRepo/MolesManager
- Timestamp:
- 20/04/12 15:24:50 (9 years ago)
- Location:
- mauRepo/MolesManager/trunk/src/libs/migration/processor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/MolesManager/trunk/src/libs/migration/processor/dataEntity.py
r8269 r8274 110 110 ceda_guid.ceda_observationcollection = ceda_observationCollection.id 111 111 Moles3EPB.addCedaObject(ceda_guid, self.migrationSessions.molesSession, True) 112 DataEntityProcessor.log.info("GUI for this ObservationCollection: %s" % (ceda_guid.id))112 DataEntityProcessor.log.info("GUID for this ObservationCollection: %s" % (ceda_guid.id)) 113 113 114 114 return ceda_observationCollection -
mauRepo/MolesManager/trunk/src/libs/migration/processor/deployment.py
r8271 r8274 113 113 for np in newResponsiblePartyInfo.party: 114 114 opi.party.append(np) 115 116 def _appendResponsibleParty(self, observation, names, creation_function, role): 117 for nm in names: 118 i_party = creation_function(name = nm) 119 observation.relatedParty.append(createMO_ResponsiblePartyInfo(role, [i_party])) 115 120 116 121 117 def _assignName(self, observation): … … 131 127 132 128 i_party = createMO_Organization(name = CEDA) 133 observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_curator, [i_party])) 134 129 observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_curator, [i_party])) 130 131 ind_names = [] 132 org_names = [] 135 133 if authors.has_key(doc_authors['authors']): 136 134 tmp_auth = authors[doc_authors['authors']] 137 135 ret = self._extractIndividualsAndOrganizations(tmp_auth, whereAreAuthors) 136 138 137 if len(ret['ind']) > 0: 139 self._appendResponsibleParty(observation, ret['ind'], createCI_Individual, MO_RoleValue.cl_author) 138 i_party = createCI_Individual(name = ret['ind'][0]) 139 observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_author, [i_party])) 140 140 if len(ret['org']) > 0: 141 self._appendResponsibleParty(observation, ret['org'], createMO_Organization, MO_RoleValue.cl_author) 142 if len(ret['co_ind']) > 0: 143 self._appendResponsibleParty(observation, ret['co_ind'], createCI_Individual, MO_RoleValue.cl_coinvestigator) 144 if len(ret['co_org']) > 0: 145 self._appendResponsibleParty(observation, ret['co_org'], createMO_Organization, MO_RoleValue.cl_coinvestigator) 141 i_party = createMO_Organization(name = ret['org'][0]) 142 observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_author, [i_party])) 143 144 if len(ret['ind']) > 1: 145 ind_names.extend(ret['ind'][1:]) 146 if len(ret['org']) > 1: 147 org_names.extend(ret['org'][1:]) 148 if len(ret['co_ind']) > 1: 149 ind_names.extend(ret['co_ind']) 150 if len(ret['co_org']) > 1: 151 org_names.extend(ret['co_org']) 152 146 153 else: 147 154 raise NoAssociatedAuthor(doc_authors['authors'], migrationObject = whereAreAuthors) … … 149 156 if doc_authors['contributors'] is None: 150 157 return 151 158 152 159 if authors.has_key(doc_authors['contributors']): 153 160 tmp_auth = authors[doc_authors['contributors']] 154 161 ret = self._extractIndividualsAndOrganizations(tmp_auth, whereAreAuthors) 155 if len(ret['ind']) > 0: 156 self._appendResponsibleParty(observation, ret['ind'], createCI_Individual, MO_RoleValue.cl_coinvestigator) 157 if len(ret['org']) > 0: 158 self._appendResponsibleParty(observation, ret['org'], createMO_Organization, MO_RoleValue.cl_coinvestigator) 159 if len(ret['co_ind']) > 0: 160 self._appendResponsibleParty(observation, ret['co_ind'], createCI_Individual, MO_RoleValue.cl_coinvestigator) 161 if len(ret['co_org']) > 0: 162 self._appendResponsibleParty(observation, ret['co_org'], createMO_Organization, MO_RoleValue.cl_coinvestigator) 163 else: 164 raise NoAssociatedAuthor(doc_authors['contributors'], migrationObject = whereAreAuthors) 165 162 ind_names.extend(ret['ind']) 163 ind_names.extend(ret['co_ind']) 164 org_names.extend(ret['org']) 165 org_names.extend(ret['co_org']) 166 167 i_party = [] 168 for nm in ind_names: 169 i_party.append(createCI_Individual(name = nm)) 170 if i_party: 171 observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_coinvestigator, [i_party])) 172 173 del i_party[:] 174 for nm in org_names: 175 i_party.append(createMO_Organization(name = nm)) 176 if i_party: 177 observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_coinvestigator, [i_party])) 166 178 167 179 def _extractIndividualsAndOrganizations(self, tmp_auth, whereAreAuthors): … … 169 181 raise Exception("migrationObject is None") 170 182 try: 183 if tmp_auth['author'] == 'unknown': 184 doc_authors = findAuthorsInResource(self._dataEntityMigration) 185 tmp_auth = authors[doc_authors['authors']] 186 171 187 ret = {'ind': [], 'org': [], 'co_ind': [], 'co_org': []} 172 188 if tmp_auth['type'] == 'ind': 173 189 ret['ind'].append(tmp_auth['author']) 174 190 elif tmp_auth['type'] == 'org': 175 ret['org'].append(tmp_auth['author']) 176 191 ret['org'].append(tmp_auth['author']) 192 177 193 if tmp_auth['author'] == 'unknown': 178 194 DeploymentProcessor.log.debug("%s %s %s has unknown author" \ 179 195 % (whereAreAuthors.doc_status, whereAreAuthors.doc_owner, whereAreAuthors.doc_name)) 196 197 for item in tmp_auth['co_author_type']: 198 if (tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)] == 'unknown'): 199 doc_authors = findAuthorsInResource(self._dataEntityMigration) 200 tmp_auth = authors[doc_authors['contributors']] 201 break 180 202 181 203 for item in tmp_auth['co_author_type']: 182 204 if item == 'ind': 183 ret[' ind'].append(tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)])205 ret['co_ind'].append(tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)]) 184 206 elif item == 'org': 185 ret[' org'].append(tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)])207 ret['co_org'].append(tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)]) 186 208 187 209 if (tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)] == 'unknown'):
Note: See TracChangeset
for help on using the changeset viewer.