Revision e773b6b9
Added by Patrick Plitzner almost 10 years ago
- merge update from trunk
.gitattributes | ||
---|---|---|
777 | 777 |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/WrongTermTypeException.java -text |
778 | 778 |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/init/ITermInitializer.java -text |
779 | 779 |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/init/ITermLoader.java -text |
780 |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/init/MockCdmCacher.java -text |
|
780 | 781 |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/init/TermLoader.java -text |
781 | 782 |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/init/TermNotFoundException.java -text |
782 | 783 |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/package-info.java -text |
... | ... | |
1108 | 1109 |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/aspectj/PropertyChangeTest.java -text |
1109 | 1110 |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/datagenerator/TaxonGenerator.java -text |
1110 | 1111 |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/DatabaseInitialiser.java -text |
1111 |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/MockCdmCacher.java -text |
|
1112 | 1112 |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/agent/AgentValidationTest.java -text |
1113 | 1113 |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/agent/InstitutionalMembershipTest.java -text |
1114 | 1114 |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/agent/TeamTest.java -text |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoService.java | ||
---|---|---|
295 | 295 |
@Override |
296 | 296 |
public DistributionInfoDTO composeDistributionInfoFor(EnumSet<DistributionInfoDTO.InfoPart> parts, UUID taxonUUID, |
297 | 297 |
boolean subAreaPreference, boolean statusOrderPreference, Set<MarkerType> hideMarkedAreas, |
298 |
Set<NamedAreaLevel> omitLevels, |
|
298 |
Set<NamedAreaLevel> omitLevels, Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors,
|
|
299 | 299 |
List<Language> languages, List<String> propertyPaths){ |
300 | 300 |
|
301 | 301 |
DistributionInfoDTO dto = new DistributionInfoDTO(); |
... | ... | |
313 | 313 |
} |
314 | 314 |
|
315 | 315 |
if (parts.contains(InfoPart.mapUriParams)) { |
316 |
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors = null; |
|
317 | 316 |
dto.setMapUriParams(EditGeoServiceUtilities.getDistributionServiceRequestParameterString(filteredDistributions, |
318 | 317 |
subAreaPreference, |
319 | 318 |
statusOrderPreference, |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoServiceUtilities.java | ||
---|---|---|
11 | 11 |
package eu.etaxonomy.cdm.ext.geo; |
12 | 12 |
|
13 | 13 |
import java.awt.Color; |
14 |
import java.io.IOException; |
|
14 | 15 |
import java.io.UnsupportedEncodingException; |
15 | 16 |
import java.net.URLEncoder; |
16 | 17 |
import java.util.ArrayList; |
... | ... | |
27 | 28 |
|
28 | 29 |
import org.apache.commons.lang.StringUtils; |
29 | 30 |
import org.apache.log4j.Logger; |
31 |
import org.codehaus.jackson.JsonParseException; |
|
32 |
import org.codehaus.jackson.map.JsonMappingException; |
|
33 |
import org.codehaus.jackson.map.ObjectMapper; |
|
34 |
import org.codehaus.jackson.map.type.MapType; |
|
35 |
import org.codehaus.jackson.map.type.TypeFactory; |
|
30 | 36 |
|
37 |
import eu.etaxonomy.cdm.api.service.ITermService; |
|
31 | 38 |
import eu.etaxonomy.cdm.api.utility.DescriptionUtility; |
32 | 39 |
import eu.etaxonomy.cdm.common.CdmUtils; |
33 | 40 |
import eu.etaxonomy.cdm.model.common.Language; |
... | ... | |
35 | 42 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
36 | 43 |
import eu.etaxonomy.cdm.model.common.Representation; |
37 | 44 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
45 |
import eu.etaxonomy.cdm.model.description.AbsenceTerm; |
|
38 | 46 |
import eu.etaxonomy.cdm.model.description.Distribution; |
39 | 47 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase; |
40 | 48 |
import eu.etaxonomy.cdm.model.description.PresenceTerm; |
... | ... | |
70 | 78 |
EditGeoServiceUtilities.termDao= termDao; |
71 | 79 |
} |
72 | 80 |
|
81 |
|
|
73 | 82 |
private static HashMap<SpecimenOrObservationType, Color> defaultSpecimenOrObservationTypeColors = null; |
74 | 83 |
|
75 | 84 |
private static HashMap<SpecimenOrObservationType, Color> getDefaultSpecimenOrObservationTypeColors() { |
... | ... | |
716 | 725 |
return (char)ascii; |
717 | 726 |
} |
718 | 727 |
|
728 |
/** |
|
729 |
* @param statusColorJson for example: {@code {"n":"#ff0000","p":"#ffff00"}} |
|
730 |
* @return |
|
731 |
* @throws IOException |
|
732 |
* @throws JsonParseException |
|
733 |
* @throws JsonMappingException |
|
734 |
*/ |
|
735 |
public static Map<PresenceAbsenceTermBase<?>, Color> buildStatusColorMap(String statusColorJson, ITermService termService) throws IOException, JsonParseException, |
|
736 |
JsonMappingException { |
|
737 |
|
|
738 |
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors = null; |
|
739 |
if(StringUtils.isNotEmpty(statusColorJson)){ |
|
740 |
|
|
741 |
ObjectMapper mapper = new ObjectMapper(); |
|
742 |
// TODO cache the color maps to speed this up? |
|
743 |
|
|
744 |
TypeFactory typeFactory = mapper.getTypeFactory(); |
|
745 |
MapType mapType = typeFactory.constructMapType(HashMap.class, String.class, String.class); |
|
746 |
|
|
747 |
Map<String,String> statusColorMap = mapper.readValue(statusColorJson, mapType); |
|
748 |
UUID presenceTermVocabUuid = PresenceTerm.NATIVE().getVocabulary().getUuid(); |
|
749 |
UUID absenceTermVocabUuid = AbsenceTerm.ABSENT().getVocabulary().getUuid(); |
|
750 |
presenceAbsenceTermColors = new HashMap<PresenceAbsenceTermBase<?>, Color>(); |
|
751 |
PresenceAbsenceTermBase<?> paTerm = null; |
|
752 |
for(String statusId : statusColorMap.keySet()){ |
|
753 |
try { |
|
754 |
Color color = Color.decode(statusColorMap.get(statusId)); |
|
755 |
paTerm = termService.findByIdInVocabulary(statusId, presenceTermVocabUuid, PresenceTerm.class); |
|
756 |
if(paTerm == null){ |
|
757 |
paTerm = termService.findByIdInVocabulary(statusId, absenceTermVocabUuid, AbsenceTerm.class); |
|
758 |
} |
|
759 |
if(paTerm != null){ |
|
760 |
presenceAbsenceTermColors.put(paTerm, color); |
|
761 |
} |
|
762 |
} catch (NumberFormatException e){ |
|
763 |
logger.error("Cannot decode color", e); |
|
764 |
} |
|
765 |
} |
|
766 |
} |
|
767 |
return presenceAbsenceTermColors; |
|
768 |
} |
|
769 |
|
|
719 | 770 |
} |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/IEditGeoService.java | ||
---|---|---|
194 | 194 |
* @param statusOrderPreference see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)} |
195 | 195 |
* @param hideMarkedAreas see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)} |
196 | 196 |
* @param omitLevels see {@link DescriptionUtility#orderDistributions(Set, Collection)} |
197 |
* @param presenceAbsenceTermColors |
|
197 | 198 |
* @param languages |
198 | 199 |
* @param propertyPaths |
199 | 200 |
* @return |
200 | 201 |
*/ |
201 | 202 |
public DistributionInfoDTO composeDistributionInfoFor(EnumSet<DistributionInfoDTO.InfoPart> parts, UUID taxonUUID, |
202 | 203 |
boolean subAreaPreference, boolean statusOrderPreference, Set<MarkerType> hideMarkedAreas, |
203 |
Set<NamedAreaLevel> omitLevels, |
|
204 |
Set<NamedAreaLevel> omitLevels, Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors,
|
|
204 | 205 |
List<Language> languages, List<String> propertyPaths); |
205 | 206 |
|
206 | 207 |
} |
cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/EditGeoServiceTest.java | ||
---|---|---|
106 | 106 |
@Test |
107 | 107 |
public void testGetWebServiceUrlCountry() throws MalformedURLException, IOException { |
108 | 108 |
Set<Distribution> distributions = new HashSet<Distribution>(); |
109 |
Country germany = termService.getDefinedTermByIdInVocabulary("DEU", Country.uuidCountryVocabulary, Country.class, null, null);
|
|
109 |
Country germany = termService.findByIdInVocabulary("DEU", Country.uuidCountryVocabulary, Country.class);
|
|
110 | 110 |
// germany = (Country)termService.find(665); |
111 | 111 |
// germany = (Country)termService.find(UUID.fromString("cbe7ce69-2952-4309-85dd-0d7d4a4830a1")); |
112 | 112 |
|
113 | 113 |
// germany = Country.GERMANY(); |
114 | 114 |
|
115 | 115 |
distributions.add(Distribution.NewInstance(germany, PresenceTerm.PRESENT())); |
116 |
distributions.add(Distribution.NewInstance(termService.getDefinedTermByIdInVocabulary("DE", Country.uuidCountryVocabulary, Country.class, null, null), PresenceTerm.INTRODUCED()));
|
|
116 |
distributions.add(Distribution.NewInstance(termService.findByIdInVocabulary("DE", Country.uuidCountryVocabulary, Country.class), PresenceTerm.INTRODUCED()));
|
|
117 | 117 |
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceColorMap = new HashMap<PresenceAbsenceTermBase<?>, Color>(); |
118 | 118 |
presenceAbsenceColorMap.put(PresenceTerm.PRESENT(), Color.BLUE); |
119 | 119 |
presenceAbsenceColorMap.put(PresenceTerm.INTRODUCED(), Color.BLACK); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/berlinModel/BerlinModelTransformer.java | ||
---|---|---|
106 | 106 |
public static final UUID uuidTurkey = UUID.fromString("d344ee2c-14c8-438d-b03d-11538edb1268"); |
107 | 107 |
public static final UUID uuidCaucasia = UUID.fromString("ebfd3fd1-3859-4e5e-95c7-f66010599d7e"); |
108 | 108 |
|
109 |
|
|
110 |
//E+M areas |
|
111 |
public static UUID uuidEM = UUID.fromString("111BDF38-7A32-440A-9808-8AF1C9E54B51"); |
|
112 |
public static UUID uuidEUR = UUID.fromString("80B3CEEE-2F78-45CE-B4F4-E473F5ED8343"); |
|
113 |
public static UUID uuid14 = UUID.fromString("4FF83A35-97DE-4C39-BEDE-27EE9ECEFB45"); |
|
114 |
public static UUID uuid20 = UUID.fromString("19D93AD1-59E7-49ED-B513-D7D493EDC4DE"); |
|
115 |
public static UUID uuid21 = UUID.fromString("1B98DAF0-A709-4871-9A8B-CFDD09F41763"); |
|
116 |
public static UUID uuid33 = UUID.fromString("6B719260-1E48-4D85-8BC3-320852E1B331"); |
|
117 |
public static UUID uuidDa = UUID.fromString("867871C9-9931-47D0-AEF7-468B9519EBB2"); |
|
118 |
public static UUID uuidFe = UUID.fromString("C4EF26AF-11E0-4888-9FC3-5E56F4422BB4"); |
|
119 |
public static UUID uuidFa = UUID.fromString("70426E7E-2EAA-4987-95FB-5CB6E56980F3"); |
|
120 |
public static UUID uuidBr = UUID.fromString("A22329C4-0B81-4E00-BCC3-2F44A6CA56D0"); |
|
121 |
public static UUID uuidIs = UUID.fromString("3D2950E9-C2FD-462E-9697-DCB7241D514E"); |
|
122 |
public static UUID uuidHb = UUID.fromString("65E405E7-B3D4-44B6-BE67-4881582EA274"); |
|
123 |
public static UUID uuidNo = UUID.fromString("2D3F1181-6838-4034-96CB-F254A558572A"); |
|
124 |
public static UUID uuidSb = UUID.fromString("BC847AF8-30C3-48B2-A881-2B2DEAC0A137"); |
|
125 |
public static UUID uuidSu = UUID.fromString("F064AB9F-EDDB-47D8-8E54-B9E8AD19111D"); |
|
126 |
public static UUID uuidAu = UUID.fromString("37C77C23-9673-4ABC-87C2-B29E9FA87FA8"); |
|
127 |
public static UUID uuidBe = UUID.fromString("4840373B-F949-4630-B655-9B37F845CFDA"); |
|
128 |
public static UUID uuidCz = UUID.fromString("02E67A70-C192-4A01-A311-99F8C42F9D51"); |
|
129 |
public static UUID uuidGe = UUID.fromString("F617DDEA-51C9-4EF1-B7F4-ED22F871631D"); |
|
130 |
public static UUID uuidHu = UUID.fromString("AD7EDDB1-C089-436F-88BA-BC9115BBD6E0"); |
|
131 |
public static UUID uuidHo = UUID.fromString("00B8FE6D-D04B-4CAC-ADCE-32B44ABB385A"); |
|
132 |
public static UUID uuidPo = UUID.fromString("F23864DF-DFD6-4ABC-B7D0-FD97408AE0A9"); |
|
133 |
public static UUID uuidHe = UUID.fromString("7C28D878-F16D-4043-A94E-750BEF910064"); |
|
134 |
public static UUID uuidBl = UUID.fromString("A4326211-3219-4655-83AD-599D635DB638"); |
|
135 |
public static UUID uuidCo = UUID.fromString("3EE3CB3E-23DE-491F-94DF-35DB7A1D3AC0"); |
|
136 |
public static UUID uuidGa = UUID.fromString("28591C04-60E3-432A-9D05-CBC945462D2E"); |
|
137 |
public static UUID uuidLu = UUID.fromString("205512B0-AA22-4041-B92B-336FEB79FA4F"); |
|
138 |
public static UUID uuidSa = UUID.fromString("11368A92-2362-4029-A26A-E35CEC0798C1"); |
|
139 |
public static UUID uuidHs = UUID.fromString("6AD92C01-1442-4F2F-BD58-F73075B26C27"); |
|
140 |
public static UUID uuidAl = UUID.fromString("635B63DA-0AAF-446C-843E-BEB52E2A1B90"); |
|
141 |
public static UUID uuidBu = UUID.fromString("75F3CF66-B272-464E-9B1E-35B8E511936D"); |
|
142 |
public static UUID uuidGr = UUID.fromString("34DF8B89-7DFA-4265-9A3E-D540DB72AA77"); |
|
143 |
public static UUID uuidIt = UUID.fromString("06B8F41D-B9A8-4B55-8AAB-DE90EB3D0A9C"); |
|
144 |
public static UUID uuidCr = UUID.fromString("20A8A822-1C87-43F0-A5EF-2AF1CC5DC0FC"); |
|
145 |
public static UUID uuidRm = UUID.fromString("EAB29D40-E3B2-4920-BB1F-8757DFBC9E86"); |
|
146 |
public static UUID uuidSi_S = UUID.fromString("DD861671-930F-4C9E-92D8-EADDC28EB6B7"); |
|
147 |
public static UUID uuidTu_E = UUID.fromString("2B732609-55DB-4F25-BC73-618FFF515ADC"); |
|
148 |
public static UUID uuidJu = UUID.fromString("BD5E6833-7E0E-41A8-83D6-149A31F2CE05"); |
|
149 |
public static UUID uuidUk_K = UUID.fromString("40B7219D-E38C-44EB-9877-E311A2734022"); |
|
150 |
public static UUID uuidUk = UUID.fromString("7A8DF5D0-3D18-4386-891E-96E11BDB6FEB"); |
|
151 |
public static UUID uuidAg = UUID.fromString("548E583C-DBE7-463F-A01B-2A966F2B32D2"); |
|
152 |
public static UUID uuidEg = UUID.fromString("9EDDDE2E-95B7-4443-89A8-C30D031E16A5"); |
|
153 |
public static UUID uuidLi = UUID.fromString("2F506902-2A56-40C8-84CB-B436C84ED258"); |
|
154 |
public static UUID uuidMa = UUID.fromString("D639A7AC-F873-414E-8869-73D10B9CF842"); |
|
155 |
public static UUID uuidTn = UUID.fromString("AF4D86D4-2CA0-48A2-BA15-0D74454D1EAD"); |
|
156 |
public static UUID uuidAz = UUID.fromString("CEC2EBD3-DFD0-4CE6-827F-BFF8FBAF5283"); |
|
157 |
public static UUID uuidSg = UUID.fromString("BC4A0307-B81A-4233-B8BD-EFB9CEDFD530"); |
|
158 |
public static UUID uuidAb = UUID.fromString("D3744C2D-2777-4E85-98BF-04D2FD589EBF"); |
|
159 |
public static UUID uuidAr = UUID.fromString("535FED1E-3EC9-4563-AF55-E753AEFCFBFE"); |
|
160 |
public static UUID uuidAb_A = UUID.fromString("0F4C98BF-AF7B-4CDA-B62C-AD6A1909BFA0"); |
|
161 |
public static UUID uuidGg = UUID.fromString("DA1CCDA8-5867-4098-A709-100A66E2150A"); |
|
162 |
public static UUID uuidAb_N = UUID.fromString("AA75B0CA-49C9-4F8E-8CC2-2A343EB2FFF4"); |
|
163 |
public static UUID uuidCy = UUID.fromString("36EFDF69-09C0-4160-A502-9EEFBC22A984"); |
|
164 |
public static UUID uuidAE_G = UUID.fromString("76F5F3F6-9C3E-47F5-8E85-55360C50273C"); |
|
165 |
public static UUID uuidLe = UUID.fromString("639F5D97-EC9E-4EE2-ADFC-DFF73F7CC970"); |
|
166 |
public static UUID uuidSn = UUID.fromString("5D8E0B00-96CE-4ACC-AF02-62A1B9866144"); |
|
167 |
public static UUID uuidTu_A = UUID.fromString("F7B59D79-15C2-47C9-91B0-DEC1F388CB62"); |
|
168 |
public static UUID uuidTu = UUID.fromString("DB98809B-EF22-413B-B1EA-A79C4E1C4903"); |
|
169 |
public static UUID uuidAu_A = UUID.fromString("AE65867C-00F6-406C-A315-B3E4CC9A93D2"); |
|
170 |
public static UUID uuidAu_L = UUID.fromString("78146B6E-E71A-46DA-8DBC-244CC648BBE7"); |
|
171 |
public static UUID uuidAz_C = UUID.fromString("D35B8259-CC76-4FB0-AFC0-6A23D657EE3E"); |
|
172 |
public static UUID uuidAz_F = UUID.fromString("0F8F470D-CA2A-4130-842A-0A0C6912A123"); |
|
173 |
public static UUID uuidAz_G = UUID.fromString("CFF9FC6D-E3B2-45B1-87A9-6FEFB029A12F"); |
|
174 |
public static UUID uuidAz_P = UUID.fromString("C8000982-19E8-492E-912D-59EB370E52C0"); |
|
175 |
public static UUID uuidAz_S = UUID.fromString("BD852931-47B3-466C-A422-4F312B913CA2"); |
|
176 |
public static UUID uuidAz_J = UUID.fromString("4A5CED9F-F078-44B3-94BF-F3EE79315236"); |
|
177 |
public static UUID uuidAz_M = UUID.fromString("B8C76F37-6483-474F-85AB-96399219DE57"); |
|
178 |
public static UUID uuidAz_T = UUID.fromString("7A52595F-DA5E-440A-B2BD-F63999CE979E"); |
|
179 |
public static UUID uuidBe_B = UUID.fromString("9E263401-ACEC-4E2E-AA89-4AAF56AE7180"); |
|
180 |
public static UUID uuidBe_L = UUID.fromString("AF71559C-7765-493C-8C9A-1248DFF28789"); |
|
181 |
public static UUID uuidBl_I = UUID.fromString("121B07A0-8031-4F22-B9B7-C334FC3204CE"); |
|
182 |
public static UUID uuidBl_M = UUID.fromString("E8E8EFDC-E9EB-4B26-9711-F986265AD114"); |
|
183 |
public static UUID uuidBl_N = UUID.fromString("D96DD8A7-4BD8-4ADF-8CDB-05873686DB1A"); |
|
184 |
public static UUID uuidBH = UUID.fromString("6A109EF5-3AC1-4C59-8599-08F944ABA499"); |
|
185 |
public static UUID uuidBy = UUID.fromString("5D972AF7-6AE2-44D1-840B-EDB1DBE8B7AC"); |
|
186 |
public static UUID uuidCa = UUID.fromString("CFA26682-B0AB-4FEB-9191-6AA098638382"); |
|
187 |
public static UUID uuidCa_F = UUID.fromString("0D8ED2C4-0313-464C-A5B4-EC0A52E45ADF"); |
|
188 |
public static UUID uuidCa_G = UUID.fromString("865D1319-B157-4D1A-BBF0-F56B7EB2ED96"); |
|
189 |
public static UUID uuidCa_C = UUID.fromString("486FCBED-84C4-4673-8724-9A8A4A6613AD"); |
|
190 |
public static UUID uuidCa_H = UUID.fromString("0B57C693-DB09-4D7F-9FA9-0DBBEFF3B3B6"); |
|
191 |
public static UUID uuidCa_L = UUID.fromString("A88D6DF4-7924-4BEC-BFA6-071BDA82A4B3"); |
|
192 |
public static UUID uuidCa_P = UUID.fromString("BBF04D1A-1FC0-4A7B-BF0B-7D7BF69D8392"); |
|
193 |
public static UUID uuidCa_T = UUID.fromString("BBAD170B-285D-4BEA-8C3F-C43894FB75FF"); |
|
194 |
public static UUID uuidCs = UUID.fromString("2ADA45F0-C7CC-4026-A8B1-B816971F0753"); |
|
195 |
public static UUID uuidCt = UUID.fromString("09B5728A-4775-4530-B362-9B1EF4A9E8C3"); |
|
196 |
public static UUID uuidEs = UUID.fromString("1011D427-401B-47EE-A42C-4C1698957D55"); |
|
197 |
public static UUID uuidGa_C = UUID.fromString("3653A4DC-1ADE-4237-A62C-4F0AC11E576F"); |
|
198 |
public static UUID uuidGa_F = UUID.fromString("860F92B6-5CDA-456B-964C-6162D1D08161"); |
|
199 |
public static UUID uuidGg_A = UUID.fromString("5FAD859B-7929-4D5F-B92C-95E3E0469BB2"); |
|
200 |
public static UUID uuidGg_D = UUID.fromString("6091C975-B946-4EF3-A18F-2E148EAE6A06"); |
|
201 |
public static UUID uuidGg_G = UUID.fromString("048799B0-D7B9-44C6-B2D1-5CA2A49FA175"); |
|
202 |
public static UUID uuidHs_A = UUID.fromString("EAED6C21-42E5-496D-B43E-C121F96FA672"); |
|
203 |
public static UUID uuidHs_G = UUID.fromString("35350D75-6952-48BD-B265-C005BC1B2909"); |
|
204 |
public static UUID uuidHs_S = UUID.fromString("264649F7-192D-4AE5-9840-81FC782F59F0"); |
|
205 |
public static UUID uuidIr = UUID.fromString("A3B35528-5FFD-43B1-B605-711807C1EC9F"); |
|
206 |
public static UUID uuidIt_I = UUID.fromString("E3BC327E-0B42-4439-811B-595BC55A8FF8"); |
|
207 |
public static UUID uuidIt_S = UUID.fromString("57F35807-8CFA-4698-BB04-AAD3549C12EB"); |
|
208 |
public static UUID uuidJo = UUID.fromString("567A537D-F2FA-43EF-A20A-AEC76723E269"); |
|
209 |
public static UUID uuidKz = UUID.fromString("F8ABE715-D859-4B6F-B8F1-DB1A847DEAC4"); |
|
210 |
public static UUID uuidLa = UUID.fromString("8E338882-2631-4AD6-BC53-799C698C807D"); |
|
211 |
public static UUID uuidLt = UUID.fromString("ECF200B6-B1DF-414F-B215-EDAC503B1A65"); |
|
212 |
public static UUID uuidMa_E = UUID.fromString("80980607-FBD8-46E3-BE56-05D997F2D331"); |
|
213 |
public static UUID uuidMa_S = UUID.fromString("B743AE57-DC0B-4CCC-B4D9-7BF51E579E8E"); |
|
214 |
public static UUID uuidMk = UUID.fromString("0CE83170-2FA7-4C72-81F7-7FFF17343E48"); |
|
215 |
public static UUID uuidMd = UUID.fromString("2CFB90B1-0BA0-4578-AD11-AAD5AAB62899"); |
|
216 |
public static UUID uuidMd_D = UUID.fromString("DBE1F3CA-4C7C-4062-AC1E-ADE0C17DCA52"); |
|
217 |
public static UUID uuidMd_M = UUID.fromString("4658DADD-60FE-46D8-94E3-C6A6C4646105"); |
|
218 |
public static UUID uuidMd_P = UUID.fromString("2C41EB67-A330-4214-B452-6E6741262CE5"); |
|
219 |
public static UUID uuidSi_M = UUID.fromString("2920D738-54A1-49CE-AF3A-9CB742064587"); |
|
220 |
public static UUID uuidMo = UUID.fromString("64F98B98-1050-42C6-B2C7-F72DA642E4D5"); |
|
221 |
public static UUID uuidRf = UUID.fromString("4B6BDFEE-2BCB-4638-99CF-0F9612FA4787"); |
|
222 |
public static UUID uuidRf_C = UUID.fromString("1FFAF0B5-6311-4BF6-977F-8940622C4986"); |
|
223 |
public static UUID uuidRf_E = UUID.fromString("4280A0F6-298E-4B3C-8CE8-56A1208183F7"); |
|
224 |
public static UUID uuidRf_K = UUID.fromString("D9559D9A-1798-4496-8671-DE667CC30EC0"); |
|
225 |
public static UUID uuidRf_CS = UUID.fromString("6E886ACC-22C9-4C63-BEA5-A51AD84AF3D1"); |
|
226 |
public static UUID uuidRf_N = UUID.fromString("B0D8F65E-B5A4-4C0B-A5EF-54CC9F378CC6"); |
|
227 |
public static UUID uuidRf_NW = UUID.fromString("06CC9983-B444-4322-A03E-9A7A2AF1D4AD"); |
|
228 |
public static UUID uuidRf_A = UUID.fromString("1786C13D-D26D-49E3-BA60-E3F3E7852713"); |
|
229 |
public static UUID uuidRf_S = UUID.fromString("6AAB10D5-05E9-470A-8AF5-B6F8D48A71EC"); |
|
230 |
public static UUID uuidSk = UUID.fromString("09267309-E771-4BD7-A67F-B6B4321546E0"); |
|
231 |
public static UUID uuidSl = UUID.fromString("BC242D21-98CA-402C-BDB7-3ED347C7BDFD"); |
|
232 |
public static UUID uuidSy = UUID.fromString("A5974D4B-F878-422C-A7A8-A1D8268109EF"); |
|
233 |
public static UUID uuidUk_U = UUID.fromString("4A6C5155-154E-4B0D-AC73-550B51CCE374"); |
|
234 |
public static UUID uuidSM = UUID.fromString("AC360FC1-30F4-444A-92EB-B55BF98B8E97"); |
|
235 |
public static UUID uuidYu_K = UUID.fromString("F3F05E88-99AF-48FA-92EF-1A169BCC7ACF"); |
|
236 |
public static UUID uuidCg = UUID.fromString("38A4FD15-40D6-43F4-9685-F87465FDBD3F"); |
|
237 |
public static UUID uuidSr = UUID.fromString("468CFEA2-008F-40CF-B2C8-ADF5C09C0FA4"); |
|
238 |
public static UUID uuidIJ = UUID.fromString("9351B972-0C0B-4A97-87B1-4CC11E67D21E"); |
|
239 |
public static UUID uuidLS = UUID.fromString("F7BFDAE0-3DD9-4FC4-9B0B-0BF203B94031"); |
|
240 |
public static UUID uuidRs = UUID.fromString("C4A898CE-0F32-44FE-A8A3-278E11A4BA53"); |
|
241 |
public static UUID uuidSi = UUID.fromString("DB1FACF2-58A5-483E-9B2A-EB4290CA1B71"); |
|
242 |
public static UUID uuidAz_L = UUID.fromString("F5AEF252-C4F8-4ECC-9B6E-4821DB7ADECF"); |
|
243 |
public static UUID uuidHb_E = UUID.fromString("1D400E37-F39A-4CAE-8885-CF485B900CC5"); |
|
244 |
public static UUID uuidHb_N = UUID.fromString("B1D514DA-B9E6-4F0E-ACE4-18FB061FC132"); |
|
245 |
public static UUID uuidGa_M = UUID.fromString("E73942F0-292A-4F6A-8B2F-15AFE8634319"); |
|
246 |
public static UUID uuidMa_M = UUID.fromString("D9F7DFFC-0E76-4790-9AAE-B7AEB5AD76ED"); |
|
247 |
public static UUID uuidRs_N = UUID.fromString("44F262E3-5091-4D28-8081-440D3978FB0B"); |
|
248 |
public static UUID uuidRs_B = UUID.fromString("A575D608-DD53-4C01-B2AF-5067D0711F64"); |
|
249 |
public static UUID uuidRs_C = UUID.fromString("DA4E9CC3-B1CC-403A-81FF-BCC5D9FADBD1"); |
|
250 |
public static UUID uuidRs_W = UUID.fromString("EFABC8FD-0B3C-475B-B532-E1CA0BA0BDBB"); |
|
251 |
public static UUID uuidRs_E = UUID.fromString("7E0F8FA3-5DB9-48F0-9FA8-87FCAB3EAA53"); |
|
252 |
public static UUID uuidAE = UUID.fromString("C8FCD4E0-E1A2-4A7D-8EE2-6F397F5C546C"); |
|
253 |
public static UUID uuidAE_T = UUID.fromString("AF83B475-BB35-4594-8380-EA64B4313091"); |
|
254 |
public static UUID uuidRs_K = UUID.fromString("2188E3A5-0446-47C8-B11B-B4B2B9A71C75"); |
|
255 |
public static UUID uuidCc = UUID.fromString("05B0DD06-30F8-477D-BF4C-30D9DEF56320"); |
|
256 |
public static UUID uuidBt = UUID.fromString("EE13FB74-F3AC-46B1-9F23-6A25AC504446"); |
|
257 |
public static UUID uuidTcs = UUID.fromString("904C3980-B98D-422E-A195-95F4F41FC734"); |
|
258 |
|
|
259 |
|
|
260 |
|
|
109 | 261 |
//language areas |
110 |
public static final UUID uuidUkraineAndCrimea = UUID.fromString("99d4d1c2-09f6-416e-86a3-bdde5cae52af"); |
|
262 |
// public static final UUID uuidUkraineAndCrimea = UUID.fromString("99d4d1c2-09f6-416e-86a3-bdde5cae52af");
|
|
111 | 263 |
public static final UUID uuidAzerbaijanNakhichevan = UUID.fromString("232fbef0-9f4a-4cab-8ac1-e14c717e9de6"); |
112 | 264 |
|
113 | 265 |
//Marker Types |
... | ... | |
338 | 490 |
} |
339 | 491 |
} |
340 | 492 |
|
493 |
public static UUID getEMAreaUuid(String areaId){ |
|
494 |
if (areaId == null){ |
|
495 |
logger.warn("No AreaId given"); |
|
496 |
return null; |
|
497 |
}else if (areaId.equals("EM")){return uuidEM; |
|
498 |
}else if (areaId.equals("EUR")){return uuidEUR; |
|
499 |
}else if (areaId.equals("14")){return uuid14; |
|
500 |
}else if (areaId.equals("20")){return uuid20; |
|
501 |
}else if (areaId.equals("21")){return uuid21; |
|
502 |
}else if (areaId.equals("33")){return uuid33; |
|
503 |
}else if (areaId.equals("Da")){return uuidDa; |
|
504 |
}else if (areaId.equals("Fe")){return uuidFe; |
|
505 |
}else if (areaId.equals("Fa")){return uuidFa; |
|
506 |
}else if (areaId.equals("Br")){return uuidBr; |
|
507 |
}else if (areaId.equals("Is")){return uuidIs; |
|
508 |
}else if (areaId.equals("Hb")){return uuidHb; |
|
509 |
}else if (areaId.equals("No")){return uuidNo; |
|
510 |
}else if (areaId.equals("Sb")){return uuidSb; |
|
511 |
}else if (areaId.equals("Su")){return uuidSu; |
|
512 |
}else if (areaId.equals("Au")){return uuidAu; |
|
513 |
}else if (areaId.equals("Be")){return uuidBe; |
|
514 |
}else if (areaId.equals("Cz")){return uuidCz; |
|
515 |
}else if (areaId.equals("Ge")){return uuidGe; |
|
516 |
}else if (areaId.equals("Hu")){return uuidHu; |
|
517 |
}else if (areaId.equals("Ho")){return uuidHo; |
|
518 |
}else if (areaId.equals("Po")){return uuidPo; |
|
519 |
}else if (areaId.equals("He")){return uuidHe; |
|
520 |
}else if (areaId.equals("Bl")){return uuidBl; |
|
521 |
}else if (areaId.equals("Co")){return uuidCo; |
|
522 |
}else if (areaId.equals("Ga")){return uuidGa; |
|
523 |
}else if (areaId.equals("Lu")){return uuidLu; |
|
524 |
}else if (areaId.equals("Sa")){return uuidSa; |
|
525 |
}else if (areaId.equals("Hs")){return uuidHs; |
|
526 |
}else if (areaId.equals("Al")){return uuidAl; |
|
527 |
}else if (areaId.equals("Bu")){return uuidBu; |
|
528 |
}else if (areaId.equals("Gr")){return uuidGr; |
|
529 |
}else if (areaId.equals("It")){return uuidIt; |
|
530 |
}else if (areaId.equals("Cr")){return uuidCr; |
|
531 |
}else if (areaId.equals("Rm")){return uuidRm; |
|
532 |
}else if (areaId.equals("Si(S)")){return uuidSi_S; |
|
533 |
}else if (areaId.equals("Tu(E)")){return uuidTu_E; |
|
534 |
}else if (areaId.equals("Ju")){return uuidJu; |
|
535 |
}else if (areaId.equals("Uk(K)")){return uuidUk_K; |
|
536 |
}else if (areaId.equals("Uk")){return uuidUk; |
|
537 |
}else if (areaId.equals("Ag")){return uuidAg; |
|
538 |
}else if (areaId.equals("Eg")){return uuidEg; |
|
539 |
}else if (areaId.equals("Li")){return uuidLi; |
|
540 |
}else if (areaId.equals("Ma")){return uuidMa; |
|
541 |
}else if (areaId.equals("Tn")){return uuidTn; |
|
542 |
}else if (areaId.equals("Az")){return uuidAz; |
|
543 |
}else if (areaId.equals("Sg")){return uuidSg; |
|
544 |
}else if (areaId.equals("Ab")){return uuidAb; |
|
545 |
}else if (areaId.equals("Ar")){return uuidAr; |
|
546 |
}else if (areaId.equals("Ab(A)")){return uuidAb_A; |
|
547 |
}else if (areaId.equals("Gg")){return uuidGg; |
|
548 |
}else if (areaId.equals("Ab(N)")){return uuidAb_N; |
|
549 |
}else if (areaId.equals("Cy")){return uuidCy; |
|
550 |
}else if (areaId.equals("AE(G)")){return uuidAE_G; |
|
551 |
}else if (areaId.equals("Le")){return uuidLe; |
|
552 |
}else if (areaId.equals("Sn")){return uuidSn; |
|
553 |
}else if (areaId.equals("Tu(A)")){return uuidTu_A; |
|
554 |
}else if (areaId.equals("Tu")){return uuidTu; |
|
555 |
}else if (areaId.equals("Au(A)")){return uuidAu_A; |
|
556 |
}else if (areaId.equals("Au(L)")){return uuidAu_L; |
|
557 |
}else if (areaId.equals("Az(C)")){return uuidAz_C; |
|
558 |
}else if (areaId.equals("Az(F)")){return uuidAz_F; |
|
559 |
}else if (areaId.equals("Az(G)")){return uuidAz_G; |
|
560 |
}else if (areaId.equals("Az(P)")){return uuidAz_P; |
|
561 |
}else if (areaId.equals("Az(S)")){return uuidAz_S; |
|
562 |
}else if (areaId.equals("Az(J)")){return uuidAz_J; |
|
563 |
}else if (areaId.equals("Az(M)")){return uuidAz_M; |
|
564 |
}else if (areaId.equals("Az(T)")){return uuidAz_T; |
|
565 |
}else if (areaId.equals("Be(B)")){return uuidBe_B; |
|
566 |
}else if (areaId.equals("Be(L)")){return uuidBe_L; |
|
567 |
}else if (areaId.equals("Bl(I)")){return uuidBl_I; |
|
568 |
}else if (areaId.equals("Bl(M)")){return uuidBl_M; |
|
569 |
}else if (areaId.equals("Bl(N)")){return uuidBl_N; |
|
570 |
}else if (areaId.equals("BH")){return uuidBH; |
|
571 |
}else if (areaId.equals("By")){return uuidBy; |
|
572 |
}else if (areaId.equals("Ca")){return uuidCa; |
|
573 |
}else if (areaId.equals("Ca(F)")){return uuidCa_F; |
|
574 |
}else if (areaId.equals("Ca(G)")){return uuidCa_G; |
|
575 |
}else if (areaId.equals("Ca(C)")){return uuidCa_C; |
|
576 |
}else if (areaId.equals("Ca(H)")){return uuidCa_H; |
|
577 |
}else if (areaId.equals("Ca(L)")){return uuidCa_L; |
|
578 |
}else if (areaId.equals("Ca(P)")){return uuidCa_P; |
|
579 |
}else if (areaId.equals("Ca(T)")){return uuidCa_T; |
|
580 |
}else if (areaId.equals("Cs")){return uuidCs; |
|
581 |
}else if (areaId.equals("Ct")){return uuidCt; |
|
582 |
}else if (areaId.equals("Es")){return uuidEs; |
|
583 |
}else if (areaId.equals("Ga(C)")){return uuidGa_C; |
|
584 |
}else if (areaId.equals("Ga(F)")){return uuidGa_F; |
|
585 |
}else if (areaId.equals("Gg(A)")){return uuidGg_A; |
|
586 |
}else if (areaId.equals("Gg(D)")){return uuidGg_D; |
|
587 |
}else if (areaId.equals("Gg(G)")){return uuidGg_G; |
|
588 |
}else if (areaId.equals("Hs(A)")){return uuidHs_A; |
|
589 |
}else if (areaId.equals("Hs(G)")){return uuidHs_G; |
|
590 |
}else if (areaId.equals("Hs(S)")){return uuidHs_S; |
|
591 |
}else if (areaId.equals("Ir")){return uuidIr; |
|
592 |
}else if (areaId.equals("It(I)")){return uuidIt_I; |
|
593 |
}else if (areaId.equals("It(S)")){return uuidIt_S; |
|
594 |
}else if (areaId.equals("Jo")){return uuidJo; |
|
595 |
}else if (areaId.equals("Kz")){return uuidKz; |
|
596 |
}else if (areaId.equals("La")){return uuidLa; |
|
597 |
}else if (areaId.equals("Lt")){return uuidLt; |
|
598 |
}else if (areaId.equals("Ma(E)")){return uuidMa_E; |
|
599 |
}else if (areaId.equals("Ma(S)")){return uuidMa_S; |
|
600 |
}else if (areaId.equals("Mk")){return uuidMk; |
|
601 |
}else if (areaId.equals("Md")){return uuidMd; |
|
602 |
}else if (areaId.equals("Md(D)")){return uuidMd_D; |
|
603 |
}else if (areaId.equals("Md(M)")){return uuidMd_M; |
|
604 |
}else if (areaId.equals("Md(P)")){return uuidMd_P; |
|
605 |
}else if (areaId.equals("Si(M)")){return uuidSi_M; |
|
606 |
}else if (areaId.equals("Mo")){return uuidMo; |
|
607 |
}else if (areaId.equals("Rf")){return uuidRf; |
|
608 |
}else if (areaId.equals("Rf(C)")){return uuidRf_C; |
|
609 |
}else if (areaId.equals("Rf(E)")){return uuidRf_E; |
|
610 |
}else if (areaId.equals("Rf(K)")){return uuidRf_K; |
|
611 |
}else if (areaId.equals("Rf(CS)")){return uuidRf_CS; |
|
612 |
}else if (areaId.equals("Rf(N)")){return uuidRf_N; |
|
613 |
}else if (areaId.equals("Rf(NW)")){return uuidRf_NW; |
|
614 |
}else if (areaId.equals("Rf(A)")){return uuidRf_A; |
|
615 |
}else if (areaId.equals("Rf(S)")){return uuidRf_S; |
|
616 |
}else if (areaId.equals("Sk")){return uuidSk; |
|
617 |
}else if (areaId.equals("Sl")){return uuidSl; |
|
618 |
}else if (areaId.equals("Sy")){return uuidSy; |
|
619 |
}else if (areaId.equals("Uk(U)")){return uuidUk_U; |
|
620 |
}else if (areaId.equals("SM")){return uuidSM; |
|
621 |
}else if (areaId.equals("Yu(K)")){return uuidYu_K; |
|
622 |
}else if (areaId.equals("Cg")){return uuidCg; |
|
623 |
}else if (areaId.equals("Sr")){return uuidSr; |
|
624 |
}else if (areaId.equals("IJ")){return uuidIJ; |
|
625 |
}else if (areaId.equals("LS")){return uuidLS; |
|
626 |
}else if (areaId.equals("Rs")){return uuidRs; |
|
627 |
}else if (areaId.equals("Si")){return uuidSi; |
|
628 |
}else if (areaId.equals("Az(L)")){return uuidAz_L; |
|
629 |
}else if (areaId.equals("Hb(E)")){return uuidHb_E; |
|
630 |
}else if (areaId.equals("Hb(N)")){return uuidHb_N; |
|
631 |
}else if (areaId.equals("Ga(M)")){return uuidGa_M; |
|
632 |
}else if (areaId.equals("Ma(M)")){return uuidMa_M; |
|
633 |
}else if (areaId.equals("Rs(N)")){return uuidRs_N; |
|
634 |
}else if (areaId.equals("Rs(B)")){return uuidRs_B; |
|
635 |
}else if (areaId.equals("Rs(C)")){return uuidRs_C; |
|
636 |
}else if (areaId.equals("Rs(W)")){return uuidRs_W; |
|
637 |
}else if (areaId.equals("Rs(E)")){return uuidRs_E; |
|
638 |
}else if (areaId.equals("AE")){return uuidAE; |
|
639 |
}else if (areaId.equals("AE(T)")){return uuidAE_T; |
|
640 |
}else if (areaId.equals("Rs(K)")){return uuidRs_K; |
|
641 |
}else if (areaId.equals("Cc")){return uuidCc; |
|
642 |
}else if (areaId.equals("Bt")){return uuidBt; |
|
643 |
}else if (areaId.equals("Tcs")){return uuidTcs; |
|
644 |
}else{ |
|
645 |
logger.warn("Area not found: " + areaId); |
|
646 |
return null; |
|
647 |
} |
|
648 |
|
|
649 |
} |
|
650 |
|
|
341 | 651 |
|
342 | 652 |
//TypeDesignation |
343 | 653 |
public static SpecimenTypeDesignationStatus typeStatusId2TypeStatus (int typeStatusId) throws UnknownCdmTypeException{ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/DbImportBase.java | ||
---|---|---|
115 | 115 |
* @return |
116 | 116 |
*/ |
117 | 117 |
protected boolean doId(STATE state, ISourceable sourceable, long id, String namespace) { |
118 |
return ImportHelper.setOriginalSource(sourceable, state.getTransactionalSourceReference() , id, namespace);
|
|
118 |
return ImportHelper.setOriginalSource(sourceable, state.getTransactionalSourceReference(), id, namespace); |
|
119 | 119 |
} |
120 | 120 |
|
121 | 121 |
/** |
... | ... | |
126 | 126 |
* @return |
127 | 127 |
*/ |
128 | 128 |
protected boolean doId(STATE state, ISourceable sourceable, String id, String namespace) { |
129 |
return ImportHelper.setOriginalSource(sourceable, state.getTransactionalSourceReference() , id, namespace);
|
|
129 |
return ImportHelper.setOriginalSource(sourceable, state.getTransactionalSourceReference(), id, namespace); |
|
130 | 130 |
} |
131 | 131 |
|
132 | 132 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/IImportConfigurator.java | ||
---|---|---|
41 | 41 |
NONE, |
42 | 42 |
NOMENCLATURAL, |
43 | 43 |
CONCEPT_REFERENCES, |
44 |
ALL |
|
44 |
ALL; |
|
45 |
|
|
46 |
public DO_REFERENCES invers(){ |
|
47 |
if (this == DO_REFERENCES.NONE){ |
|
48 |
return ALL; |
|
49 |
}else if (this == ALL){ |
|
50 |
return NONE; |
|
51 |
}else if (this == NOMENCLATURAL){ //don't change |
|
52 |
return NOMENCLATURAL; |
|
53 |
}else if (this == CONCEPT_REFERENCES){ //don't change |
|
54 |
return CONCEPT_REFERENCES; |
|
55 |
}else{ |
|
56 |
throw new RuntimeException("inverse for DO_REFERENCE type: " + this + " not yet handled"); |
|
57 |
} |
|
58 |
} |
|
45 | 59 |
} |
60 |
|
|
61 |
|
|
46 | 62 |
|
47 | 63 |
public boolean isValid(); |
48 | 64 |
|
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/out/DbAreaMapper.java | ||
---|---|---|
66 | 66 |
cdmClass = clazz; |
67 | 67 |
} |
68 | 68 |
|
69 |
/* (non-Javadoc) |
|
70 |
* @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.DbSingleAttributeExportMapperBase#getValue(eu.etaxonomy.cdm.model.common.CdmBase) |
|
71 |
*/ |
|
72 | 69 |
@Override |
73 | 70 |
protected Object getValue(CdmBase cdmBase) { |
74 | 71 |
if (cdmBase.isInstanceOf(cdmClass)){ |
75 | 72 |
try { |
76 |
NamedArea area = (NamedArea)method.invoke(cdmBase, null); |
|
73 |
NamedArea area = (NamedArea)method.invoke(cdmBase, (Object[])null);
|
|
77 | 74 |
IExportTransformer transformer = getState().getTransformer(); |
78 | 75 |
if (isCache){ |
79 | 76 |
return transformer.getCacheByNamedArea(area); |
... | ... | |
90 | 87 |
} |
91 | 88 |
} |
92 | 89 |
|
93 |
/* (non-Javadoc) |
|
94 |
* @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.DbSingleAttributeExportMapperBase#getValueType() |
|
95 |
*/ |
|
96 | 90 |
@Override |
97 | 91 |
protected int getSqlType() { |
98 | 92 |
if (isCache){ |
... | ... | |
103 | 97 |
} |
104 | 98 |
|
105 | 99 |
|
106 |
/* (non-Javadoc) |
|
107 |
* @see eu.etaxonomy.cdm.io.common.CdmSingleAttributeMapperBase#getTypeClass() |
|
108 |
*/ |
|
109 | 100 |
@Override |
110 | 101 |
public Class<?> getTypeClass() { |
111 | 102 |
if (isCache){ |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/out/DbObjectMapper.java | ||
---|---|---|
22 | 22 |
/** |
23 | 23 |
* @author a.mueller |
24 | 24 |
* @created 12.05.2009 |
25 |
* @version 1.0 |
|
26 | 25 |
*/ |
27 | 26 |
public class DbObjectMapper extends DbSingleAttributeExportMapperBase<DbExportStateBase<?, IExportTransformer>> implements IDbExportMapper<DbExportStateBase<?, IExportTransformer>, IExportTransformer> { |
28 | 27 |
@SuppressWarnings("unused") |
... | ... | |
47 | 46 |
this.isCache = isCache; |
48 | 47 |
} |
49 | 48 |
|
50 |
|
|
51 |
/* (non-Javadoc) |
|
52 |
* @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.DbSingleAttributeExportMapperBase#getValue() |
|
53 |
*/ |
|
54 | 49 |
@Override |
55 | 50 |
protected Object getValue(CdmBase cdmBase) { |
56 | 51 |
CdmBase value = (CdmBase)super.getValue(cdmBase); |
... | ... | |
75 | 70 |
// getState().getConfig().getCdmAppController().commitTransaction(tx); |
76 | 71 |
return result; |
77 | 72 |
} |
78 |
|
|
79 | 73 |
|
80 | 74 |
protected Integer getId(CdmBase cdmBase){ |
81 | 75 |
DbExportStateBase<?, IExportTransformer> state = getState(); |
... | ... | |
88 | 82 |
} |
89 | 83 |
} |
90 | 84 |
|
91 |
/* (non-Javadoc) |
|
92 |
* @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.DbSingleAttributeExportMapperBase#getValueType() |
|
93 |
*/ |
|
94 | 85 |
@Override |
95 | 86 |
protected int getSqlType() { |
96 | 87 |
if (isCache){ |
... | ... | |
100 | 91 |
} |
101 | 92 |
} |
102 | 93 |
|
103 |
/* (non-Javadoc) |
|
104 |
* @see eu.etaxonomy.cdm.io.common.CdmSingleAttributeMapperBase#getTypeClass() |
|
105 |
*/ |
|
106 | 94 |
@Override |
107 | 95 |
public Class<?> getTypeClass() { |
108 | 96 |
if (isCache){ |
... | ... | |
111 | 99 |
return CdmBase.class; |
112 | 100 |
} |
113 | 101 |
} |
114 |
|
|
115 |
|
|
116 | 102 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/out/MethodMapper.java | ||
---|---|---|
75 | 75 |
} |
76 | 76 |
} |
77 | 77 |
|
78 |
/* (non-Javadoc) |
|
79 |
* @see eu.etaxonomy.cdm.io.common.CdmSingleAttributeMapperBase#getTypeClass() |
|
80 |
*/ |
|
81 | 78 |
@Override |
82 | 79 |
public Class<?> getTypeClass() { |
83 | 80 |
return method.getReturnType(); |
84 | 81 |
} |
85 | 82 |
|
86 |
|
|
87 |
/* (non-Javadoc) |
|
88 |
* @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.DbSingleAttributeExportMapperBase#getValue() |
|
89 |
*/ |
|
90 | 83 |
@Override |
91 | 84 |
protected Object getValue(CdmBase cdmBase) { |
92 | 85 |
try{ |
... | ... | |
108 | 101 |
} |
109 | 102 |
} |
110 | 103 |
|
111 |
|
|
112 |
|
|
113 |
/* (non-Javadoc) |
|
114 |
* @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.DbSingleAttributeExportMapperBase#getValueType() |
|
115 |
*/ |
|
116 | 104 |
@Override |
117 | 105 |
protected int getSqlType() { |
118 | 106 |
Class<?> returnType = method.getReturnType(); |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefaultTermInitializer.java | ||
---|---|---|
17 | 17 |
|
18 | 18 |
import eu.etaxonomy.cdm.model.common.init.ITermInitializer; |
19 | 19 |
import eu.etaxonomy.cdm.model.common.init.ITermLoader; |
20 |
import eu.etaxonomy.cdm.model.common.init.MockCdmCacher; |
|
20 | 21 |
import eu.etaxonomy.cdm.model.common.init.TermLoader; |
21 | 22 |
|
22 | 23 |
/** |
... | ... | |
41 | 42 |
// Class<? extends DefinedTermBase<?>> clazz = vocabularyEnum.getClazz(); |
42 | 43 |
TermVocabulary<?> voc = termLoader.loadTerms(vocabularyEnum, terms); |
43 | 44 |
setDefinedTerms(vocabularyEnum.getClazz(),voc); |
44 |
} |
|
45 |
} |
|
46 |
//preliminary to make cdmlib-model test running until we completely moved to CdmCacher |
|
47 |
new MockCdmCacher(); |
|
48 |
|
|
45 | 49 |
} |
46 | 50 |
|
47 | 51 |
protected void setDefinedTerms(Class<? extends DefinedTermBase<?>> clazz, TermVocabulary<?> vocabulary) { |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTermBase.java | ||
---|---|---|
159 | 159 |
@Cascade(CascadeType.SAVE_UPDATE) |
160 | 160 |
protected TermVocabulary<T> vocabulary; |
161 | 161 |
|
162 |
//the unique tabel this term uses in its given vocabulary #3479
|
|
162 |
//the unique iedentifier/name this term uses in its given vocabulary #3479
|
|
163 | 163 |
//open issues: is null allowed? If not, implement unique constraint |
164 | 164 |
|
165 | 165 |
@XmlElement(name = "idInVocabulary") |
166 | 166 |
@Length(max=255) |
167 |
private String idInVocabulary; //the unique tabel this term uses in its given vocabulary #3479
|
|
167 |
private String idInVocabulary; //the unique identifier/name this term uses in its given vocabulary #3479
|
|
168 | 168 |
|
169 | 169 |
|
170 | 170 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/init/MockCdmCacher.java | ||
---|---|---|
1 |
package eu.etaxonomy.cdm.model.common.init; |
|
2 |
|
|
3 |
import java.util.Set; |
|
4 |
import java.util.UUID; |
|
5 |
|
|
6 |
import net.sf.ehcache.Cache; |
|
7 |
import net.sf.ehcache.CacheManager; |
|
8 |
import net.sf.ehcache.Element; |
|
9 |
import net.sf.ehcache.config.CacheConfiguration; |
|
10 |
import net.sf.ehcache.store.MemoryStoreEvictionPolicy; |
|
11 |
|
|
12 |
import eu.etaxonomy.cdm.model.ICdmCacher; |
|
13 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
14 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
|
15 |
import eu.etaxonomy.cdm.model.common.Language; |
|
16 |
|
|
17 |
/** |
|
18 |
* Since cdmlib-model cannot access CdmCacher we need to create a mock class |
|
19 |
* for the tests. |
|
20 |
* |
|
21 |
* NOTES: |
|
22 |
* - All terms are put into the cache in the constructor |
|
23 |
* - The number of elements allowed in the cache is set to a big number - 10000 |
|
24 |
* |
|
25 |
* FIXME : Once the CDMCacher is externalised this class should just subclass it. |
|
26 |
* |
|
27 |
* @author cmathew |
|
28 |
* |
|
29 |
*/ |
|
30 |
public class MockCdmCacher implements ICdmCacher { |
|
31 |
|
|
32 |
private static final String DEFAULT_CACHE_NAME = "defaultCache"; |
|
33 |
|
|
34 |
private static final String DEFAULT_CACHE_MGR_NAME = "defaultCacheManager"; |
|
35 |
/** |
|
36 |
* Constructor which initialises a singleton {@link net.sf.ehcache.CacheManager} |
|
37 |
* |
|
38 |
*/ |
|
39 |
public MockCdmCacher() { |
|
40 |
init(); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Initialises an empty singleton {@link net.sf.ehcache.CacheManager} and |
|
45 |
* sets itself as the cacher object in specific CDM Entity objects. |
|
46 |
* |
|
47 |
*/ |
|
48 |
private void init() { |
|
49 |
// Remove all caches |
|
50 |
getDefaultCacheManager().removalAll(); |
|
51 |
// Create default cache |
|
52 |
getDefaultCacheManager().addCache(new Cache(getDefaultCacheConfiguration())); |
|
53 |
Set<Language> langList = Language.DEFAULT().getVocabulary().getTerms(); |
|
54 |
for (Language lang : langList){ |
|
55 |
put(lang.getUuid(),lang); |
|
56 |
} |
|
57 |
// We start first only with DefinedTermBase |
|
58 |
DefinedTermBase.setCacher(this); |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Returns the singleton default cache manager. |
|
64 |
* |
|
65 |
* @return |
|
66 |
*/ |
|
67 |
private static CacheManager getDefaultCacheManager() { |
|
68 |
// this ensures a singleton cache manager |
|
69 |
return CacheManager.create(); |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* Returns the default cache configuration. |
|
74 |
* |
|
75 |
* @return |
|
76 |
*/ |
|
77 |
private CacheConfiguration getDefaultCacheConfiguration() { |
|
78 |
return new CacheConfiguration(DEFAULT_CACHE_NAME, 10000) |
|
79 |
.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) |
|
80 |
.eternal(false) |
|
81 |
// default ttl and tti set to 2 hours |
|
82 |
.timeToLiveSeconds(60*60*2) |
|
83 |
.timeToIdleSeconds(60*60*2); |
|
84 |
|
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Returns the default cache |
|
89 |
* |
|
90 |
* @return |
|
91 |
*/ |
|
92 |
private static Cache getDefaultCache() { |
|
93 |
return getDefaultCacheManager().getCache(DEFAULT_CACHE_NAME); |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* Puts the (Key,Value) pair of ({@link java.util.UUID}, {@link eu.etaxonomy.cdm.model.common.CdmBase}), |
|
98 |
* in the cache |
|
99 |
* |
|
100 |
* @param uuid |
|
101 |
* @param cdmEntity |
|
102 |
*/ |
|
103 |
public void put(UUID uuid, CdmBase cdmEntity) { |
|
104 |
getDefaultCache().put(new Element(uuid, cdmEntity)); |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* Gets the cache element corresponding to the given {@link java.util.UUID} |
|
109 |
* |
|
110 |
* @param uuid |
|
111 |
* @return |
|
112 |
*/ |
|
113 |
private Element getCacheElement(UUID uuid) { |
|
114 |
return getDefaultCache().get(uuid); |
|
115 |
} |
|
116 |
|
|
117 |
/** |
|
118 |
* Get CDM Entity for given {@link java.util.UUID} from the cache |
|
119 |
* |
|
120 |
* @param uuid |
|
121 |
* @return |
|
122 |
*/ |
|
123 |
private CdmBase getCdmEntity(UUID uuid) { |
|
124 |
return (CdmBase)getDefaultCache().get(uuid).getObjectValue(); |
|
125 |
} |
|
126 |
|
|
127 |
/* (non-Javadoc) |
|
128 |
* @see eu.etaxonomy.cdm.remote.cache.ICdmCacher#load(java.util.UUID) |
|
129 |
*/ |
|
130 |
|
|
131 |
public CdmBase load(UUID uuid) { |
|
132 |
Element e = getCacheElement(uuid); |
|
133 |
CdmBase cdmEntity; |
|
134 |
if (e == null) { |
|
135 |
return null; |
|
136 |
} else { |
|
137 |
return (CdmBase)e.getObjectValue(); |
|
138 |
} |
|
139 |
} |
|
140 |
|
|
141 |
|
|
142 |
/* (non-Javadoc) |
|
143 |
* @see eu.etaxonomy.cdm.model.ICdmCacher#getFromCache(java.util.UUID) |
|
144 |
*/ |
|
145 |
public CdmBase getFromCache(UUID uuid) { |
|
146 |
Element e = getCacheElement(uuid); |
|
147 |
CdmBase cdmEntity; |
|
148 |
if (e == null) { |
|
149 |
return null; |
|
150 |
} else { |
|
151 |
return(CdmBase)e.getObjectValue(); |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
|
|
156 |
/* (non-Javadoc) |
|
157 |
* @see eu.etaxonomy.cdm.model.ICdmCacher#exists(java.util.UUID) |
|
158 |
*/ |
|
159 |
public boolean exists(UUID uuid) { |
|
160 |
return getCacheElement(uuid) != null; |
|
161 |
} |
|
162 |
|
|
163 |
|
|
164 |
/* (non-Javadoc) |
|
165 |
* @see eu.etaxonomy.cdm.model.ICdmCacher#existsAndIsNotNull(java.util.UUID) |
|
166 |
*/ |
|
167 |
public boolean existsAndIsNotNull(UUID uuid) { |
|
168 |
Element e = getCacheElement(uuid); |
|
169 |
CdmBase cdmEntity; |
|
170 |
if (e != null) { |
|
171 |
return (CdmBase)e.getObjectValue() != null; |
|
172 |
} |
|
173 |
return false; |
|
174 |
} |
|
175 |
|
|
176 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/Reference.java | ||
---|---|---|
882 | 882 |
} |
883 | 883 |
|
884 | 884 |
public String generateAbbrevTitle() { |
885 |
rectifyCacheStrategy(); |
|
885 |
rectifyCacheStrategy(); //TODO needed, is called by getCacheStrategy already
|
|
886 | 886 |
return getCacheStrategy().getAbbrevTitleCache(this); |
887 | 887 |
} |
888 | 888 |
|
... | ... | |
1024 | 1024 |
return null; |
1025 | 1025 |
}else{ |
1026 | 1026 |
if (getCacheStrategy() instanceof INomenclaturalReferenceCacheStrategy){ |
1027 |
return ((INomenclaturalReferenceCacheStrategy)cacheStrategy).getNomenclaturalCitation(this,microReference); |
|
1027 |
return ((INomenclaturalReferenceCacheStrategy)cacheStrategy).getNomenclaturalCitation(this, microReference);
|
|
1028 | 1028 |
}else { |
1029 | 1029 |
logger.warn("No INomenclaturalReferenceCacheStrategy defined for "+ typeName + ": " + this.getUuid()); |
1030 | 1030 |
return null; |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategy.java | ||
---|---|---|
722 | 722 |
if (rank != null){ |
723 | 723 |
try { |
724 | 724 |
infraGenericMarker = rank.getInfraGenericMarker(); |
725 |
if (rank.equals(Rank.SECTION_BOTANY()) || rank.equals(Rank.SUBSECTION_BOTANY())){ |
|
726 |
infraGenericMarker = infraGenericMarker.replace("(bot.)", ""); |
|
727 |
} |
|
725 | 728 |
} catch (UnknownCdmTypeException e) { |
726 | 729 |
infraGenericMarker = "'unhandled infrageneric rank'"; |
727 | 730 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/reference/NomRefDefaultCacheStrategyBase.java | ||
---|---|---|
127 | 127 |
microReference = CdmUtils.Nz(microReference); |
128 | 128 |
if (StringUtils.isNotBlank(microReference)){ |
129 | 129 |
microReference = getBeforeMicroReference() + microReference; |
130 |
if (microReference.endsWith(".") && result.contains(INomenclaturalReference.MICRO_REFERENCE_TOKEN + ".") ){ |
|
131 |
microReference = microReference.substring(0, microReference.length() - 1); |
|
132 |
} |
|
130 | 133 |
} |
131 | 134 |
result = result.replaceAll(INomenclaturalReference.MICRO_REFERENCE_TOKEN, microReference); |
135 |
if (result.startsWith(". ")){ //only year available, remove '. ' |
|
136 |
result = result.substring(2); |
|
137 |
} |
|
132 | 138 |
return result; |
133 | 139 |
} |
134 | 140 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java | ||
---|---|---|
491 | 491 |
//parse title and author |
492 | 492 |
ref = parseReferenceTitle(strReference, yearPart, isInReference); |
493 | 493 |
if (ref.hasProblem()){ |
494 |
ref.setTitleCache( (isInReference?"in ":"") + originalStrReference,true); |
|
494 |
ref.setTitleCache( (isInReference ? "in ":"") + originalStrReference, true); |
|
495 |
ref.setAbbrevTitleCache( (isInReference ? "in ":"") + originalStrReference, true); |
|
495 | 496 |
} |
496 | 497 |
nameToBeFilled.setNomenclaturalReference((Reference<?>)ref); |
497 | 498 |
int end = Math.min(strReference.length(), ref.getProblemEnds()); |
... | ... | |
570 | 571 |
|
571 | 572 |
private void makeUnparsableRefTitle(INomenclaturalReference result, String reference){ |
572 | 573 |
result.setTitleCache(reference,true); |
574 |
result.setAbbrevTitleCache(reference,true); |
|
573 | 575 |
result.addParsingProblem(ParserProblem.UnparsableReferenceTitle); |
574 | 576 |
} |
575 | 577 |
|
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/MockCdmCacher.java | ||
---|---|---|
1 |
package eu.etaxonomy.cdm.model; |
|
2 |
|
|
3 |
import java.util.UUID; |
|
4 |
|
|
5 |
import net.sf.ehcache.Cache; |
|
6 |
import net.sf.ehcache.CacheManager; |
|
7 |
import net.sf.ehcache.Element; |
|
8 |
import net.sf.ehcache.config.CacheConfiguration; |
|
9 |
import net.sf.ehcache.config.PersistenceConfiguration; |
|
10 |
import net.sf.ehcache.config.PersistenceConfiguration.Strategy; |
|
11 |
import net.sf.ehcache.store.MemoryStoreEvictionPolicy; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
14 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
|
15 |
import eu.etaxonomy.cdm.model.common.Language; |
|
16 |
|
|
17 |
/** |
|
18 |
* Since cdmlib-model cannot access CdmCacher we need to create a mock class |
|
19 |
* for the tests |
|
20 |
* |
|
21 |
* @author cmathew |
|
22 |
* |
|
23 |
*/ |
|
24 |
public class MockCdmCacher implements ICdmCacher { |
|
25 |
|
|
26 |
private static final String DEFAULT_CACHE_NAME = "defaultCache"; |
|
27 |
|
|
28 |
private static final String DEFAULT_CACHE_MGR_NAME = "defaultCacheManager"; |
|
29 |
/** |
|
30 |
* Constructor which initialises a singleton {@link net.sf.ehcache.CacheManager} |
|
31 |
* |
|
32 |
*/ |
|
33 |
public MockCdmCacher() { |
|
34 |
init(); |
|
35 |
} |
|
36 |
|
|
37 |
/** |
|
38 |
* Initialises an empty singleton {@link net.sf.ehcache.CacheManager} and |
|
39 |
* sets itself as the cacher object in specific CDM Entity objects. |
|
40 |
* |
|
41 |
*/ |
|
42 |
private void init() { |
|
43 |
// Remove all caches |
|
44 |
getDefaultCacheManager().removalAll(); |
|
45 |
// Create default cache |
|
46 |
getDefaultCacheManager().addCache(new Cache(getDefaultCacheConfiguration())); |
|
47 |
put(Language.DEFAULT().getUuid(),Language.DEFAULT()); |
|
48 |
// We start first only with DefinedTermBase |
|
49 |
DefinedTermBase.setCacher(this); |
|
50 |
|
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* Returns the singleton default cache manager. |
|
55 |
* |
|
56 |
* @return |
|
57 |
*/ |
|
58 |
private static CacheManager getDefaultCacheManager() { |
|
59 |
// this ensures a singleton cache manager |
|
60 |
return CacheManager.create(); |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* Returns the default cache configuration. |
|
65 |
* |
|
66 |
* @return |
|
67 |
*/ |
|
68 |
private CacheConfiguration getDefaultCacheConfiguration() { |
|
69 |
return new CacheConfiguration(DEFAULT_CACHE_NAME, 50) |
|
70 |
.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) |
|
71 |
.eternal(false) |
|
72 |
// default ttl and tti set to 2 hours |
|
73 |
.timeToLiveSeconds(60*60*2) |
|
74 |
.timeToIdleSeconds(60*60*2) |
|
75 |
.diskExpiryThreadIntervalSeconds(0) |
|
76 |
.persistence(new PersistenceConfiguration().strategy(Strategy.LOCALTEMPSWAP)); |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Returns the default cache |
|
81 |
* |
|
82 |
* @return |
|
83 |
*/ |
|
84 |
private static Cache getDefaultCache() { |
|
85 |
return getDefaultCacheManager().getCache(DEFAULT_CACHE_NAME); |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Puts the (Key,Value) pair of ({@link java.util.UUID}, {@link eu.etaxonomy.cdm.model.common.CdmBase}), |
|
90 |
* in the cache |
|
91 |
* |
|
92 |
* @param uuid |
|
93 |
* @param cdmEntity |
|
94 |
*/ |
|
95 |
public void put(UUID uuid, CdmBase cdmEntity) { |
|
96 |
getDefaultCache().put(new Element(uuid, cdmEntity)); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Gets the cache element corresponding to the given {@link java.util.UUID} |
|
101 |
* |
|
102 |
* @param uuid |
|
103 |
* @return |
|
104 |
*/ |
|
105 |
private Element getCacheElement(UUID uuid) { |
|
106 |
return getDefaultCache().get(uuid); |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* Get CDM Entity for given {@link java.util.UUID} from the cache |
|
111 |
* |
|
112 |
* @param uuid |
|
113 |
* @return |
|
114 |
*/ |
|
115 |
private CdmBase getCdmEntity(UUID uuid) { |
|
116 |
return (CdmBase)getDefaultCache().get(uuid).getObjectValue(); |
|
117 |
} |
|
118 |
|
|
119 |
/* (non-Javadoc) |
|
120 |
* @see eu.etaxonomy.cdm.remote.cache.ICdmCacher#load(java.util.UUID) |
|
121 |
*/ |
|
122 |
|
|
123 |
public CdmBase load(UUID uuid) { |
|
124 |
Element e = getCacheElement(uuid); |
|
125 |
CdmBase cdmEntity; |
|
126 |
if (e == null) { |
|
127 |
return null; |
|
128 |
} else { |
|
129 |
return (CdmBase)e.getObjectValue(); |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
/* (non-Javadoc) |
|
135 |
* @see eu.etaxonomy.cdm.model.ICdmCacher#getFromCache(java.util.UUID) |
|
136 |
*/ |
|
137 |
public CdmBase getFromCache(UUID uuid) { |
|
138 |
Element e = getCacheElement(uuid); |
|
139 |
CdmBase cdmEntity; |
|
140 |
if (e == null) { |
|
141 |
return null; |
|
142 |
} else { |
|
143 |
return(CdmBase)e.getObjectValue(); |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
|
|
148 |
/* (non-Javadoc) |
|
149 |
* @see eu.etaxonomy.cdm.model.ICdmCacher#exists(java.util.UUID) |
|
150 |
*/ |
|
151 |
public boolean exists(UUID uuid) { |
|
152 |
return getCacheElement(uuid) != null; |
|
153 |
} |
|
154 |
|
|
155 |
|
|
156 |
/* (non-Javadoc) |
|
157 |
* @see eu.etaxonomy.cdm.model.ICdmCacher#existsAndIsNotNull(java.util.UUID) |
|
158 |
*/ |
|
159 |
public boolean existsAndIsNotNull(UUID uuid) { |
|
160 |
Element e = getCacheElement(uuid); |
|
161 |
CdmBase cdmEntity; |
|
162 |
if (e != null) { |
|
163 |
return (CdmBase)e.getObjectValue() != null; |
|
164 |
} |
|
165 |
return false; |
|
166 |
} |
|
167 |
|
|
168 |
} |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/common/IdentifiableEntityTest.java | ||
---|---|---|
20 | 20 |
import org.junit.BeforeClass; |
21 | 21 |
import org.junit.Test; |
22 | 22 |
|
23 |
import eu.etaxonomy.cdm.model.MockCdmCacher; |
|
24 | 23 |
import eu.etaxonomy.cdm.model.agent.Person; |
25 | 24 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
26 | 25 |
import eu.etaxonomy.cdm.model.name.Rank; |
27 | 26 |
import eu.etaxonomy.cdm.model.reference.Reference; |
28 | 27 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
29 |
import eu.etaxonomy.cdm.model.reference.ReferenceType; |
|
30 | 28 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
31 | 29 |
|
32 | 30 |
/** |
... | ... | |
59 | 57 |
DefaultTermInitializer vocabularyStore = new DefaultTermInitializer(); |
60 | 58 |
vocabularyStore.initialize(); |
61 | 59 |
|
62 |
// Have to add a mock cdm cacher since the model project has no |
|
63 |
// access to the persistence layer |
|
64 |
MockCdmCacher cdmCacher = new MockCdmCacher(); |
|
65 | 60 |
} |
66 | 61 |
/** |
67 | 62 |
* @throws java.lang.Exception |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategyTest.java | ||
---|---|---|
169 | 169 |
unrankedCache = strategy.getNameCache(unrankedName); |
170 | 170 |
Assert.assertEquals("Correct unranked cache expected", "Genus [infragen.] Infrageneric", unrankedCache); |
171 | 171 |
|
172 |
|
|
172 |
//bot. specific ranks |
|
173 |
botName = BotanicalName.NewInstance(Rank.SECTION_BOTANY()); |
|
174 |
botName.setGenusOrUninomial("Genus"); |
|
175 |
botName.setInfraGenericEpithet("Infragenus"); |
|
176 |
Assert.assertEquals("", "Genus sect. Infragenus", botName.getNameCache()); |
|
177 |
botName.setRank(Rank.SUBSECTION_BOTANY()); |
|
178 |
Assert.assertEquals("", "Genus subsect. Infragenus", botName.getNameCache()); |
|
179 |
|
|
180 |
//zool. specific ranks (we don't have markers here therefore no problem should exist |
|
181 |
ZoologicalName zooName = ZoologicalName.NewInstance(Rank.SECTION_ZOOLOGY()); |
|
182 |
zooName.setGenusOrUninomial("Genus"); |
|
183 |
zooName.setInfraGenericEpithet("Infragenus"); |
|
184 |
Assert.assertEquals("", "Genus", zooName.getNameCache()); |
|
185 |
zooName.setRank(Rank.SUBSECTION_ZOOLOGY()); |
|
186 |
Assert.assertEquals("", "Genus", zooName.getNameCache()); |
|
187 |
|
|
173 | 188 |
} |
174 | 189 |
|
175 | 190 |
/** |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/reference/GenericDefaultCacheStrategyTest.java | ||
---|---|---|
110 | 110 |
generic1.setAuthorTeam(team1); |
111 | 111 |
generic1.setTitleCache(null); //reset cache in case aspectJ is not enabled |
112 | 112 |
Assert.assertEquals("Unexpected title cache.", "Authorteam", generic1.getTitleCache()); |
113 |
Assert.assertEquals("", generic1.getNomenclaturalCitation(null)); |
|
113 | 114 |
} |
114 | 115 |
|
115 | 116 |
@Test |
... | ... | |
117 | 118 |
generic1.setAuthorTeam(team1); |
118 | 119 |
generic1.setDatePublished(TimePeriodParser.parseString("1792")); |
119 | 120 |
generic1.setTitleCache(null); //reset cache in case aspectJ is not enabled |
120 |
Assert.assertEquals("Unexpected title cache.", "Authorteam, 1792", generic1.getTitleCache()); |
|
121 |
Assert.assertEquals("Unexpected title cache.", "Authorteam, 1792", generic1.getTitleCache()); |
|
122 |
Assert.assertEquals("1792", generic1.getNomenclaturalCitation(null)); |
|
123 |
} |
|
124 |
|
|
125 |
@Test |
|
126 |
public void testDoubleDotBeforeYear(){ |
|
127 |
generic1.setAuthorTeam(team1); |
|
128 |
String detail = "sine no."; |
|
129 |
generic1.setAbbrevTitle("My title"); |
|
130 |
generic1.setDatePublished(TimePeriodParser.parseString("1883-1884")); |
|
131 |
generic1.setTitleCache(null); //reset cache in case aspectJ is not enabled |
|
132 |
Assert.assertEquals("My title: sine no. 1883-1884", generic1.getNomenclaturalCitation(detail)); |
|
133 |
|
|
134 |
|
|
121 | 135 |
} |
122 | 136 |
|
123 | 137 |
|
cdmlib-remote-webapp/pom.xml | ||
---|---|---|
4 | 4 |
<parent> |
5 | 5 |
<artifactId>cdmlib-parent</artifactId> |
6 | 6 |
<groupId>eu.etaxonomy</groupId> |
7 |
<version>3.3.6-SNAPSHOT</version>
|
|
7 |
<version>3.3.7-SNAPSHOT</version>
|
|
8 | 8 |
<relativePath>../pom.xml</relativePath> |
9 | 9 |
</parent> |
10 | 10 |
|
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DescriptionController.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.cdm.remote.controller; |
12 | 12 |
|
13 |
import java.awt.Color; |
|
13 | 14 |
import java.io.IOException; |
14 | 15 |
import java.util.Arrays; |
15 | 16 |
import java.util.EnumSet; |
16 | 17 |
import java.util.List; |
18 |
import java.util.Map; |
|
17 | 19 |
import java.util.Set; |
18 | 20 |
import java.util.UUID; |
19 | 21 |
|
20 | 22 |
import javax.servlet.http.HttpServletRequest; |
21 | 23 |
import javax.servlet.http.HttpServletResponse; |
22 | 24 |
|
25 |
import org.codehaus.jackson.JsonParseException; |
|
26 |
import org.codehaus.jackson.map.JsonMappingException; |
|
23 | 27 |
import org.springframework.beans.factory.annotation.Autowired; |
24 | 28 |
import org.springframework.stereotype.Controller; |
25 | 29 |
import org.springframework.web.bind.WebDataBinder; |
... | ... | |
36 | 40 |
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO; |
37 | 41 |
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO.InfoPart; |
38 | 42 |
import eu.etaxonomy.cdm.api.service.pager.Pager; |
43 |
import eu.etaxonomy.cdm.ext.geo.EditGeoServiceUtilities; |
|
39 | 44 |
import eu.etaxonomy.cdm.ext.geo.IEditGeoService; |
40 | 45 |
import eu.etaxonomy.cdm.model.common.Annotation; |
41 | 46 |
import eu.etaxonomy.cdm.model.common.Language; |
... | ... | |
45 | 50 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
46 | 51 |
import eu.etaxonomy.cdm.model.description.Feature; |
47 | 52 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
53 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase; |
|
48 | 54 |
import eu.etaxonomy.cdm.model.description.StateData; |
49 | 55 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
50 | 56 |
import eu.etaxonomy.cdm.model.description.TextData; |
... | ... | |
255 | 261 |
* @param request |
256 | 262 |
* @param response |
257 | 263 |
* @return |
264 |
* @throws IOException |
|
265 |
* @throws JsonMappingException |
|
266 |
* @throws JsonParseException |
|
258 | 267 |
*/ |
259 | 268 |
@RequestMapping(value = "/description/distributionInfoFor/{uuid}", method = RequestMethod.GET) |
260 | 269 |
public ModelAndView doGetDistributionInfo( |
... | ... | |
264 | 273 |
@RequestParam(value = "statusOrderPreference", required = false) boolean statusOrderPreference, |
265 | 274 |
@RequestParam(value = "hideMarkedAreas", required = false) DefinedTermBaseList<MarkerType> hideMarkedAreasList, |
266 | 275 |
@RequestParam(value = "omitLevels", required = false) Set<NamedAreaLevel> omitLevels, |
276 |
@RequestParam(value = "statusColors", required = false) String statusColorsString, |
|
267 | 277 |
HttpServletRequest request, |
268 |
HttpServletResponse response) { |
|
278 |
HttpServletResponse response) throws JsonParseException, JsonMappingException, IOException {
|
|
269 | 279 |
|
270 | 280 |
logger.debug("doGetDistributionInfo() - " + requestPathAndQuery(request)); |
271 | 281 |
|
... | ... | |
278 | 288 |
|
279 | 289 |
EnumSet<InfoPart> parts = EnumSet.copyOf(partSet); |
280 | 290 |
|
291 |
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors = EditGeoServiceUtilities.buildStatusColorMap(statusColorsString, termService); |
|
292 |
|
|
281 | 293 |
DistributionInfoDTO dto = geoService.composeDistributionInfoFor(parts, taxonUuid, subAreaPreference, statusOrderPreference, |
282 |
hideMarkedAreas, omitLevels, LocaleContext.getLanguages(), getInitializationStrategy()); |
|
294 |
hideMarkedAreas, omitLevels, presenceAbsenceTermColors, LocaleContext.getLanguages(), getInitializationStrategy());
|
|
283 | 295 |
|
284 | 296 |
mv.addObject(dto); |
285 | 297 |
|
286 | 298 |
return mv; |
287 | 299 |
} |
288 | 300 |
|
301 |
|
|
289 | 302 |
} |
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DescriptionPortalController.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.cdm.remote.controller; |
12 | 12 |
|
13 |
import java.awt.Color; |
|
13 | 14 |
import java.io.IOException; |
14 | 15 |
import java.util.Arrays; |
15 | 16 |
import java.util.Collection; |
16 | 17 |
import java.util.EnumSet; |
17 | 18 |
import java.util.HashSet; |
18 | 19 |
import java.util.List; |
20 |
import java.util.Map; |
|
19 | 21 |
import java.util.Set; |
20 | 22 |
import java.util.UUID; |
21 | 23 |
|
22 | 24 |
import javax.servlet.http.HttpServletRequest; |
23 | 25 |
import javax.servlet.http.HttpServletResponse; |
24 | 26 |
|
27 |
import org.codehaus.jackson.JsonParseException; |
|
28 |
import org.codehaus.jackson.map.JsonMappingException; |
|
25 | 29 |
import org.springframework.beans.factory.annotation.Autowired; |
26 | 30 |
import org.springframework.stereotype.Controller; |
27 | 31 |
import org.springframework.transaction.annotation.Transactional; |
... | ... | |
40 | 44 |
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO.InfoPart; |
41 | 45 |
import eu.etaxonomy.cdm.api.service.pager.Pager; |
42 | 46 |
import eu.etaxonomy.cdm.api.utility.DescriptionUtility; |
47 |
import eu.etaxonomy.cdm.ext.geo.EditGeoServiceUtilities; |
|
43 | 48 |
import eu.etaxonomy.cdm.ext.geo.IEditGeoService; |
44 | 49 |
import eu.etaxonomy.cdm.model.common.Annotation; |
45 | 50 |
import eu.etaxonomy.cdm.model.common.Marker; |
46 | 51 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
47 | 52 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
48 | 53 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
54 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase; |
|
49 | 55 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
50 | 56 |
import eu.etaxonomy.cdm.model.location.NamedAreaLevel; |
51 | 57 |
import eu.etaxonomy.cdm.remote.editor.DefinedTermBaseList; |
... | ... | |
212 | 218 |
* @param request |
213 | 219 |
* @param response |
214 | 220 |
* @return |
221 |
* @throws IOException |
|
222 |
* @throws JsonMappingException |
|
223 |
* @throws JsonParseException |
|
215 | 224 |
*/ |
216 | 225 |
@RequestMapping(value = "/portal/description/distributionInfoFor/{uuid}", method = RequestMethod.GET) |
217 | 226 |
public ModelAndView doGetDistributionInfo( |
... | ... | |
221 | 230 |
@RequestParam(value = "statusOrderPreference", required = false) boolean statusOrderPreference, |
222 | 231 |
@RequestParam(value = "hideMarkedAreas", required = false) DefinedTermBaseList<MarkerType> hideMarkedAreasList, |
223 | 232 |
@RequestParam(value = "omitLevels", required = false) Set<NamedAreaLevel> omitLevels, |
233 |
@RequestParam(value = "statusColors", required = false) String statusColorsString, |
|
224 | 234 |
HttpServletRequest request, |
225 |
HttpServletResponse response) { |
|
235 |
HttpServletResponse response) throws JsonParseException, JsonMappingException, IOException {
|
|
226 | 236 |
|
227 | 237 |
logger.debug("doGetDistributionInfo() - " + requestPathAndQuery(request)); |
228 | 238 |
|
... | ... | |
235 | 245 |
|
236 | 246 |
EnumSet<InfoPart> parts = EnumSet.copyOf(partSet); |
237 | 247 |
|
248 |
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceTermColors = EditGeoServiceUtilities.buildStatusColorMap(statusColorsString, termService); |
|
249 |
|
|
238 | 250 |
DistributionInfoDTO dto = geoService.composeDistributionInfoFor(parts, taxonUuid, subAreaPreference, statusOrderPreference, |
239 |
hideMarkedAreas, omitLevels, LocaleContext.getLanguages(), DISTRIBUTION_INFO_INIT_STRATEGY); |
|
251 |
hideMarkedAreas, omitLevels, presenceAbsenceTermColors, LocaleContext.getLanguages(), DISTRIBUTION_INFO_INIT_STRATEGY);
|
|
240 | 252 |
|
241 | 253 |
mv.addObject(dto); |
242 | 254 |
|
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/dto/NameCatalogueController.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.remote.controller.dto; |
10 | 10 |
|
11 |
import java.io.File; |
|
12 | 11 |
import java.io.IOException; |
13 | 12 |
import java.io.InputStream; |
14 |
import java.io.PrintWriter; |
|
15 | 13 |
import java.util.ArrayList; |
16 | 14 |
import java.util.Arrays; |
17 | 15 |
import java.util.HashMap; |
18 | 16 |
import java.util.HashSet; |
17 |
import java.util.Hashtable; |
|
19 | 18 |
import java.util.Iterator; |
20 | 19 |
import java.util.LinkedHashMap; |
21 | 20 |
import java.util.List; |
22 | 21 |
import java.util.Map; |
23 | 22 |
import java.util.Set; |
24 |
import java.util.StringTokenizer; |
|
25 | 23 |
import java.util.TreeMap; |
26 | 24 |
import java.util.UUID; |
27 | 25 |
|
28 | 26 |
import javax.servlet.http.HttpServletRequest; |
29 | 27 |
import javax.servlet.http.HttpServletResponse; |
30 | 28 |
|
31 |
import java.util.Hashtable; |
|
32 |
|
|
33 |
import org.apache.log4j.Level; |
|
34 | 29 |
import org.apache.lucene.document.Document; |
35 | 30 |
import org.apache.lucene.queryParser.ParseException; |
36 | 31 |
import org.joda.time.DateTime; |
... | ... | |
50 | 45 |
import eu.etaxonomy.cdm.api.service.ICommonService; |
51 | 46 |
import eu.etaxonomy.cdm.api.service.INameService; |
52 | 47 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
53 |
import eu.etaxonomy.cdm.api.service.ITermService; |
|
54 | 48 |
import eu.etaxonomy.cdm.api.service.search.DocumentSearchResult; |
55 |
import eu.etaxonomy.cdm.api.service.search.SearchResult; |
|
56 | 49 |
import eu.etaxonomy.cdm.common.DocUtils; |
57 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
58 | 50 |
import eu.etaxonomy.cdm.hibernate.search.AcceptedTaxonBridge; |
59 |
|
|
60 |
import eu.etaxonomy.cdm.remote.controller.BaseController; |
|
61 |
import eu.etaxonomy.cdm.remote.dto.common.ErrorResponse; |
|
62 |
import eu.etaxonomy.cdm.remote.dto.common.RemoteResponse; |
|
63 |
import eu.etaxonomy.cdm.remote.dto.namecatalogue.AcceptedNameSearch; |
|
64 |
import eu.etaxonomy.cdm.remote.dto.namecatalogue.NameInformation; |
|
65 |
import eu.etaxonomy.cdm.remote.dto.namecatalogue.NameSearch; |
|
66 |
import eu.etaxonomy.cdm.remote.dto.namecatalogue.TaxonInformation; |
|
67 |
import eu.etaxonomy.cdm.remote.view.HtmlView; |
|
68 | 51 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
69 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
|
70 | 52 |
import eu.etaxonomy.cdm.model.common.IdentifiableSource; |
71 | 53 |
import eu.etaxonomy.cdm.model.common.Language; |
72 |
import eu.etaxonomy.cdm.model.common.Representation; |
|
73 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
74 |
import eu.etaxonomy.cdm.model.description.Feature; |
|
75 | 54 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
76 | 55 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
77 | 56 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
85 | 64 |
import eu.etaxonomy.cdm.persistence.query.MatchMode; |
86 | 65 |
import eu.etaxonomy.cdm.persistence.query.OrderHint; |
87 | 66 |
import eu.etaxonomy.cdm.persistence.query.OrderHint.SortOrder; |
67 |
import eu.etaxonomy.cdm.remote.controller.BaseController; |
|
68 |
import eu.etaxonomy.cdm.remote.dto.common.ErrorResponse; |
|
69 |
import eu.etaxonomy.cdm.remote.dto.common.RemoteResponse; |
|
70 |
import eu.etaxonomy.cdm.remote.dto.namecatalogue.AcceptedNameSearch; |
|
71 |
import eu.etaxonomy.cdm.remote.dto.namecatalogue.NameInformation; |
Also available in: Unified diff