delete node
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2011 11:24 AM
I have a node called node1
I want to delete this node using a java code
i try to use node1.remove() but it doesn't work
does someone Know how to do that with a simple java code? and what are importations that I should do.
Thanks
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2011 07:05 AM
Something like this using web services:
CMLDelete deleteInstruction = new CMLDelete();deleteInstruction.setWhere( new Predicate( referencesToDelete, myStore, null ) );CML executor = new CML();executor.setDelete( new CMLDelete[]{ deleteInstruction } );UpdateResult[] result = WebServiceFactory.getRepositoryService().update(executor);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2011 10:09 AM
how can I delete it using the CML method or other mehod
i think I must show the code
it 's of the alfresco-search portlet of lifeary that I want to adapt it to delete the node after having search it
<%/** * Copyright (C) 2010 John Baskeyfield, john.baskeyfield@gmail.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */%><%@ include file="init.jsp" %><% Log logger = LogFactory.getLog("alfrescosearch"); PortletPreferences preferences = renderRequest.getPreferences(); String endPoint = preferences.getValue("endPoint", new String()); String user = preferences.getValue("user", new String()); String password = preferences.getValue("password", new String()); String keywords = request.getParameter("keywords"); int results = Integer.parseInt(preferences.getValue("results", new String())); PortletURL portletURL = renderResponse.createRenderURL();%><form action="<%=portletURL%>" method="POST"> <input type="text" name="keywords" value="<%if(keywords != null) out.println(keywords); %>"/> <input type="submit" value="Search" /></form><br><% if (keywords != null){ try{ WebServiceFactory.setEndpointAddress(endPoint+"/api"); AuthenticationUtils.startSession(user, password); Reference parentReference = null; RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService(); Query query = new Query("lucene", "ALL:'" + keywords + "'"); Store storeRef = new Store("workspace", "SpacesStore"); Node [] nodes = null; nodes = WebServiceFactory.getRepositoryService().get(new Predicate(null,storeRef,query)); int pageIndex = 0; int resultIndex = 0; int pageResults = 0; int iterations = 0; String name = null; String uuid = null; String description = null; if (request.getParameter("position") == null ){ pageIndex = 0;} else { pageIndex = Integer.parseInt(request.getParameter("position"));} if (nodes != null){ NamedValue[] props = null;%><table width="100%" class="lfr-table"> <tbody> <tr> <td width="70%" valign="top"> <div style="padding-bottom: 5px;"> <b>Alfresco</b> </div> <div class="results-grid"> <table class="taglib-search-iterator"> <tbody> <tr class="portlet-section-header results-header"> <th width="18px" class="col-1"> # </th> <th class="col-2"> Name </th> <th class="col-3"> Description </th> </tr> <tr class="lfr-template portlet-section-body results-row"> <td width="18px"></td> <td></td> <td></td> </tr><% if (nodes.length - (pageIndex * results) > results){iterations = (pageIndex * results)+results;}else{iterations=nodes.length;} for (int x = pageIndex * results; x < iterations; x++) { props=nodes[x].getProperties(); pageResults++; for(int y = 0; y < props.length; y++) { if(props[y].getName().endsWith("{http://www.alfresco.org/model/content/1.0}name") == true) { name=props[y].getValue(); } if(props[y].getName().endsWith("{http://www.alfresco.org/model/content/1.0}description") == true) { description=props[y].getValue(); } if(props[y].getName().endsWith("{http://www.alfresco.org/model/system/1.0}node-uuid") == true) { uuid=props[y].getValue(); } } if((x-(pageIndex * results))%2 == 0) {%> <tr height="22px" onmouseout="this.className = 'portlet-section-body results-row';" onmouseover="this.className = 'portlet-section-body-hover results-row hover';" class="portlet-section-body results-row"><%}else{%> <tr height="22px" onmouseout="this.className = 'portlet-section-alternate results-row alt';" onmouseover="this.className = 'portlet-section-alternate-hover results-row alt hover';" class="portlet-section-alternate results-row alt"><%}%> <td width="18px" align="left" valign="middle" colspan="1" class="col-1"> <%=resultIndex+1+(pageIndex*results)%>. </td> <td align="left" valign="middle" colspan="1" class="col-2"> <a target="_blank" href="<%=endPoint%>/d/a/workspace/SpacesStore/<%=uuid%>/<%=name%>"><%=name%></a> </td> <td align="left" valign="middle" colspan="1" class="col-3"> <%if(description!=null) out.println(description); %> </td> </tr><% resultIndex++; }%> </tbody> </table> </div> <div class="taglib-search-iterator-page-iterator-bottom"> <div class="taglib-page-iterator"> <div class="search-results"> <%if(nodes.length <= results){%> <%=pageResults%> results.<p> </p> <%}else{%> Results <%=(pageIndex * results)+1%> - <%=(resultIndex+(pageIndex * results))%> of <%=nodes.length%>. <%}%> </div> </div> </div> </td> </tr> </tbody></table><% PortletURL portletURLpage = renderResponse.createRenderURL(); portletURLpage.setParameter("keywords", keywords); if(nodes.length > results){ for (int x = 0; x < Math.ceil( (double)nodes.length / (double)results ); x++){%> <a href="<%=portletURLpage%>&position=<%=x%>"><%=x+1%></a><% if(x != (Math.ceil( (double)nodes.length / (double)results ))-1){out.println(" ,");} }%><p> </p><% } }else{%> <p>No results found.</p><% } }catch(AuthenticationFault af){ out.println("<p>Invalid User/Password for Alfresco. Please set preferences.</p>"); }catch(WebServiceException wse){ out.println("<p>Unable to connect to Alfresco url. Please set preferences.</p>"); }catch(Exception ex){ logger.error(ex.getMessage()); } finally { // End the session AuthenticationUtils.endSession(); }}%>
can I do that? because i want to delete node using liferay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2011 01:51 AM
This is the only way I know to delete a node.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2011 06:35 AM
thanks, I used the CML delete and it works rigth
now I want to delete from a specific folder
I want o delete for exemple from the Sites folder which is ander the company home
I replace Query query = new Query("lucene", "TEXT:' "+keywords+"'");
with Query query = new Query("lucene", "PATH:\"/app:company_home/
cm

but it doesn't work
what's wrong in my query?
please help me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2011 06:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2011 03:20 AM
but I want ,if that possible a concrete code that helps me.
Does any one have an idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2011 05:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2011 05:22 AM
I have already found the mistake
there is what Ichanged in my query
Query query = new Query("lucene", "PATH:\"/app:company_home/
st


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2011 09:13 AM
