本文整理汇总了Java中com.liferay.portal.kernel.xml.Element.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Element.remove方法的具体用法?Java Element.remove怎么用?Java Element.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.xml.Element
的用法示例。
在下文中一共展示了Element.remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setExtraContent
import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
@Override
public String setExtraContent(UploadRequest uploadRequest,
PortletResponse portletResponse, LearningActivity learningActivity)
throws NumberFormatException, Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) uploadRequest.getAttribute(WebKeys.THEME_DISPLAY);
String team = ParamUtil.getString(uploadRequest, "team","0");
long teamId = 0;
if(!team.equalsIgnoreCase("0")){
teamId = Long.parseLong(team);
}
Document document = null;
Element rootElement = null;
if((learningActivity.getExtracontent()==null)||(learningActivity.getExtracontent().trim().length()==0)){
document = SAXReaderUtil.createDocument();
rootElement = document.addElement("survey");
}
else
{
document=SAXReaderUtil.read(learningActivity.getExtracontent());
rootElement =document.getRootElement();
}
Element teamElement=rootElement.element("team");
if(teamElement!=null)
{
teamElement.detach();
rootElement.remove(teamElement);
}
if(teamId!=0){
teamElement = SAXReaderUtil.createElement("team");
teamElement.setText(Long.toString(teamId));
rootElement.add(teamElement);
}
learningActivity.setExtracontent(document.formattedString());
return null;
}
示例2: setExtraContent
import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
@Override
public String setExtraContent(UploadRequest uploadRequest,
PortletResponse portletResponse, LearningActivity learningActivity)
throws NumberFormatException, Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) uploadRequest.getAttribute(WebKeys.THEME_DISPLAY);
String team = ParamUtil.getString(uploadRequest, "team","0");
long teamId = 0;
if(!team.equalsIgnoreCase("0")){
teamId = Long.parseLong(team);
}
Document document = null;
Element rootElement = null;
if((learningActivity.getExtracontent()==null)||(learningActivity.getExtracontent().trim().length()==0)){
document = SAXReaderUtil.createDocument();
rootElement = document.addElement("offline");
}
else
{
document=SAXReaderUtil.read(learningActivity.getExtracontent());
rootElement =document.getRootElement();
}
Element teamElement=rootElement.element("team");
if(teamElement!=null)
{
teamElement.detach();
rootElement.remove(teamElement);
}
if(teamId!=0){
teamElement = SAXReaderUtil.createElement("team");
teamElement.setText(Long.toString(teamId));
rootElement.add(teamElement);
}
learningActivity.setExtracontent(document.formattedString());
return null;
}
示例3: setExtraContent
import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
@Override
public String setExtraContent(UploadRequest uploadRequest,
PortletResponse portletResponse, LearningActivity learningActivity)
throws NumberFormatException, Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) uploadRequest.getAttribute(WebKeys.THEME_DISPLAY);
String fichero = ParamUtil.getString(uploadRequest, "fichero", StringPool.FALSE);
String textoenr = ParamUtil.getString(uploadRequest, "textoenr", StringPool.FALSE);
String team = ParamUtil.getString(uploadRequest, "team","0");
long teamId = 0;
if(!team.equalsIgnoreCase("0")){
teamId = Long.parseLong(team);
}
Document document = null;
Element rootElement = null;
if((learningActivity.getExtracontent()==null)||(learningActivity.getExtracontent().trim().length()==0)){
document = SAXReaderUtil.createDocument();
rootElement = document.addElement("online");
}
else
{
document=SAXReaderUtil.read(learningActivity.getExtracontent());
rootElement =document.getRootElement();
}
Element ficheroXML=rootElement.element("fichero");
if(ficheroXML!=null)
{
ficheroXML.detach();
rootElement.remove(ficheroXML);
}
ficheroXML=SAXReaderUtil.createElement("fichero");
ficheroXML.addText(fichero);
rootElement.add(ficheroXML);
Element textoenrXML=rootElement.element("textoenr");
if(textoenrXML!=null)
{
textoenrXML.detach();
rootElement.remove(textoenrXML);
}
textoenrXML=SAXReaderUtil.createElement("textoenr");
textoenrXML.addText(textoenr);
rootElement.add(textoenrXML);
Element teamElement=rootElement.element("team");
if(teamElement!=null)
{
teamElement.detach();
rootElement.remove(teamElement);
}
if(teamId!=0){
teamElement = SAXReaderUtil.createElement("team");
teamElement.setText(Long.toString(teamId));
rootElement.add(teamElement);
}
learningActivity.setExtracontent(document.formattedString());
return null;
}
示例4: addfiles
import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
public void addfiles(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
UploadPortletRequest request = PortalUtil.getUploadPortletRequest(actionRequest);
String jspPage = ParamUtil.getString(actionRequest, "jspPage");
long actId = ParamUtil.getLong(actionRequest, "resId", 0);
String description = request.getParameter("description");
String youtubecode=ParamUtil.getString(request,"youtubecode","");
boolean videoControlEnabled=ParamUtil.getBoolean(request,"videoControl");
LearningActivity larn = LearningActivityServiceUtil.getLearningActivity(actId);
String extraContent=larn.getExtracontent();
Document document = SAXReaderUtil.createDocument();
Element rootElement = document.addElement("multimediaentry");
if(extraContent!=null &&!"".equals(extraContent)&&!Validator.isNumber(extraContent))
{
document=SAXReaderUtil.read(extraContent);
rootElement =document.getRootElement();
}
if(!"".equals(youtubecode))
{
Element video=rootElement.element("video");
if(video!=null)
{
video.detach();
rootElement.remove(video);
}
video = SAXReaderUtil.createElement("video");
video.setText(youtubecode);
rootElement.add(video);
}
Element videoControl=rootElement.element("video-control");
if(videoControl!=null)
{
videoControl.detach();
rootElement.remove(videoControl);
}
videoControl = SAXReaderUtil.createElement("video-control");
videoControl.setText(String.valueOf(videoControlEnabled));
rootElement.add(videoControl);
larn.setExtracontent(document.formattedString());
larn.setDescription( description,themeDisplay.getLocale());
//LearningActivityServiceUtil.modLearningActivity(larn, serviceContext);
LearningActivityServiceUtil.modLearningActivity(larn);
//auditing
AuditingLogFactory.audit(larn.getCompanyId(), larn.getGroupId(), LearningActivity.class.getName(), larn.getPrimaryKey(), themeDisplay.getUserId(), AuditConstants.UPDATE, null);
SessionMessages.add(actionRequest, "activity-saved-successfully");
actionResponse.setRenderParameter("jspPage", jspPage);
actionResponse.setRenderParameter("actionEditingDetails", "true");
actionResponse.setRenderParameter("resId", Long.toString(actId));
}
示例5: importExtraContent
import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
@Override
public String importExtraContent(LearningActivity newLarn, Long userId, PortletDataContext context, ServiceContext serviceContext, Element actElement) throws PortalException, IOException,
DocumentException, SystemException {
log.debug("extracontent: " + newLarn.getExtracontent());
Document document = SAXReaderUtil.read(newLarn.getExtracontent());
Element rootElement = document.getRootElement();
for(Element key:rootElement.elements()){
if(key.getName().contains("firedDate") || key.getName().contains("publishDate")){
rootElement.remove(key);
}
}
String extraContent = document.formattedString();
log.debug("extracontent changed: " + extraContent);
newLarn.setExtracontent(extraContent);
LearningActivityLocalServiceUtil.updateLearningActivity(newLarn);
return extraContent;
}