本文整理汇总了Java中com.evolveum.midpoint.util.DOMUtil.createElement方法的典型用法代码示例。如果您正苦于以下问题:Java DOMUtil.createElement方法的具体用法?Java DOMUtil.createElement怎么用?Java DOMUtil.createElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.evolveum.midpoint.util.DOMUtil
的用法示例。
在下文中一共展示了DOMUtil.createElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testExtensionPolyString
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionPolyString() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "polyType");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Element poly = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
Element orig = DOMUtil.createElement(poly.getOwnerDocument(), new QName(NS_T, "orig"));
orig.setTextContent("Foo_Bar");
Element norm = DOMUtil.createElement(poly.getOwnerDocument(), new QName(NS_T, "norm"));
norm.setTextContent("foo bar");
poly.appendChild(orig);
poly.appendChild(norm);
Object realValue = RAnyConverter.getRealRepoValue(def, poly);
AssertJUnit.assertEquals(new PolyString("Foo_Bar", "foo bar"), realValue);
session.close();
}
示例2: testExtensionInteger
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionInteger() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "intType");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
value.setTextContent("123");
Object realValue = RAnyConverter.getRealRepoValue(def, value);
AssertJUnit.assertEquals(123L, realValue);
session.close();
}
示例3: testExtensionLong
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionLong() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "longType");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
value.setTextContent("123");
Object realValue = RAnyConverter.getRealRepoValue(def, value);
AssertJUnit.assertEquals(123L, realValue);
session.close();
}
示例4: testExtensionShort
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionShort() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "shortType");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
value.setTextContent("123");
Object realValue = RAnyConverter.getRealRepoValue(def, value);
AssertJUnit.assertEquals(123L, realValue);
session.close();
}
示例5: testExtensionDouble
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionDouble() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "doubleType");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
value.setTextContent("123.1");
Object realValue = RAnyConverter.getRealRepoValue(def, value);
AssertJUnit.assertEquals("123.1", realValue);
session.close();
}
示例6: testExtensionFloat
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionFloat() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "floatType");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
value.setTextContent("123.1");
Object realValue = RAnyConverter.getRealRepoValue(def, value);
AssertJUnit.assertEquals("123.1", realValue);
session.close();
}
示例7: testExtensionString
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionString() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "floatType");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
value.setTextContent("example");
Object realValue = RAnyConverter.getRealRepoValue(def, value);
AssertJUnit.assertEquals("example", realValue);
session.close();
}
示例8: testExtensionDecimal
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionDecimal() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "decimalType");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
value.setTextContent("1234");
Object realValue = RAnyConverter.getRealRepoValue(def, value);
AssertJUnit.assertEquals("1234", realValue);
session.close();
}
示例9: testUserFullnamePolyString
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testUserFullnamePolyString() throws Exception {
Session session = getFactory().openSession();
ItemDefinition def = getDefinition(UserType.class, UserType.F_FULL_NAME);
AssertJUnit.assertNotNull("Definition not found for " + UserType.F_FULL_NAME, def);
Element value = DOMUtil.createElement(DOMUtil.getDocument(), UserType.F_FULL_NAME);
Element orig = DOMUtil.createElement(value.getOwnerDocument(), new QName(NS_T, "orig"));
orig.setTextContent("john example");
Element norm = DOMUtil.createElement(value.getOwnerDocument(), new QName(NS_T, "norm"));
norm.setTextContent("john example");
value.appendChild(orig);
value.appendChild(norm);
Object realValue = RAnyConverter.getRealRepoValue(def, value);
AssertJUnit.assertEquals(new PolyString("john example", "john example"), realValue);
session.close();
}
示例10: testExtensionClob
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionClob() throws Exception {
Session session = getFactory().openSession();
QName valueName = new QName(NS_P, "locations");
ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
AssertJUnit.assertNotNull(def);
Document document = DOMUtil.getDocument();
Element value = DOMUtil.createElement(document, valueName);
Element location = DOMUtil.createElement(document, new QName(NS_P, "location"));
value.appendChild(location);
location.setAttribute("key", "heaven");
location.setTextContent("somewhere above");
Object realValue = RAnyConverter.getRealRepoValue(def, value);
//asserting simple dom
document = DOMUtil.parseDocument((String) realValue);
Element root = document.getDocumentElement();
AssertJUnit.assertNotNull(root);
AssertJUnit.assertEquals("locations", root.getLocalName());
AssertJUnit.assertEquals(NS_P, root.getNamespaceURI());
AssertJUnit.assertEquals(1, DOMUtil.listChildElements(root).size());
location = DOMUtil.listChildElements(root).get(0);
AssertJUnit.assertNotNull(location);
AssertJUnit.assertEquals("location", location.getLocalName());
AssertJUnit.assertEquals(NS_P, location.getNamespaceURI());
AssertJUnit.assertEquals(0, DOMUtil.listChildElements(location).size());
AssertJUnit.assertEquals("heaven", location.getAttribute("key"));
AssertJUnit.assertEquals("somewhere above", location.getTextContent());
session.close();
}
示例11: createAttributeValue
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
private Element createAttributeValue(QName valueName, String xsdType, String textContent) {
Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
value.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsd", XMLConstants.W3C_XML_SCHEMA_NS_URI);
value.setAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type", xsdType);
value.setTextContent(textContent);
return value;
}
示例12: createExtensionPath
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
private Element createExtensionPath() {
Document document = DOMUtil.getDocument();
Element extension = DOMUtil.createElement(document, DeltaConvertor.PATH_ELEMENT_NAME);
extension.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:c", SchemaConstantsGenerated.NS_COMMON);
extension.setTextContent("c:extension");
return extension;
}
示例13: createElement
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
/**
* Create XML element with the correct namespace prefix and namespace definition.
* @param qname element QName
* @return created DOM element
*/
@NotNull
private Element createElement(QName qname, Element parentElement) {
String namespaceURI = qname.getNamespaceURI();
if (!StringUtils.isBlank(namespaceURI)) {
qname = setQNamePrefix(qname);
}
if (parentElement != null) {
return DOMUtil.createElement(doc, qname, parentElement, parentElement);
} else {
// This is needed otherwise the root element itself could not be created
// Caller of this method is responsible for setting the topElement
return DOMUtil.createElement(doc, qname);
}
}
示例14: createElement
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
/**
* Create XML element with the correct namespace prefix and namespace definition.
* @param qname element QName
* @return created DOM element
*/
public Element createElement(QName qname) {
QName qnameWithPrefix = namespacePrefixMapper.setQNamePrefix(qname);
addToImport(qname.getNamespaceURI());
if (rootXsdElement!=null) {
return DOMUtil.createElement(document, qnameWithPrefix, rootXsdElement, rootXsdElement);
} else {
// This is needed otherwise the root element itself could not be created
return DOMUtil.createElement(document, qnameWithPrefix);
}
}
示例15: createFakeParentElement
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
public static Element createFakeParentElement() {
return DOMUtil.createElement(DOMUtil.getDocument(), CUSTOM_OBJECT);
}