Building a WCM

Page 336

DocumentIdIterator draftIt = workspace.findByName(DocumentTypes.WorkflowStage,"Draft"); DocumentId draftSt = null; if (draftIt.hasNext()){ draftSt = (DocumentId) draftIt.next(); } if (draftIt!=null) { // Get all the content in this stage DocumentId[] arraySt=new DocumentId[1]; arraySt[0]=draftSt; String[] arrayUsers=new String[1]; arrayUsers[0]=request.getUserPrincipal().getName(); DocumentIdIterator drafts = workspace.findContentByWorkflowStage(arraySt,arrayUsers,Workspace.ROLE_ AUTHOR); boolean found=false; while (drafts.hasNext()) { found=true; DocumentId draft = (DocumentId) drafts.next(); out.println("<tr>"); out.println("<td>" + draft.getName() + "</td><td><a href='?wcmAuthoringAction=read&docid=com.ibm.workplace.wcm.api.WCM_Cont ent/" + draft.getId() + "'>Open</a></td>"); out.println("<td><a href='?wcmAuthoringAction=edit&docid=com.ibm.workplace.wcm.api.WCM_Cont ent/" + draft.getId() + "'>Edit</a></td>"); out.println("<td><a href='?wcmAuthoringAction=approve&docid=com.ibm.workplace.wcm.api.WCM_C ontent/" + draft.getId() + "'>Approve</a></td>"); out.println("</tr>"); } if (!found) { out.println("There are no drafts currently available"); } } %> </table> </div>

Section 4: Content pending for approval The Content pending for approval section is built in the same way as Section 3. An additional workflow stage (approval) is added to the search query, and the content is filtered by using ROLE_APPROVER. <h4><a href="javascript:display('approval')">View Content Requiring My Approval</a></h4> <div id="approval" style="display:block"> <table > <% // Get approval workflow stage DocumentIdIterator approvalIt = workspace.findByName(DocumentTypes.WorkflowStage,"Approval"); DocumentId approvalSt=null; if (approvalIt.hasNext()){ approvalSt = (DocumentId) approvalIt.next(); } if (draftSt!=null && approvalSt!=null){ // Get all the content in this stage

- 336 –


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.