当前位置: 首页>>代码示例>>Java>>正文


Java XsdTypeMapper类代码示例

本文整理汇总了Java中com.evolveum.midpoint.prism.xml.XsdTypeMapper的典型用法代码示例。如果您正苦于以下问题:Java XsdTypeMapper类的具体用法?Java XsdTypeMapper怎么用?Java XsdTypeMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XsdTypeMapper类属于com.evolveum.midpoint.prism.xml包,在下文中一共展示了XsdTypeMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPropertyDefinition

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
private ItemDefinition<?> createPropertyDefinition(PrismContainerDefinitionImpl<?> configurationContainerDef,
		PropertyDescriptor prop) {
	String propName = prop.getName();
	Class<?> propertyType = prop.getPropertyType();
	Class<?> baseType = propertyType;
	int minOccurs = 1;
	int maxOccurs = 1;
	if (propertyType.isArray()) {
		maxOccurs = -1;
		baseType = propertyType.getComponentType();
	}
	// TODO: minOccurs: define which properties are optional/mandatory
	// TODO: display names, ordering, help texts
	QName propType = XsdTypeMapper.toXsdType(baseType);
	return configurationContainerDef.createPropertyDefinition(new QName(configurationContainerDef.getName().getNamespaceURI(), propName),
			propType, minOccurs, maxOccurs);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:18,代码来源:ConnectorFactoryBuiltinImpl.java

示例2: 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);
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:AssignmentPathSegmentImpl.java

示例3: evaluateExpression

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
private <T> List<T> evaluateExpression(Class<T> resultClass, ExpressionType expressionType, ExpressionVariables expressionVariables,
        String shortDesc, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException {

    QName xsdType = XsdTypeMapper.toXsdType(resultClass);

    QName resultName = new QName(SchemaConstants.NS_C, "result");
    PrismPropertyDefinition<T> resultDef = new PrismPropertyDefinitionImpl<>(resultName, xsdType, prismContext);

    Expression<PrismPropertyValue<T>,PrismPropertyDefinition<T>> expression = expressionFactory.makeExpression(expressionType, resultDef, shortDesc, task, result);
    ExpressionEvaluationContext params = new ExpressionEvaluationContext(null, expressionVariables, shortDesc, task, result);

    PrismValueDeltaSetTriple<PrismPropertyValue<T>> exprResult = ModelExpressionThreadLocalHolder.evaluateExpressionInContext(expression, params, task, result);

    List<T> retval = new ArrayList<>();
    for (PrismPropertyValue<T> item : exprResult.getZeroSet()) {
        retval.add(item.getValue());
    }
    return retval;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:AccCertExpressionHelper.java

示例4: marshallBeanToPrimitive

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
/**
 * For cases when XSD complex type has a simple content. In that case the resulting class has @XmlValue annotation. 
 */
private <T> PrimitiveXNode<T> marshallBeanToPrimitive(Object bean, SerializationContext ctx, Field valueField) throws SchemaException {
	if (!valueField.isAccessible()) {
		valueField.setAccessible(true);
	}
	T value;
	try {
		value = (T) valueField.get(bean);
	} catch (IllegalArgumentException | IllegalAccessException e) {
		throw new SchemaException("Cannot get primitive value from field " + valueField.getName() + " of bean " + bean + ": "+e.getMessage(), e);
	}
	PrimitiveXNode<T> xnode = new PrimitiveXNode<>(value);
	Class<?> fieldType = valueField.getType();
	QName xsdType = XsdTypeMapper.toXsdType(fieldType);
	xnode.setTypeQName(xsdType);
	return xnode;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:BeanMarshaller.java

示例5: marshalProtectedDataType

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
public <T> MapXNode marshalProtectedDataType(Object o, SerializationContext sc) throws SchemaException {
ProtectedDataType<T> protectedType = (ProtectedDataType<T>) o;
      MapXNode xmap = new MapXNode();
      if (protectedType.getEncryptedDataType() != null) {
          EncryptedDataType encryptedDataType = protectedType.getEncryptedDataType();
          MapXNode xEncryptedDataType = (MapXNode) marshall(encryptedDataType);
          xmap.put(ProtectedDataType.F_ENCRYPTED_DATA, xEncryptedDataType);
      } else if (protectedType.getHashedDataType() != null) {
          HashedDataType hashedDataType = protectedType.getHashedDataType();
          MapXNode xHashedDataType = (MapXNode) marshall(hashedDataType);
          xmap.put(ProtectedDataType.F_HASHED_DATA, xHashedDataType);
      } else if (protectedType.getClearValue() != null){
          QName type = XsdTypeMapper.toXsdType(protectedType.getClearValue().getClass());
          PrimitiveXNode xClearValue = createPrimitiveXNode(protectedType.getClearValue(), type);
          xmap.put(ProtectedDataType.F_CLEAR_VALUE, xClearValue);
      }
      // TODO: clearValue
      return xmap;
  }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:BeanMarshaller.java

示例6: 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());
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:DomToSchemaProcessor.java

示例7: applyFormDefinition

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
private void applyFormDefinition(ItemWrapper itemWrapper, AbstractFormItemType formField) {

		FormItemDisplayType displayType = formField.getDisplay();

		if (displayType == null) {
			return;
		}

		ItemDefinitionImpl itemDef = (ItemDefinitionImpl) itemWrapper.getItemDefinition();
		if (StringUtils.isNotEmpty(displayType.getLabel())) {
			itemDef.setDisplayName(displayType.getLabel());
		}

		if (StringUtils.isNotEmpty(displayType.getHelp())) {
			itemDef.setHelp(displayType.getHelp());
		}

		if (StringUtils.isNotEmpty(displayType.getMaxOccurs())) {
			itemDef.setMaxOccurs(XsdTypeMapper.multiplicityToInteger(displayType.getMaxOccurs()));
		}

		if (StringUtils.isNotEmpty(displayType.getMinOccurs())) {
			itemDef.setMinOccurs(XsdTypeMapper.multiplicityToInteger(displayType.getMinOccurs()));
		}

	}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:27,代码来源:DynamicFieldGroupPanel.java

示例8: 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");
	}
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:26,代码来源:VariablesUtil.java

示例9: evaluateExpression

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
private <T> List<T> evaluateExpression(Class<T> resultClass, ExpressionType expressionType, ExpressionVariables expressionVariables,
        String shortDesc, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {

    QName xsdType = XsdTypeMapper.toXsdType(resultClass);

    QName resultName = new QName(SchemaConstants.NS_C, "result");
    PrismPropertyDefinition<T> resultDef = new PrismPropertyDefinitionImpl<>(resultName, xsdType, prismContext);

    Expression<PrismPropertyValue<T>,PrismPropertyDefinition<T>> expression = expressionFactory.makeExpression(expressionType, resultDef, shortDesc, task, result);
    ExpressionEvaluationContext params = new ExpressionEvaluationContext(null, expressionVariables, shortDesc, task, result);

    PrismValueDeltaSetTriple<PrismPropertyValue<T>> exprResult = ModelExpressionThreadLocalHolder.evaluateExpressionInContext(expression, params, task, result);

    List<T> retval = new ArrayList<>();
    for (PrismPropertyValue<T> item : exprResult.getZeroSet()) {
        retval.add(item.getValue());
    }
    return retval;
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:20,代码来源:AccCertExpressionHelper.java

示例10: marshallBeanToPrimitive

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
/**
 * For cases when XSD complex type has a simple content. In that case the resulting class has @XmlValue annotation.
 */
private <T> PrimitiveXNode<T> marshallBeanToPrimitive(Object bean, SerializationContext ctx, Field valueField) throws SchemaException {
	if (!valueField.isAccessible()) {
		valueField.setAccessible(true);
	}
	T value;
	try {
		value = (T) valueField.get(bean);
	} catch (IllegalArgumentException | IllegalAccessException e) {
		throw new SchemaException("Cannot get primitive value from field " + valueField.getName() + " of bean " + bean + ": "+e.getMessage(), e);
	}
	PrimitiveXNode<T> xnode = new PrimitiveXNode<>(value);
	Class<?> fieldType = valueField.getType();
	QName xsdType = XsdTypeMapper.toXsdType(fieldType);
	xnode.setTypeQName(xsdType);
	return xnode;
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:20,代码来源:BeanMarshaller.java

示例11: icfTypeToXsdType

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
public static QName icfTypeToXsdType(Class<?> type, boolean isConfidential) {
		// For arrays we are only interested in the component type
		if (isMultivaluedType(type)) {
			type = type.getComponentType();
		}
		QName propXsdType = null;
		if (GuardedString.class.equals(type) || 
				(String.class.equals(type) && isConfidential)) {
			// GuardedString is a special case. It is a ICF-specific
			// type
			// implementing Potemkin-like security. Use a temporary
			// "nonsense" type for now, so this will fail in tests and
			// will be fixed later
//			propXsdType = SchemaConstants.T_PROTECTED_STRING_TYPE;
			propXsdType = ProtectedStringType.COMPLEX_TYPE;
		} else if (GuardedByteArray.class.equals(type) || 
				(Byte.class.equals(type) && isConfidential)) {
			// GuardedString is a special case. It is a ICF-specific
			// type
			// implementing Potemkin-like security. Use a temporary
			// "nonsense" type for now, so this will fail in tests and
			// will be fixed later
//			propXsdType = SchemaConstants.T_PROTECTED_BYTE_ARRAY_TYPE;
			propXsdType = ProtectedByteArrayType.COMPLEX_TYPE;
		} else {
			propXsdType = XsdTypeMapper.toXsdType(type);
		}
		return propXsdType;
	}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:30,代码来源:ConnIdUtil.java

示例12: createTokenProperty

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
private <T> PrismProperty<T> createTokenProperty(T object) {
	QName type = XsdTypeMapper.toXsdType(object.getClass());

	Set<PrismPropertyValue<T>> syncTokenValues = new HashSet<PrismPropertyValue<T>>();
	syncTokenValues.add(new PrismPropertyValue<T>(object));
	PrismPropertyDefinitionImpl propDef = new PrismPropertyDefinitionImpl(SchemaConstants.SYNC_TOKEN,
			type, prismContext);
	propDef.setDynamic(true);
	propDef.setMaxOccurs(1);
	PrismProperty<T> property = propDef.instantiate();
	property.addValues(syncTokenValues);
	return property;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:14,代码来源:ConnectorInstanceConnIdImpl.java

示例13: 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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:11,代码来源:ObjectValuePolicyEvaluator.java

示例14: unmarshallPrimitive

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
/**
 * For cases when XSD complex type has a simple content. In that case the resulting class has @XmlValue annotation.
 */
private <T> T unmarshallPrimitive(PrimitiveXNode<T> prim, Class<T> beanClass, ParsingContext pc) throws SchemaException {
	if (prim.isEmpty()) {
		return instantiate(beanClass);		// Special case. Just return empty object
	} 
	
	Field valueField = XNodeProcessorUtil.findXmlValueField(beanClass);
	
	if (valueField == null) {
		throw new SchemaException("Cannot convert primitive value to bean of type " + beanClass);
	}
	
	T instance = instantiate(beanClass);
	
	if (!valueField.isAccessible()) {
		valueField.setAccessible(true);
	}
	
	T value;
	if (prim.isParsed()) {
		value = prim.getValue();	
	} else {
		Class<?> fieldType = valueField.getType();
		QName xsdType = XsdTypeMapper.toXsdType(fieldType);
		value = prim.getParsedValue(xsdType, (Class<T>) fieldType);
	}
	
	try {
		valueField.set(instance, value);
	} catch (IllegalArgumentException | IllegalAccessException e) {
		throw new SchemaException("Cannot set primitive value to field " + valueField.getName() + " of bean " + beanClass + ": "+e.getMessage(), e);
	}
	
	return instance;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:38,代码来源:BeanUnmarshaller.java

示例15: locateItemDefinition

import com.evolveum.midpoint.prism.xml.XsdTypeMapper; //导入依赖的package包/类
private <T extends Containerable> ItemDefinition locateItemDefinition(
			PrismContainerDefinition<T> containerDefinition, QName elementQName, Object valueElements)
			throws SchemaException {
		ItemDefinition def = containerDefinition.findItemDefinition(elementQName);
		if (def != null) {
			return def;
		}

		if (valueElements instanceof Element) {
			// Try to locate xsi:type definition in the element
			def = resolveDynamicItemDefinition(containerDefinition, elementQName, (Element) valueElements,
					prismContext);
		} 
		
		if (valueElements instanceof List){
			List elements = (List) valueElements;
			if (elements.size() == 1){
				Object element = elements.get(0);
				if (element instanceof JAXBElement){
					Object val = ((JAXBElement) element).getValue();
					if (val.getClass().isPrimitive()){
						QName typeName = XsdTypeMapper.toXsdType(val.getClass());
						PrismPropertyDefinitionImpl propDef = new PrismPropertyDefinitionImpl(elementQName, typeName, prismContext);
//						propDef.setMaxOccurs(maxOccurs);
						propDef.setDynamic(true);
						return propDef;
					}
				}
			}
		}
		if (def != null) {
			return def;
		}

		if (containerDefinition.isRuntimeSchema()) {
			// Try to locate global definition in any of the schemas
			def = resolveGlobalItemDefinition(containerDefinition, elementQName);
		}
		return def;
	}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:41,代码来源:JaxbDomHack.java


注:本文中的com.evolveum.midpoint.prism.xml.XsdTypeMapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。