WildcardPattern rtNamespacePattern = null;
WildcardPattern rtNamePattern = null;
String recordTypeAttr = DocumentHelper.getAttribute(element, "recordType", false);
if (recordTypeAttr != null) {
QName rtName = ConfUtil.parseQName(recordTypeAttr, element, true);
rtNamespacePattern = new WildcardPattern(rtName.getNamespace());
rtNamePattern = new WildcardPattern(rtName.getName());
}
//
// "Instance of" condition
//
String instanceOfAttr = DocumentHelper.getAttribute(element, "instanceOf", false);
QName instanceOfType = null;
if (instanceOfAttr != null) {
instanceOfType = ConfUtil.parseQName(instanceOfAttr, element, false);
}
List<String> tableNames = extractTableNames(DocumentHelper.getAttribute(element, "tables", false));
//
// Condition on variant properties
//
Map<String, String> varPropsPattern = parseVariantPropertiesPattern(element, "variant");
//
// Condition on field
//
String fieldAttr = DocumentHelper.getAttribute(element, "field", false);
FieldType fieldType = null;
RecordMatcher.FieldComparator comparator = null;
Object fieldValue = null;
if (fieldAttr != null) {
int eqPos = fieldAttr.indexOf('='); // we assume = is not a symbol occurring in the field name
if (eqPos == -1) {
throw new IndexerConfException("field test should be of the form \"namespace:name(=|!=)value\", which " +
"the following is not: " + fieldAttr + ", at " + LocationAttributes.getLocation(element));
}
// not-equals support (simplistic parsing approach, doesn't need anything more complex for now)
String namePart = fieldAttr.substring(0, eqPos);
if (namePart.endsWith("!")) {
namePart = namePart.substring(0, namePart.length() - 1);
comparator = RecordMatcher.FieldComparator.NOT_EQUAL;
} else {
comparator = RecordMatcher.FieldComparator.EQUAL;
}
QName fieldName = ConfUtil.parseQName(namePart, element);
fieldType = typeManager.getFieldTypeByName(fieldName);
String fieldValueString = fieldAttr.substring(eqPos + 1);
try {
fieldValue = FieldValueStringConverter.fromString(fieldValueString, fieldType.getValueType(),
repository.getIdGenerator());