Revision 5dd077cf
Added by Andreas Müller almost 10 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/match/DefaultMatchStrategy.java | ||
---|---|---|
25 | 25 |
import java.util.Set; |
26 | 26 |
import java.util.UUID; |
27 | 27 |
|
28 |
import org.apache.commons.lang.StringUtils; |
|
28 | 29 |
import org.apache.log4j.Logger; |
29 | 30 |
|
30 | 31 |
import eu.etaxonomy.cdm.common.CdmUtils; |
... | ... | |
206 | 207 |
result &= matchPrimitiveField(matchFirst, matchSecond, fieldMatcher, replaceModeList); |
207 | 208 |
}else if (fieldType == String.class ){ |
208 | 209 |
result &= matchPrimitiveField(matchFirst, matchSecond, fieldMatcher, replaceModeList); |
210 |
}else if (fieldType == Integer.class ){ |
|
211 |
result &= matchPrimitiveField(matchFirst, matchSecond, fieldMatcher, replaceModeList); |
|
209 | 212 |
}else if(isUserType(fieldType)){ |
210 | 213 |
result &= matchPrimitiveField(matchFirst, matchSecond, fieldMatcher, replaceModeList); |
211 | 214 |
}else if(fieldType == UUID.class){ |
... | ... | |
263 | 266 |
private <T extends IMatchable> boolean matchCollectionField(T matchFirst, T matchSecond, FieldMatcher fieldMatcher, List<MatchMode> replaceModeList) throws Exception { |
264 | 267 |
boolean result; |
265 | 268 |
Field field = fieldMatcher.getField(); |
266 |
Collection value1 = (Collection)field.get(matchFirst); |
|
267 |
Collection value2 = (Collection)field.get(matchSecond); |
|
269 |
Collection<?> value1 = (Collection)field.get(matchFirst);
|
|
270 |
Collection<?> value2 = (Collection)field.get(matchSecond);
|
|
268 | 271 |
MatchMode matchMode = fieldMatcher.getMatchMode(); |
269 | 272 |
Class<?> fieldType = fieldMatcher.getField().getType(); |
270 | 273 |
IMatchStrategy matchStrategy = fieldMatcher.getMatchStrategy(); |
... | ... | |
305 | 308 |
*/ |
306 | 309 |
private Object checkEmpty(Object object) { |
307 | 310 |
if (object instanceof String){ |
308 |
if (CdmUtils.isEmpty((String)object)){
|
|
311 |
if (StringUtils.isBlank((String)object)){
|
|
309 | 312 |
return null; |
310 | 313 |
} |
311 | 314 |
} |
... | ... | |
369 | 372 |
return result; |
370 | 373 |
} |
371 | 374 |
|
372 |
private Class getTypeOfSet(Field field) throws MatchException{ |
|
375 |
private Class<?> getTypeOfSet(Field field) throws MatchException{
|
|
373 | 376 |
Type genericType = (ParameterizedType)field.getGenericType(); |
374 | 377 |
if (genericType instanceof ParameterizedType/*Impl*/){ |
375 | 378 |
ParameterizedType paraType = (ParameterizedType)genericType; |
376 | 379 |
paraType.getRawType(); |
377 | 380 |
Type[] arguments = paraType.getActualTypeArguments(); |
378 | 381 |
if (arguments.length == 1){ |
379 |
Class collectionClass; |
|
382 |
Class<?> collectionClass;
|
|
380 | 383 |
try { |
381 | 384 |
if (arguments[0] instanceof Class){ |
382 | 385 |
return (Class)arguments[0]; |
... | ... | |
469 | 472 |
} |
470 | 473 |
} |
471 | 474 |
|
472 |
/* (non-Javadoc) |
|
473 |
* @see eu.etaxonomy.cdm.strategy.match.IMatchStrategy#getMatchFields() |
|
474 |
*/ |
|
475 |
|
|
476 |
@Override |
|
475 | 477 |
public Set<String> getMatchFieldPropertyNames() { |
476 | 478 |
return matchFields.keySet(); |
477 | 479 |
} |
Also available in: Unified diff
fix matching for Integer #4229