1 Reply Latest reply: Jun 3, 2014 7:28 AM by AnilA RSS

    Add attachments on requisition lines notification by flowlayout

    Lou

      Hi all,
      my requirement is to add a column in requisition lines notification to display one or more attachments link for each line or nothing is an attachment is not present for that line.

       

      In data model I have correctly attach1 linked to L1 and attach2 linked to L2 so what I want is this:

       

      L1  attach1

      L2  attach2

       

      But I currently have:

       

      L1  attach1 attch2

      L2  attach1 attch2

       

      I have tried to use the same logic for the attachment of the headers in notification workflow even if the information here on a single record and not for a multi record

       

      Then I created under region ReqLinesNotificationsRN in table ReqLinesTable a new item "reqlineattach" type "FlowLayout". This item is not associated to any viewobject item.

       

      In Process Request:

       

       


               OATableBean oatablebean = (OATableBean)oawebbean.findIndexedChildRecursive("ReqLinesTable");
               int i = 0;
               int j = xxReqLinesVO.getRowCount();

               // First seeking through the line of requisition attachments associated with it


               while(xxReqLinesVO.hasNext())
                   {
                    xxReqLinesVO.next();
                    Row row = xxReqLinesVO.getCurrentRow();
                    String xxReqLineId = row.getAttribute("RequisitionLineId").toString();
                    StringBuffer stringbuffer = new StringBuffer((new StringBuilder()).append(" pk1_value = :1 "));
                    xxReqLinesAttachVOx.setWhereClause(stringbuffer.toString());
                    xxReqLinesAttachVOx.setWhereClauseParams(null);
                    xxReqLinesAttachVOx.setWhereClauseParam(0,xxReqLineId);
                    xxReqLinesAttachVOx.executeQuery();

                       // If there are attachments begin a cycle             
                   
                       if(xxReqLinesAttachVOx.getRowCount() > 0)
                       {   
                           boolean flag1 = false;
                           int w = 0;
                           int z = xxReqLinesAttachVOx.getRowCount();
                           xxReqLinesAttachVOx.reset();
                          
                           while(xxReqLinesAttachVOx.hasNext())
                           {
                               xxReqLinesAttachVOx.next();
                              Row rowAttach = xxReqLinesAttachVOx.getRowAtRangeIndex(w);
                              String sDocumentId =  rowAttach.getAttribute(0).toString();
                              String sDataTypeId = (rowAttach.getAttribute(1)).toString();
                              String sMediaId = rowAttach.getAttribute(2).toString();;
                              String sTitle = ((String)rowAttach.getAttribute(3));
                              String sFilename = ((String)rowAttach.getAttribute(4));
                              String s2 = sTitle; 
                              
                               OAFlowLayoutBean oaflowlayoutbean = (OAFlowLayoutBean)oatablebean.findIndexedChildRecursive("ReqLineAttch");

                               OALinkBean oalinkbean = (OALinkBean)createWebBean(oapagecontext, "LINK_BEAN");
                              
                               int sCase = Integer.parseInt(sDataTypeId);

                               switch(sCase)
                               {
                               case 6: // '\006'
                                   if(s2 == null || "".equals(s2))
                                        s2 = sFilename;
                                        oalinkbean.setText(s2);
                                        break;

                                default:
                                   flag1 = true;
                                   break;
                               }


                               // Here I build a url to attachment fle

       

                               StringBuffer stringbuffer3 = new StringBuffer("OA.jsp?OAFunc=XXCUST_REQ_LIN_NTF_ATTACH_RN");
                               stringbuffer3.append((new StringBuilder()).append("&NtfId=").append(oapagecontext.getParameter("NtfId")).toString());
                               stringbuffer3.append("&ntfEvent=xxcustviewAttachment&retainAM=Y");
                               stringbuffer3.append((new StringBuilder()).append("&documentId=").append(sDocumentId));
                               stringbuffer3.append((new StringBuilder()).append("&mediaId=").append(sMediaId));
                               stringbuffer3.append((new StringBuilder()).append("&datatypeId=").append(sDataTypeId).toString());
                               String s4 = NtfUtil.getStateLessAccessParams(oapagecontext);

                               // Here I associate oalinkbean to flowlyotbean. His behavior leaves me to believe that the flowlayoutbean be seen

                               // at the table level and not a single table row !!!!

                                  
                               oalinkbean.setDestination(stringbuffer3.toString());
                               oaflowlayoutbean.addIndexedChild(oalinkbean);
                              
                              
                               if(w < z - 1)
                               {
                                   OARawTextBean oarawtextbean = (OARawTextBean)createWebBean(oapagecontext, "RAW_TEXT");
                                   oarawtextbean.setText(", ");
                                   oaflowlayoutbean.addIndexedChild(oarawtextbean);
                               }
                               w++;    // Next arrachment
                           }

                       }
               }
              i++; // Next line

       

      My questions are:

       

      1) can I associate a flowlayoutbean in a tablebean and set it with different values for each record of table ?

      2) how can I set this flowlayoutbean with oalinkbean for each record even if it has not an attribute in VO?

       

      Any help will be greatly appreciated.

      Lou