Project

General

Profile

« Previous | Next » 

Revision b313991f

Added by Andreas Müller over 4 years ago

adapt some classes to new CommonService.getSourcedObjectSByIdInSource and cleanup

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/edaphobase/EdaphobaseSynonymy2Import.java
41 41
 */
42 42
@Component
43 43
public class EdaphobaseSynonymy2Import extends EdaphobaseImportBase {
44

  
44 45
    private static final long serialVersionUID = 8968205268798472136L;
45 46
    private static final Logger logger = Logger.getLogger(EdaphobaseSynonymy2Import.class);
46 47

  
......
83 84
        return result;
84 85
    }
85 86

  
86

  
87 87
    @Override
88
    public boolean doPartition(ResultSetPartitioner partitioner, EdaphobaseImportState state) {
88
    public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, EdaphobaseImportState state) {
89 89
        ResultSet rs = partitioner.getResultSet();
90
        @SuppressWarnings({ "unchecked" })
90 91
        Map<String, TaxonBase> map = partitioner.getObjectMap(TAXON_NAMESPACE);
91 92
        Reference sourceReference = state.getTransactionalSourceReference();
92 93

  
......
136 137
        return true;
137 138
    }
138 139

  
139
    /**
140
     * @param state
141
     * @param taxaToSave
142
     * @param id
143
     * @param accId
144
     * @param role
145
     * @param synonymCandidate
146
     */
147
    private void handleConceptRelationship(EdaphobaseImportState state, Set<TaxonBase> taxaToSave, int id,
140
    private void handleConceptRelationship(EdaphobaseImportState state, @SuppressWarnings("rawtypes") Set<TaxonBase> taxaToSave, int id,
148 141
                Integer accId, Integer role, TaxonBase<?> fromTaxonBase) {
149
           if (!role.equals(11613)){
142

  
143
        if (!role.equals(11613)){
150 144
               String message = "Concept relation is not of type is included in ('11613'). This is not expected here. tax_synonym: " + id;
151 145
               logger.warn(message);
152 146
           }else{
......
167 161
           }
168 162
    }
169 163

  
170
    /**
171
     * @param state
172
     * @param taxaToSave
173
     * @param synId
174
     * @param accId
175
     * @param synonymCandidate
176
     * @throws SQLException
177
     */
178
    private void handleSynonymToInvalid(EdaphobaseImportState state, ResultSet rs, Set<TaxonBase> taxaToSave, Integer synId,
164
    private void handleSynonymToInvalid(EdaphobaseImportState state, ResultSet rs, @SuppressWarnings("rawtypes") Set<TaxonBase> taxaToSave, Integer synId,
179 165
            Integer accId, TaxonBase<?> synonymCandidate) throws SQLException {
180 166
        Synonym synonym = CdmBase.deproxy(synonymCandidate, Synonym.class);
181 167
        if (state.hasAcceptedTaxon(synId)){
......
212 198
    @Override
213 199
    public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs,
214 200
            EdaphobaseImportState state) {
201

  
215 202
        String nameSpace;
216
        Class<?> cdmClass;
217 203
        Set<String> idSet;
218 204
        Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>();
219 205

  
......
228 214

  
229 215
            //name map
230 216
            nameSpace = TAXON_NAMESPACE;
231
            cdmClass = TaxonBase.class;
232 217
            idSet = taxonIdSet;
233 218
            @SuppressWarnings("rawtypes")
234
            Map<String, TaxonBase> taxonMap = (Map<String, TaxonBase>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
219
            Map<String, TaxonBase> taxonMap = getCommonService().getSourcedObjectsByIdInSourceC(TaxonBase.class, idSet, nameSpace);
235 220
            result.put(nameSpace, taxonMap);
236 221

  
237 222
        } catch (SQLException e) {
......
241 226
        return result;
242 227
    }
243 228

  
244

  
245 229
    @Override
246 230
    protected boolean doCheck(EdaphobaseImportState state) {
247 231
        return true;
......
251 235
    protected boolean isIgnore(EdaphobaseImportState state) {
252 236
        return ! state.getConfig().isDoSynonyms();
253 237
    }
254

  
255 238
}

Also available in: Unified diff