public static Apply createRuleCondition() throws URISyntaxException {
List conditionArgs = new ArrayList();
// get the function that the condition uses
FunctionFactory factory = FunctionFactory.getConditionInstance();
Function conditionFunction = null;
try {
} catch (Exception e) {
// see comment in createTargetMatch()
return null;
}
// now create the apply section that gets the designator value
List applyArgs = new ArrayList();
factory = FunctionFactory.getGeneralInstance();
Function applyFunction = null;
try {
applyFunction =
factory.createFunction("urn:oasis:names:tc:xacml:1.0:function:"
+ "time-one-and-only");
} catch (Exception e) {
// see comment in createTargetMatch()
return null;
}
URI designatorType =
new URI("http://www.w3.org/2001/XMLSchema#time");
URI designatorId =
new URI("urn:oasis:names:tc:xacml:1.0:environment:current-time");
AttributeDesignator designator =
new AttributeDesignator(
AttributeDesignator.ENVIRONMENT_TARGET,
designatorType,
designatorId,
false,
null);
applyArgs.add(designator);
Apply apply = new Apply(applyFunction, applyArgs, false);
// add the new apply element to the list of inputs to the condition
conditionArgs.add(apply);
// create an AttributeValue and add it to the input list
StringAttribute value = new StringAttribute("developers");
conditionArgs.add(value);
// finally, create & return our Condition
return new Apply(conditionFunction, conditionArgs, true);
}
在运行至加黑部分时,出现异常,返回空值。
该如何解决呢?
谢谢了!