Project

General

Profile

« Previous | Next » 

Revision b20f0d73

Added by Andreas Müller 5 months ago

cleanup

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/DeltaTextDataProcessor.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
1 9
package eu.etaxonomy.cdm.api.service;
2 10

  
3 11
import java.util.Map;
......
8 16
import eu.etaxonomy.cdm.model.common.LanguageString;
9 17
import eu.etaxonomy.cdm.model.description.TextData;
10 18

  
19
/**
20
 * @author m.venin
21
 * @since 2010-12-02
22
 */
11 23
public class DeltaTextDataProcessor implements INaturalLanguageTextDataProcessor {
12 24

  
13 25
	@Override
14 26
	public void process(TextData textData, TextData previousTextData) {
15 27
		boolean doItBetter = false;
16
		
28

  
17 29
		Map<Language,LanguageString> previousMultiLanguageText = previousTextData.getMultilanguageText();
18 30
		Map<Language,LanguageString> multiLanguageText = textData.getMultilanguageText();
19
		
31

  
20 32
		for (Language language : multiLanguageText.keySet()){
21 33
			LanguageString langString = multiLanguageText.get(language);
22 34
			String text = langString.getText();
23
			
35

  
24 36
			LanguageString tmpMultilangText = previousMultiLanguageText.get(language);
25 37
			if( tmpMultilangText != null){
26 38
				text = StringUtils.remove(text, tmpMultilangText.getText());
27 39
			}
28
			
40

  
29 41
			if (doItBetter) { //TODO remove the text between brackets
30 42
				StringBuilder strbuilder = new StringBuilder();
31 43
				do	{
......
37 49
			else{
38 50
				text=StringUtils.replaceChars(text,"<>","");
39 51
			}
40
			
52

  
41 53
			textData.removeText(language);
42 54
			textData.putText(language, text);
43
			
44 55
		}
45
		
46 56
	}
47

  
48 57
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/NaturalLanguageGenerator.java
36 36
 */
37 37
@Component
38 38
public class NaturalLanguageGenerator implements INaturalLanguageGenerator {
39
	
39 40
	@SuppressWarnings("unused")
40 41
	private static final Logger logger = Logger.getLogger(NaturalLanguageGenerator.class);
41 42

  
42 43
	private String firstSeparator = ",";
43 44
	private String secondSeparator = ".";
44
	private List<Integer> levels = new ArrayList<Integer>();
45
	private List<Integer> levels = new ArrayList<>();
45 46

  
46 47
	private DescriptionBuilder<QuantitativeData> quantitativeDescriptionBuilder = new DefaultQuantitativeDescriptionBuilder();
47 48
	private DescriptionBuilder<CategoricalData> categoricalDescriptionBuilder = new DefaultCategoricalDescriptionBuilder();
48 49

  
49 50
	private TextData previousTextData;
50 51

  
51
	DeltaTextDataProcessor deltaTextDataProcessor = new DeltaTextDataProcessor();
52
	private DeltaTextDataProcessor deltaTextDataProcessor = new DeltaTextDataProcessor();
52 53

  
53 54
	private Map<String, INaturalLanguageTextDataProcessor> elementProcessors;
54 55

  

Also available in: Unified diff