attributeType = new URI(StringAttribute.identifier);
} catch (URISyntaxException e) {
//we tried
}
}
return new EvaluationResult(BagAttribute
.createEmptyBag(attributeType));
}
if (!willService(attributeId)) {
logger.debug("AttributeFinder:willService() {} returns false", iAm());
return new EvaluationResult(BagAttribute
.createEmptyBag(attributeType));
}
if (category != null) {
logger.debug("++++++++++ AttributeFinder:findAttribute {} category={}", iAm(), category.toString());
}
logger.debug("++++++++++ AttributeFinder:findAttribute {} designatorType={}", iAm(), designatorType);
logger.debug("about to get temp {}", iAm());
Object temp =
getAttributeLocally(designatorType,
attributeId.toASCIIString(),
category,
context);
logger.debug("{} got temp={}", iAm(), temp);
if (temp == null) {
logger.debug("AttributeFinder:findAttribute" + " exit on "
+ "attribute value not found" + iAm());
return new EvaluationResult(BagAttribute
.createEmptyBag(attributeType));
}
Set<AttributeValue> set = new HashSet<AttributeValue>();
if (temp instanceof String) {
logger.debug("AttributeFinder:findAttribute will return a String {}", iAm());
if (attributeType.toString().equals(StringAttribute.identifier)) {
set.add(new StringAttribute((String) temp));
} else if (attributeType.toString()
.equals(DateTimeAttribute.identifier)) {
DateTimeAttribute tempDateTimeAttribute;
try {
tempDateTimeAttribute =
DateTimeAttribute.getInstance((String) temp);
set.add(tempDateTimeAttribute);
} catch (Throwable t) {
}
} else if (attributeType.toString()
.equals(DateAttribute.identifier)) {
DateAttribute tempDateAttribute;
try {
tempDateAttribute =
DateAttribute.getInstance((String) temp);
set.add(tempDateAttribute);
} catch (Throwable t) {
}
} else if (attributeType.toString()
.equals(TimeAttribute.identifier)) {
TimeAttribute tempTimeAttribute;
try {
tempTimeAttribute =
TimeAttribute.getInstance((String) temp);
set.add(tempTimeAttribute);
} catch (Throwable t) {
}
} else if (attributeType.toString()
.equals(IntegerAttribute.identifier)) {
IntegerAttribute tempIntegerAttribute;
try {
tempIntegerAttribute =
IntegerAttribute.getInstance((String) temp);
set.add(tempIntegerAttribute);
} catch (Throwable t) {
}
} //xacml fixup
//was set.add(new StringAttribute((String)temp));
} else if (temp instanceof String[]) {
logger.debug("AttributeFinder:findAttribute will return a String[] ", iAm());
for (int i = 0; i < ((String[]) temp).length; i++) {
if (((String[]) temp)[i] == null) {
continue;
}
if (attributeType.toString().equals(StringAttribute.identifier)) {
set.add(new StringAttribute(((String[]) temp)[i]));
} else if (attributeType.toString()
.equals(DateTimeAttribute.identifier)) {
logger.debug("USING AS DATETIME:{}", ((String[]) temp)[i]);
DateTimeAttribute tempDateTimeAttribute;
try {
tempDateTimeAttribute =
DateTimeAttribute
.getInstance(((String[]) temp)[i]);
set.add(tempDateTimeAttribute);
} catch (Throwable t) {
}
} else if (attributeType.toString()
.equals(DateAttribute.identifier)) {
logger.debug("USING AS DATE:{}", ((String[]) temp)[i]);
DateAttribute tempDateAttribute;
try {
tempDateAttribute =
DateAttribute.getInstance(((String[]) temp)[i]);
set.add(tempDateAttribute);
} catch (Throwable t) {
}
} else if (attributeType.toString()
.equals(TimeAttribute.identifier)) {
logger.debug("USING AS TIME:{}", ((String[]) temp)[i]);
TimeAttribute tempTimeAttribute;
try {
tempTimeAttribute =
TimeAttribute.getInstance(((String[]) temp)[i]);
set.add(tempTimeAttribute);
} catch (Throwable t) {
}
} else if (attributeType.toString()
.equals(IntegerAttribute.identifier)) {
logger.debug("USING AS INTEGER: {}", ((String[]) temp)[i]);
IntegerAttribute tempIntegerAttribute;
try {
tempIntegerAttribute =
IntegerAttribute
.getInstance(((String[]) temp)[i]);
set.add(tempIntegerAttribute);
} catch (Throwable t) {
}
}
}
}
return new EvaluationResult(new BagAttribute(attributeType, set));
}