Project

General

Profile

« Previous | Next » 

Revision e11ce0a9

Added by Andreas Müller almost 2 years ago

cleanup

View differences:

cdm-eflora/src/main/java/eu/etaxonomy/cdm/io/eflora/EfloraImportBase.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
28 28
/**
29 29
 * @author a.mueller
30 30
 * @since 04.08.2008
31
 * @version 1.0
32 31
 */
33 32
public abstract class EfloraImportBase  extends CdmImportBase<EfloraImportConfigurator, EfloraImportState> {
34
	private static final Logger logger = Logger.getLogger(EfloraImportBase.class);
35 33

  
36
	
37
	protected abstract void doInvoke(EfloraImportState state);
34
    private static final Logger logger = Logger.getLogger(EfloraImportBase.class);
35

  
36
	@Override
37
    protected abstract void doInvoke(EfloraImportState state);
38 38

  
39
	
40
	
41 39
	protected Element getBodyElement(EfloraImportConfigurator config){
42 40
		Element root = config.getSourceRoot();
43
		
41

  
44 42
		if (! "publication".equalsIgnoreCase(root.getName())){
45 43
			logger.error("Root element is not 'publication'");
46 44
			return null;
47 45
		}
48 46
		//TODO prevent multiple elements
49
		
47

  
50 48
		return root;
51 49
	}
52
	
53
	
50

  
54 51
	protected boolean testAdditionalElements(Element parentElement, List<String> excludeList){
55 52
		boolean result = true;
56 53
		List<Element> list = parentElement.getChildren();
......
62 59
		}
63 60
		return result;
64 61
	}
65
	
66
	
62

  
63

  
67 64
	protected <T extends IdentifiableEntity> T makeReferenceType(Element element, Class<? extends T> clazz, MapWrapper<? extends T> objectMap, ResultWrapper<Boolean> success){
68 65
		T result = null;
69 66
		String linkType = element.getAttributeValue("linkType");
......
92 89
		}
93 90
		return result;
94 91
	}
95
	
96
	
92

  
93

  
97 94
	protected Reference makeAccordingTo(Element elAccordingTo, MapWrapper<Reference> referenceMap, ResultWrapper<Boolean> success){
98 95
		Reference result = null;
99 96
		if (elAccordingTo != null){
......
104 101
			childName = "Simple";
105 102
			obligatory = true;
106 103
			Element elSimple = XmlHelp.getSingleChildElement(success, elAccordingTo, childName, elAccordingTo.getNamespace(), obligatory);
107
			
104

  
108 105
			if (elAccordingToDetailed != null){
109 106
				result = makeAccordingToDetailed(elAccordingToDetailed, referenceMap, success);
110 107
			}else{
......
115 112
		}
116 113
		return result;
117 114
	}
118
	
119
	
115

  
120 116
	private Reference makeAccordingToDetailed(Element elAccordingToDetailed, MapWrapper<Reference> referenceMap, ResultWrapper<Boolean> success){
121 117
		Reference result = null;
122 118
		Namespace tcsNamespace = elAccordingToDetailed.getNamespace();
......
126 122
			boolean obligatory = false;
127 123
			Element elAuthorTeam = XmlHelp.getSingleChildElement(success, elAccordingToDetailed, childName, tcsNamespace, obligatory);
128 124
			makeAccordingToAuthorTeam(elAuthorTeam, success);
129
			
125

  
130 126
			//PublishedIn
131 127
			childName = "PublishedIn";
132 128
			obligatory = false;
133 129
			Element elPublishedIn = XmlHelp.getSingleChildElement(success, elAccordingToDetailed, childName, tcsNamespace, obligatory);
134 130
			result = makeReferenceType(elPublishedIn, Reference.class, referenceMap, success);
135
			
131

  
136 132
			//MicroReference
137 133
			childName = "MicroReference";
138 134
			obligatory = false;
......
140 136
			String microReference = elMicroReference.getTextNormalize();
141 137
			if (CdmUtils.Nz(microReference).equals("")){
142 138
				//TODO
143
				logger.warn("MicroReference not yet implemented for AccordingToDetailed");	
139
				logger.warn("MicroReference not yet implemented for AccordingToDetailed");
144 140
			}
145 141
		}
146 142
		return result;
147 143
	}
148 144

  
149
	private Team makeAccordingToAuthorTeam(Element elAuthorTeam, ResultWrapper<Boolean> succes){
145
	private Team makeAccordingToAuthorTeam(Element elAuthorTeam, ResultWrapper<Boolean> success){
150 146
		Team result = null;
151 147
		if (elAuthorTeam != null){
152 148
			//TODO
......
154 150
		}
155 151
		return result;
156 152
	}
157

  
158

  
159

  
160
}
153
}

Also available in: Unified diff