Project

General

Profile

« Previous | Next » 

Revision 11c4ef74

Added by Andreas Müller about 6 years ago

ref #5499 import included in synonyms as accepted taxa

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/edaphobase/EdaphobaseTaxonImport.java
91 91

  
92 92
    @Override
93 93
    protected void doInvoke(EdaphobaseImportState state) {
94
        makeIncludedInList(state);
94 95
        super.doInvoke(state);
95 96
    }
96 97

  
98
    private Set<Integer> includedInTaxa = new HashSet<>();
99

  
100
    /**
101
     * @param state
102
     */
103
    private void makeIncludedInList(EdaphobaseImportState state) {
104
        String sql = "SELECT sr.a_taxon_fk_taxon_id "
105
                + " FROM tax_synonym sr "
106
                + " WHERE sr.synonym_role <> 11614 ";
107
        ResultSet rs = state.getConfig().getSource().getResultSet(sql);
108
        try {
109
            while (rs.next()){
110
                Integer synId = rs.getInt("a_taxon_fk_taxon_id");
111
                includedInTaxa.add(synId);
112
            }
113
        } catch (SQLException e) {
114
            // TODO Auto-generated catch block
115
            e.printStackTrace();
116
        }
117
    }
97 118

  
98 119
    @Override
99 120
    public boolean doPartition(ResultSetPartitioner partitioner, EdaphobaseImportState state) {
......
147 168
        String grandParentNameStr = rs.getString("grandParentName");
148 169
        String grandGrandParentNameStr = rs.getString("grandGrandParentName");
149 170

  
171
        isValid = checkValid(state, id, isValid);
172

  
150 173
        TaxonBase<?> taxonBase;
151 174

  
152 175
        rankStr= extractEnglish(rankStr);
......
219 242
    }
220 243

  
221 244

  
245
    /**
246
     * @param state
247
     * @param id
248
     * @param isValid
249
     * @return
250
     */
251
    private boolean checkValid(EdaphobaseImportState state, Integer id, boolean isValid) {
252
        if (isValid){
253
            return isValid;
254
        }else if (includedInTaxa.contains(id)){
255
            return true;
256
        }else{
257
            return isValid;
258
        }
259
    }
260

  
222 261
    /**
223 262
     * @param rankStr
224 263
     * @return

Also available in: Unified diff