本文整理汇总了Java中com.evolveum.midpoint.prism.xml.XsdTypeMapper.multiplicityToInteger方法的典型用法代码示例。如果您正苦于以下问题:Java XsdTypeMapper.multiplicityToInteger方法的具体用法?Java XsdTypeMapper.multiplicityToInteger怎么用?Java XsdTypeMapper.multiplicityToInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.evolveum.midpoint.prism.xml.XsdTypeMapper
的用法示例。
在下文中一共展示了XsdTypeMapper.multiplicityToInteger方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isMatchingConstraint
import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入方法依赖的package包/类
private static boolean isMatchingConstraint(OrderConstraintsType orderConstraint, EvaluationOrder evaluationOrder) {
int evaluationOrderInt = evaluationOrder.getMatchingRelationOrder(orderConstraint.getRelation());
if (orderConstraint.getOrder() != null) {
return orderConstraint.getOrder() == evaluationOrderInt;
} else {
int orderMin = 1;
int orderMax = 1;
if (orderConstraint.getOrderMin() != null) {
orderMin = XsdTypeMapper.multiplicityToInteger(orderConstraint.getOrderMin());
}
if (orderConstraint.getOrderMax() != null) {
orderMax = XsdTypeMapper.multiplicityToInteger(orderConstraint.getOrderMax());
}
return XsdTypeMapper.isMatchingMultiplicity(evaluationOrderInt, orderMin, orderMax);
}
}
示例2: setMultiplicity
import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入方法依赖的package包/类
private void setMultiplicity(ItemDefinition itemDef, XSParticle particle, XSAnnotation annotation,
boolean topLevel) {
if (topLevel || particle == null) {
((ItemDefinitionImpl) itemDef).setMinOccurs(0);
Element maxOccursAnnotation = SchemaProcessorUtil.getAnnotationElement(annotation, A_MAX_OCCURS);
if (maxOccursAnnotation != null) {
String maxOccursString = maxOccursAnnotation.getTextContent();
int maxOccurs = XsdTypeMapper.multiplicityToInteger(maxOccursString);
((ItemDefinitionImpl) itemDef).setMaxOccurs(maxOccurs);
} else {
((ItemDefinitionImpl) itemDef).setMaxOccurs(-1);
}
} else {
// itemDef.setMinOccurs(particle.getMinOccurs());
// itemDef.setMaxOccurs(particle.getMaxOccurs());
((ItemDefinitionImpl) itemDef).setMinOccurs(particle.getMinOccurs().intValue());
((ItemDefinitionImpl) itemDef).setMaxOccurs(particle.getMaxOccurs().intValue());
}
}
示例3: determineOutputDefinition
import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入方法依赖的package包/类
private static ItemDefinition<?> determineOutputDefinition(ScriptingVariableDefinitionType variableDefinition,
VariableResolutionContext ctx, String shortDesc) throws SchemaException {
List<JAXBElement<?>> evaluators = variableDefinition.getExpression().getExpressionEvaluator();
boolean isValue = !evaluators.isEmpty() && QNameUtil.match(evaluators.get(0).getName(), SchemaConstants.C_VALUE);
QName elementName = new QName(variableDefinition.getName());
if (variableDefinition.getType() != null) {
Integer maxOccurs;
if (variableDefinition.getMaxOccurs() != null) {
maxOccurs = XsdTypeMapper.multiplicityToInteger(variableDefinition.getMaxOccurs());
} else if (isValue) { // if we have constant values we can try to guess
maxOccurs = evaluators.size() > 1 ? -1 : 1;
} else {
maxOccurs = null; // no idea
}
if (maxOccurs == null) {
maxOccurs = -1; // to be safe
}
return ctx.prismContext.getSchemaRegistry().createAdHocDefinition(elementName, variableDefinition.getType(), 0, maxOccurs);
}
if (isValue) {
return StaticExpressionUtil.deriveOutputDefinitionFromValueElements(elementName, evaluators, shortDesc, ctx.prismContext);
} else {
throw new SchemaException("The type of scripting variable " + variableDefinition.getName() + " is not defined");
}
}
示例4: getMinOccurs
import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入方法依赖的package包/类
private int getMinOccurs() {
if (credentialPolicy == null) {
return 0;
}
String minOccurs = credentialPolicy.getMinOccurs();
if (minOccurs == null) {
return 0;
}
return XsdTypeMapper.multiplicityToInteger(minOccurs);
}
示例5: getMinOccurs
import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入方法依赖的package包/类
private int getMinOccurs() {
if (credentialPolicy == null) {
return 0;
}
String minOccursPhrase = credentialPolicy.getMinOccurs();
if (minOccursPhrase == null && valuePolicy != null) {
minOccursPhrase = valuePolicy.getMinOccurs(); // deprecated but let's consider it
}
Integer minOccurs = XsdTypeMapper.multiplicityToInteger(minOccursPhrase);
return defaultIfNull(minOccurs, 0);
}
示例6: validateValue
import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入方法依赖的package包/类
public <O extends ObjectType> boolean validateValue(String newValue, ValuePolicyType pp,
PrismObject<O> object, StringBuilder message, String shortDesc, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException {
Validate.notNull(pp, "Value policy must not be null.");
OperationResult result = parentResult.createSubresult(OPERATION_STRING_POLICY_VALIDATION);
result.addArbitraryObjectAsParam("policyName", pp.getName());
normalize(pp);
if (newValue == null &&
(pp.getMinOccurs() == null || XsdTypeMapper.multiplicityToInteger(pp.getMinOccurs()) == 0)) {
// No password is allowed
result.recordSuccess();
return true;
}
if (newValue == null) {
newValue = "";
}
LimitationsType lims = pp.getStringPolicy().getLimitations();
testMinimalLength(newValue, lims, result, message);
testMaximalLength(newValue, lims, result, message);
testMinimalUniqueCharacters(newValue, lims, result, message);
if (lims.getLimit() == null || lims.getLimit().isEmpty()) {
if (message.toString() == null || message.toString().isEmpty()) {
result.computeStatus();
} else {
result.computeStatus(message.toString());
}
return result.isAcceptable();
}
// check limitation
HashSet<String> validChars = null;
HashSet<String> allValidChars = new HashSet<>();
List<String> passwd = StringPolicyUtils.stringTokenizer(newValue);
for (StringLimitType stringLimitationType : lims.getLimit()) {
OperationResult limitResult = new OperationResult(
"Tested limitation: " + stringLimitationType.getDescription());
validChars = getValidCharacters(stringLimitationType.getCharacterClass(), pp);
int count = countValidCharacters(validChars, passwd);
allValidChars.addAll(validChars);
testMinimalOccurence(stringLimitationType, count, limitResult, message);
testMaximalOccurence(stringLimitationType, count, limitResult, message);
testMustBeFirst(stringLimitationType, count, limitResult, message, newValue, validChars);
limitResult.computeStatus();
result.addSubresult(limitResult);
}
testInvalidCharacters(passwd, allValidChars, result, message);
testCheckExpression(newValue, lims, object, shortDesc, task, result, message);
if (message.toString() == null || message.toString().isEmpty()) {
result.computeStatus();
} else {
result.computeStatus(message.toString());
}
return result.isAcceptable();
}