本文整理汇总了Java中com.liferay.portal.kernel.xml.Element.attribute方法的典型用法代码示例。如果您正苦于以下问题:Java Element.attribute方法的具体用法?Java Element.attribute怎么用?Java Element.attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.xml.Element
的用法示例。
在下文中一共展示了Element.attribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isJournalStructureXSD
import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
protected boolean isJournalStructureXSD(String xsd) throws Exception {
Document document = SAXReaderUtil.read(xsd);
Element rootElement = document.getRootElement();
Attribute availableLocalesAttribute = rootElement.attribute(
"available-locales");
if (availableLocalesAttribute == null) {
return true;
}
return false;
}
示例2: getLearningActivities
import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static Map<Long, Long> getLearningActivities(
LearningActivity learningActivity) throws DocumentException, SystemException {
Map<Long,Long> activities= new HashMap<Long,Long>();
if((learningActivity.getExtracontent()!=null)&&(learningActivity.getExtracontent().length()!=0)) {
Element activitiesElement = SAXReaderUtil.read(learningActivity.getExtracontent()).getRootElement().element("activities");
if(activitiesElement!=null){
Iterator<Element> activitiesElementItr = activitiesElement.elementIterator();
while(activitiesElementItr.hasNext()) {
Element activity =activitiesElementItr.next();
if(("activity".equals(activity.getName()))&&(activity.attribute("id")!=null)&&(activity.attribute("id").getValue().length()!=0)){
try{
activities.put(Long.valueOf(activity.attribute("id").getValue()),Long.valueOf(activity.getText()));
}
catch(NumberFormatException e){
e.printStackTrace();
}
}
}
}
List<Long> actIdsInDatabase =
LearningActivityLocalServiceUtil.dynamicQuery(
DynamicQueryFactoryUtil.forClass(LearningActivity.class)
.add(PropertyFactoryUtil.forName("typeId").ne(8))
.add(PropertyFactoryUtil.forName("actId").in((Collection<Object>)(Collection<?>)activities.keySet()))
.setProjection(ProjectionFactoryUtil.property("actId")));
Iterator<Map.Entry<Long,Long>> activitiesIterator = activities.entrySet().iterator();
while (activitiesIterator.hasNext()) {
if(!actIdsInDatabase.contains(activitiesIterator.next().getKey())){
activitiesIterator.remove();
}
}
}
return activities;
}