Project

General

Profile

« Previous | Next » 

Revision 379eb203

Added by Andreas Müller over 3 years ago

cleanup

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/SpecimenUserInteraction.java
50 50
/**
51 51
 * @author pkelbert
52 52
 * @since 21 juin 2013
53
 *
54 53
 */
55 54
public class SpecimenUserInteraction implements ItemListener, Serializable {
56 55

  
56
    private static final long serialVersionUID = 6384263183459028523L;
57
    @SuppressWarnings("unused")
57 58
    private static Logger log = Logger.getLogger(SpecimenUserInteraction.class);
58 59

  
59 60
    public Classification askForClassification(Map<String, Classification> classMap){
......
87 88
        return classMap.get(s);
88 89
    }
89 90

  
90

  
91

  
92 91
    /**
93 92
     * @return the name for the new Classification
94 93
     */
......
113 112
        return s;
114 113
    }
115 114

  
116

  
117 115
    /**
118 116
     * @param refMap
119 117
     * @return
120 118
     */
121
    @SuppressWarnings("rawtypes")
122 119
    public Reference askForReference(Map<String, Reference> refMap) {
123
        List<String>  possibilities = new ArrayList<String> (refMap.keySet());
120
        List<String>  possibilities = new ArrayList<>(refMap.keySet());
124 121
        Collections.sort(possibilities);
125 122
        if (refMap.keySet().size()>0) {
126 123
            refMap.put("Nothing matches, create a new reference",null);
......
149 146
        return refMap.get(s);
150 147
    }
151 148

  
152

  
153

  
154

  
155

  
156 149
    /**
157 150
     * @param refMap
158 151
     * @param iReferenceService
159 152
     * @param docSources
160 153
     * @return
161 154
     */
162
    @SuppressWarnings("rawtypes")
163 155
    public List<OriginalSourceBase<?>> askForSource(Map<String, OriginalSourceBase<?>> refMap, String currentElement, String blabla,
164 156
            IReferenceService iReferenceService, List<String> docSources) {
165 157

  
166 158
//        System.out.println(refMap);
167
        List<String>  possibilities = new ArrayList<String> (refMap.keySet());
159
        List<String>  possibilities = new ArrayList<> (refMap.keySet());
168 160

  
169
        Set<String> all = new HashSet<String>();
161
        Set<String> all = new HashSet<>();
170 162
        all.addAll(possibilities);
171 163

  
172 164
        List<String> allList = new ArrayList<String>();
......
233 225
                    sources.add(a);
234 226
                }
235 227
            }
236

  
237 228
        }
238 229

  
239

  
240

  
241
        List<OriginalSourceBase<?>> dess = new ArrayList<OriginalSourceBase<?>>();
230
        List<OriginalSourceBase<?>> dess = new ArrayList<>();
242 231
        for (String src:sources){
243 232
            if (refMap.get(src) !=null) {
244 233
                dess.add(refMap.get(src));
......
273 262
        return dess;
274 263
    }
275 264

  
276

  
277
    /**
278
     * @return
279
     */
280 265
    public String createNewReference() {
281 266
        JTextArea textArea = new JTextArea("How should the reference be named ?");
282 267
        JScrollPane scrollPane = new JScrollPane(textArea);
......
298 283
        return s;
299 284
    }
300 285

  
301
    /**
302
     * @return
303
     */
304 286
    public String createNewSource() {
305 287
        JTextArea textArea = new JTextArea("How should the source be named? If there is a citation detail, prefix it with 3 minus signs ('---').");
306 288
        JScrollPane scrollPane = new JScrollPane(textArea);
......
322 304
        return s;
323 305
    }
324 306

  
325

  
326
    /**
327
     * @param descriptions
328
     */
329 307
    public TaxonDescription askForDescriptionGroup(Set<TaxonDescription> descriptions) {
330 308
        JTextArea textArea = new JTextArea("One or several description group(s) does already exist for this taxon.");
331 309
        JScrollPane scrollPane = new JScrollPane(textArea);
......
344 322
            for (IdentifiableSource s:sources) {
345 323
                src.add(s.getCitation().getTitleCache());
346 324
            }
347
            List<String> srcb = new ArrayList<String>(new HashSet<String>(src));
325
            List<String> srcb = new ArrayList<String>(new HashSet<>(src));
348 326
            if (srcb.size()>0) {
349 327
                if(descrMap.containsKey(descCnt+": "+description.getTitleCache()+"("+StringUtils.join(srcb,";")+")")) {
350 328
                    descCnt+=1;
......
363 341
                //            }
364 342
            }
365 343
        }
366
        List<String>  possibilities = new ArrayList<String> (descrMap.keySet());
344
        List<String>  possibilities = new ArrayList<>(descrMap.keySet());
367 345
        if (possibilities.size()==0) {
368 346
            return null;
369 347
        }
......
389 367
        } else {
390 368
            return null;
391 369
        }
392

  
393 370
    }
394 371

  
395

  
396 372
    /**
397 373
     * Look if the same name already exists in the ALL classifications and ask the user to select one or none.
398 374
     * @param scientificName
......
401 377
     */
402 378
    @SuppressWarnings("rawtypes")
403 379
    public Taxon askWhereToFixData(String scientificName, List<TaxonBase> taxonList, Classification classification) {
404
        Map<String,TaxonNode> classMap = new HashMap<String, TaxonNode>();
380
        Map<String,TaxonNode> classMap = new HashMap<>();
405 381
        boolean sameClassification=false;
406 382
        Taxon n = null;
407 383
        for (TaxonBase taxonBase: taxonList){
......
476 452
        return taxonFound;
477 453
    }
478 454

  
479

  
480
    List<String> sources = new ArrayList<String>();
455
    List<String> sources = new ArrayList<>();
481 456
    String currentSource = "";
482
    /* (non-Javadoc)
483
     * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
484
     */
457

  
485 458
    @Override
486 459
    public void itemStateChanged(ItemEvent e) {
487 460
        JRadioButton cb = (JRadioButton) e.getItem();
......
493 466
            currentSource="";
494 467
        }
495 468
    }
496

  
497

  
498

  
499 469
}

Also available in: Unified diff