use of org.dom4j.Attribute in project pentaho-platform by pentaho.
the class BiPlatformRepositoryClientNavigationService method getLocalizedName.
private String getLocalizedName(Element element) {
// $NON-NLS-1$
String name = "";
// $NON-NLS-1$
Attribute attr = element.attribute("localized-name");
if (attr != null) {
name = attr.getText();
}
return name;
}
use of org.dom4j.Attribute in project tmdm-studio-se by Talend.
the class LocalTreeObjectRepository method addAttributeToCategoryElem.
private void addAttributeToCategoryElem(TreeParent category, String attrName, String defaultAttrValue) {
Element elem = locateCategoryElement(category);
Attribute attr = elem.attribute(attrName);
if (attr != null) {
elem.remove(attr);
}
elem.addAttribute(attrName, defaultAttrValue);
}
use of org.dom4j.Attribute in project tmdm-studio-se by Talend.
the class LocalTreeObjectRepository method doUpgrade.
private void doUpgrade(String url) {
Document doc = credentials.get(url).doc;
String path = // $NON-NLS-1$//$NON-NLS-2$
"//child::*[text() = '" + TreeObject.CATEGORY_FOLDER + "' and count(@Universe) = 0 and count(@Url) = 0" + // $NON-NLS-1$
"]";
List<Element> categorys = doc.selectNodes(path);
for (Element elem : categorys) {
Attribute attr = elem.attribute(URL);
if (attr == null) {
elem.addAttribute(URL, UnifyUrl(url));
}
}
saveDocument(url);
}
use of org.dom4j.Attribute in project free-framework by a601942905git.
the class Config method initTableConf.
/**
* 初始化配置的表格信息
* @param e
* @return
*/
private static TableConf initTableConf(Element e) {
TableConf table = new TableConf();
// 表对应的实体类名称
Attribute attr = XmlUtil.getAttribute(e, "entityName");
if (attr != null) {
table.setEntityName(attr.getValue());
}
// 表名称
Attribute name = XmlUtil.getAttribute(e, "name");
if (name != null) {
table.setName(name.getValue());
}
// 表前缀
Attribute prefix = XmlUtil.getAttribute(e, "prefix");
if (prefix != null) {
table.setPrefix(prefix.getValue());
}
// 如果是主从表,则从表需设置该属性,表示父表的关联属性
Attribute parentField = XmlUtil.getAttribute(e, "parentField");
if (parentField != null) {
table.setParentField(parentField.getValue());
}
// 表关联类型,分为OneToOne,OneToMany
Attribute refType = XmlUtil.getAttribute(e, "refType");
if (refType != null) {
table.setRefType(refType.getValue());
} else {
// 默认OneToMany
table.setRefType("OneToMany");
}
return table;
}
use of org.dom4j.Attribute in project OpenOLAT by OpenOLAT.
the class TextMarkerManagerImpl method loadTextMarkerList.
/**
* @see org.olat.core.gui.control.generic.textmarker.TextMarkerManager#loadTextMarkerList(org.olat.core.util.vfs.VFSLeaf)
*/
public List<TextMarker> loadTextMarkerList(VFSLeaf textMarkerFile) {
if (textMarkerFile == null) {
// filename not defined at all
return new ArrayList<TextMarker>();
}
XMLParser parser = new XMLParser();
InputStream stream = textMarkerFile.getInputStream();
if (stream == null) {
// e.g. file was removed
return new ArrayList<TextMarker>();
}
Document doc = parser.parse(stream, false);
Element root = doc.getRootElement();
if (root == null) {
// file was empty;
return new ArrayList<TextMarker>();
}
// Do version check. Not needed now, for future lazy migration code...
Attribute versionAttribute = root.attribute(XML_VERSION_ATTRIBUTE);
int version = (versionAttribute == null ? 1 : Integer.parseInt(versionAttribute.getStringValue()));
if (version != VERSION) {
// complain about version conflict or solve it
throw new OLATRuntimeException("Could not load glossary entries due to version conflict. Loaded version was::" + version, null);
}
// parse text marker objects and put them into a list
List markersElements = root.elements("textMarker");
List<TextMarker> markers = new ArrayList<TextMarker>();
Iterator iter = markersElements.iterator();
while (iter.hasNext()) {
Element textMarkerElement = (Element) iter.next();
TextMarker textMarker = new TextMarker(textMarkerElement);
markers.add(textMarker);
}
try {
stream.close();
} catch (IOException e) {
throw new OLATRuntimeException(this.getClass(), "Error while closing text marker file stream", e);
}
return markers;
}
Aggregations