Iterate through list

i have a list and i want to iterate through the list and get the names of the classes present in that..
i have the following code
Iterator it= list.iterator();
String value;
while(it.hasNext())
     Object obj= it.next();
     Class cls= obj.getClass();
     value = cls.getName();
now if i want to check whether a class called test is present in that list how to do that...pls help

mgv wrote:
i have a list and i want to iterate through the list and get the names of the classes present in that..
i have the following code
Iterator it= list.iterator();
String value;
while(it.hasNext())
     Object obj= it.next();
     Class cls= obj.getClass();
     value = cls.getName();
now if i want to check whether a class called test is present in that list how to do that...pls help
while(it.hasNext()){
Object obj = it.next();
if(obj instanceof test){
    //do something
}

Similar Messages

  • Iterate Through Lists Instead of Document Libraries, Or both

    System Info: SharePoint 2010 Enterprise w DEC 2013 CU. 2 WFEs (load balanced), App Server, SSRS Server, Dedicated CA Server (All running Win 2k8 R2).
    Background:I have a large (5,000 user) application that is completely customized on top of SP2010. I am the admin, and have been on the team for many years. Previously, we had a development team,
    but client has scaled costs back, and now its just me on the technical side. We have a Web app that houses multiple Site Collections, and each site collection has various subsites.
    My Problem: We have increased the LVT to 10k items (system has plenty of HP, although we do see performance degradation). Each subsite in the Site Collection holds data specific to an organization
    wtihin the Line of Business. There are two lists that frequently approach the 10k mark, and we have mitigation steps in place (essentially, we just create a new SubSite for them once they reach 10k). What I need is a single script that will traverse ALL subsites
    and return a count of their lists, perhaps I can work a couple of if statements in there to have specific data written to a SP List (if count is greater than 5000), and other wise everything gets written to the output file.
    I am trying to iterate through all lists and return a count of folders + items ... The script below works just fine, but it goes through Document Libraries only (per the baseType eq tag).
    I've tried changing baseType from DocumentLibrary to GenericList, but I continually get an error.
    I've also removed the where baseType = DocLib clause completely, and this has the desired results (all lists and doclibs are listed), except the 'WebUrl' field in the csv output is blank.
    Any thoughts on how I can make a small tweak to this script to get my desired results?
    Start-SPAssignment -Global
    $OutputFile ="D:\folder\DocCount3.csv"
    $results = @()
    $webApps = Get-SPWebApplication http://WebAppURL
    foreach($webApp in $webApps)
    foreach($siteColl in $webApp.Sites)
    foreach($web in $siteColl.AllWebs)
    $webUrl = $web.url
    $docLibs = $web.Lists | Where-Object {$_.baseType -eq "DocumentLibrary"}
    $docLibs | Add-Member -MemberType ScriptProperty -Name WebUrl -Value {$webUrl}
    $results += ($docLibs | Select-Object -Property WebUrl, Title, ItemCount)
    $results | Export-Csv -Path $OutputFile -NoTypeInformation
    Stop-SPAssignment –Global

    You guys won't believe this ... But, the script actually works as intended if I change the baseType tag to "GenericList"... I had been getting errors (about 14 of them) through PowerShell and
    assuming the script didn't process, but after looking at the output CSV, it seems that everything worked properly. I think the 14 errors MAY have been corrupted sites (or something?) as it gives me NullValueNotAllowed when trying to "Add-Member" and points
    to $WebUrl as being null.
    Next up -- working on getting this script to write specific objects to a SP list!

  • Iterate through List and return (the names) of all the classes

    Hi,
    I've got a List and want to see what kind of classes are in this List.
    List list = getList();
    Iterator it = list.iterator();
    while (it.hasNext()) {
         Object ob = it.next(); // get the next item. Is this the right approach for my problem?
            // Her I want to check the Object what classses it holds,
            // assuming that this is the right approach for my problem
    }Thanks
    Jonny

    Hi,
    that's what I did:
    List list = getList();
    Iterator it = list.iterator();
    while (it.hasNext()) {
         Object ob = it.next(); // get the next item. Is this the right approach for my problem?
             Class cLass = ob.getClass();
             System.out.println("\t" + cLass.getName());
    }This returned java.lang.Object as mentioned.
    Question:
    - Can an Object hold several types of classes? If so, how can I iterate them?
    Mabe this makes things a little clearer:
    Why am asking this? I'm returning a List from a (Hibernate)-query. I can access one Class without problems. Another class that should be returned, I can't access. Thats why I want to know what I'm dealing with.
    Thanks
    Jonny

  • Iterate through a list containing Map items using struts

    Hi friends,
    I have a small problem. I want to iterate through a list of items, using struts.
    The list actually contains map structres for example:
    list(0)
         map(..key..value..)
         map(..key..value..)
         map(..key..value..)
    list(1)
         map(..key..value..)
         map(..key..value..)
         map(..key..value..)
    list(2)
         map(..key..value..)
         map(..key..value..)
         map(..key..value..)can I use <logic:iterate/> for this? if yes how? Because I have used this tag for list containing bean objects not Map.
    Any suggestions are much appreciated.
    Thanks,
    Vishal

    Normally, each object exposed by the iterate tag is an element of the underlying collection you are iterating over. However, if you iterate over a Map, the exposed object is of type Map.Entry that has two properties:
    key - The key under which this item is stored in the underlying Map.
    value - The value that corresponds to this key.
    So, if you wish to iterate over the values of a Hashtable, you would implement code like the following:
    <logic:iterate id="element" name="myhashtable">
    Next element is <bean:write name="element" property="value"/>
    </logic:iterate>
    Best Regards
    Maruthi

  • Iterate through two lists

    Hello,
    I'm writing an application that generates two seperate sets of data from a database which are stored in two lists; list A & B. I need to cycle through one list (*B*) and remove data according to my search criteria. When I encounter data that I'm going to remove, it has to be done on list A as well.
    Is it at all possible to use one iterator to cycle through list B and modify A at the same time? If so, please explain.

    For those who are interested, here is the code I used to solve the problem. All the writers create an html booklet for easy interpretation. And yes, I did take into consideration the fact that removing an item from the list offsets the counter and will skip n+1. The use of while( cdList.contains( trimmedcdValue )) was introduced to handle such a case by continuing to delete duplicates (by grabbing their subscript) within the list.
              try{
                   statWriter=new BufferedWriter(new FileWriter("results/"+directory+"/FileStatistics.html"));
                   statWriter.write(this.buildHeader("File Statistics"));
                   statWriter.write("<table class='file-stats'><tr><th>File #</th><th>File name</th><th>Lines read</th><th>Total matches</th></tr>");
                   writer=new BufferedWriter(new FileWriter("./results/"+directory+"/MatchList.html"));               
                   writer.write(this.buildHeader("Matched References"));
                   writer.write("<table><tr><th>File Line</th><th>CD Reference</th><th>ATA Number</th><th>Log_Book</th><th>Description</th><th>File Found in</th></tr>");
                   //loop through all new files
                   for(int y=0; y<f.length; y++){
                             //update the progressbar information
                        this.updateProgress(f[y]);
                        //set file reader
                        reader=new BufferedReader(new FileReader("./id files/"+directory+"/"+f[y]));
                        int lineCount=0;     //keep track of lines read
                        int match=0;          //keep track of the matches
                        String line=null;
                        while((line=reader.readLine())!=null){
                             String trimmedLine=line.trim();          //remove leading/trailing whitespace
                             lineCount++;                              //increment line counter
                                  //cycle through list and check for matches
                             for(int x=0; x<cdList.size();x++){
                                  String cdValue=(String)cdList.get(x);               //current list subscript
                                       //remove leading/trailing whitespace
                                  String trimmedcdValue=cdValue.trim();                    
                                       //if matched; remove row from list
                                  if(trimmedLine.equalsIgnoreCase(trimmedcdValue)){     
                                            //while the value exists in the list; find & remove
                                       while(cdList.contains(trimmedcdValue)){
                                            match++;
                                            row=(match%2==0)?"<tr>":"<tr class='shaded'>";
                                            int index=cdList.indexOf(trimmedcdValue);
                                            writer.write(row+"<td>"+trimmedLine+"</td><td>"+cdList.get(index)+"</td><td>"+ataList.get(index)+"</td><td>"+logList.get(index)+"</td><td>"+descList.get(index)+"</td><td>"+f[y].toLowerCase()+"</td></tr>");
                                            this.removeRow(index);
                             }//end list for-loop
                        }//end line read while-loop
                        writer.flush();                    //flush writeMatch buffer
                             //write file statistics
                        row=(y%2==0)?"<tr>":"<tr class='shaded'>";
                        statWriter.write(row+"<td>"+(y+1)+" of "+f.length+"</td><td>"+f[y].toString()+"</td><td>"+lineCount+"</td><td>"+match+"</td></tr>");
                   }//end file for-loop
                   writer.write("</table></body></html>");
                   writer.close();          //close write match stream
                        //reopen write stream for new file
                   writer=new BufferedWriter(new FileWriter("./results/"+directory+"/RemainingList.html"));
                   writer.write(this.buildHeader("Remaining List"));
                   writer.write("<table><tr><th>CD Reference</th><th>ATA Number</th><th>Log Book</th><th>Description</th></tr>");
                   for(int y=0; y<cdList.size(); y++){
                        row=(y%2==0)?"<tr>":"<tr class='shaded'>";
                        writer.write(row+"<td>"+cdList.get(y)+"</td><td>"+ataList.get(y)+"</td><td>"+logList.get(y)+"</td><td>"+descList.get(y)+"</td></tr>");
                   writer.write("<tr><td colspan='4'>Remaining list size: "+cdList.size()+"</td></tr></table></body></html>");
                   writer.flush();                    //flush writeList Stream
                   writer.close();                    //close     writeList stream
                        //display operation statistics
                   endingListSize=cdList.size();
                   statWriter.write("<tr><td colspan='2'>Beginning list size:</td><td colspan='2'><strong>"+beginningListSize+"</strong></td></tr>");
                   statWriter.write("<tr class='shaded'><td colspan='2'>Null CD References removed:</td><td colspan='2'><strong>"+nulls+"</strong></td></tr>");
                   statWriter.write("<tr><td colspan='2'>ENG Log values removed:</td><td colspan='2'><strong>"+engs+"</strong></td></tr>");
                   statWriter.write("<tr class='shaded'><td colspan='2'>Ending list size:</td><td colspan='2'><strong>"+endingListSize+"</strong></td></tr>");
                   statWriter.write("</table></body></html>");
                        //flush and close stat writer stream
                   statWriter.flush();
                   statWriter.close();
              }catch(IOException ioe){
                   ioe.printStackTrace();
              }     If you care to actually look through all this code, there is a call to removeRow which deletes the selected item from each list and is as follows...
         private void removeRow(int x){
                   //remove identical row for each column
              cdList.remove(x);
              ataList.remove(x);
              logList.remove(x);
              descList.remove(x);
         }Thanks to everyone who invested time in this problem, but fortunately enough the problem was solved outside of this forum.

  • Iterating through List View Items using Group By and Jquery

    In my listview to my document library, I am using grouping. For each group (using month), it lists all the documents pertaining to that particular month.
    Using JQuery, I need to go through each item and parse them, but I'm having trouble finding a usable selector for the for/each function. My parsing code (JQuery) works, but since it uses the class of the table cell with a child anchor, it basically
    finds the first item and then all the subsequent file names are named the same (instead of different names, like it should be).
    Here's my current code that doesn't work (only the iteration and naming separately for each file - the parsing I'm doing seems to work):
    $(".ms-wpContentDivSpace" ).each(function( index ) {
    var val=$(".ms-vb2 a").html();
    var val2=val.replace(/_/g," ");
    $(".ms-vb2 a").html(val2);
    any ideas?

    That's because
    $(".ms-vb2 a").
    is bringing back all the pieces that have that class with an anchor on the whole page, not just the ones in the .ms-wpContentDivSpace
    I don't know the exact syntax, but I think you need to iterate through all the '.ms_vb2 a' items as well - there are multiple ones, and do something like this inside your other grouping
    $(".ms-vb2 a").each(function(index) {
        var val=$(this).html();
       var val2=val.replace(/_/g," ")
       $(this).html(val2);
    That's not quite right but maybe that will help.
    Robin

  • How do I iterate through a subform structure ?

      I have subforms which have individual fields which I have to set access either open or protected.  Instead of listing each single field, is there a way I can use a for loop to iterate through the subform and set each field access as needed?

    That’s unfortunate because we aren’t using Acrobat/Reader to read the forms.  We’re using a product called FormStream Filler.  Anyway, I stumbled onto a technique used in a previous form here.  I don’t understand everything about it, but I was able to replace enough code to get it to work with my form.  Suffice to say it has a lot to do with nodes. 
    Thanks for  answering.

  • Concurrent modification exception while iterating through list

    Hi,
    I have a list of objects. I use for each loop in java to iterate through that list of objects and display them.
    The problem is that while iterating other thread can add or remove some objects from that list, and I get ConcurrentModificationException.
    How can I handle this problem. How can I be sure that I am iteration through the updated list.
    Thank you

    Synchonize on the list before iterating through it, and make sure that other code also synchronizes on the list before adding to it or removing from it. Using a list implementation that simply synchronizes all the methods (e.g. Vector) will not do that, you have to do it yourself.

  • Iterating through list

    Is there is any way/tag to iterate through the values in the list, other than h:datatable???

    Doublepost, please continue here: [http://forums.sun.com/thread.jspa?threadID=5350782].

  • Iterate through a subprocess

    Hi,
    How do i iterate through a subprocess until a condition is met?
    Thanks,

    You can try this..
    Intialize i=0 and assuming roles is a list containing a list of roles.
    <Activity id='1' name='initialize'>
    <Action id='0'>
    <expression>
    <set name='role'>
    <get>
    <ref>roles</ref>
    <ref>i</ref>
    </get>
    </set>
    </expression>
    </Action>
    <Transition to='getroleinfo'/>
    </Activity>
    <Activity id='2' name='getroleinfo'>
    <Action id='0'>
    <!--call ur sub process here -->
    </Action>
    <Action id='1'>
    <expression>
    <set name='i'>
    <add>
    <ref>i</ref>
    <i>1</i>
    </add>
    </set>
    </expression>
    </Action>
    <Transition to='intialize'>
    <lt>
    <ref>i</ref>
    <length><ref>roles</ref>
    </lt>
    </Transition>
    <Transition to='end'/>
    </Activity>

  • Can anyone tell me how to iterate through a cmponent tree in JSF

    HI,
    I am new to JSF.Can any one help me in iterating through a component tree.
    For eaxmple , i have a JSF page.When i send a request for the first time for a page ,
    it will build the component tree.So i want to iterate through that component tree.
    Actullay my requirement is that in my page, i will have a datatable and some command buttons.
    when i select a row in a datatable,it should be highlighted.But again onpage load, highlighting is missing.
    So i want to save the id of the element, which i selected in the table in the request object.
    Pls help me out....

    The view root is available by FacesContext#getViewRoot(). Its getChildren() returns a List<UIComponent>. For every UIComponent you can get the children by UIComponent#getChildren() which on its turn also returns a List<UIComponent>. You can easily write a recursive method for that.

  • TreeModel - Iterate through child records using row EL

    Hi all,
    Jdev Version: Studio Edition Version 11.1.1.7.0
    I have a search page where I need to display the search results of Header and on one of the columns need to display a concatenated list of children.
    Header is a Task and children are Assignees of the task. I am looking to achieve this by using a normal table bound to a tree binding inside which the 'Assignee' view link is added as a child. So the binding is ready. I attempt to use the af:table using the treeModel which also seems to be working fine.
    Now I am stuck on how to iterate through the assignees for each task using EL - #{row.???}
    Jsff  Code snippet
              <af:table value="#{bindings.Task1.treeModel}" var="row"
                          rows="#{bindings.Task1.rangeSize}"
                          summary="#{ResourcesGenBundle['Header.SearchResults']}"
                          varStatus="tableMetadata"
                          selectionListener="#{backingBeanScope.TaskSearchBean.selectHandler}"
                  width="100%" columnStretching="column:resId1c5" autoHeightRows="15">
                    <af:column id="c3" headerText="Assignees">
                        <af:iterator id="i1" rows="2" var="assigRow"
                                 value="#{row.Task11.collectionModel}">                 
                            <af:outputText value="#{assigRow.UserName}" id="ot2"/>
                            <af:spacer width="10" height="10" id="s2"/>
                        </af:iterator>
                    </af:column>
                </af:table>
    Page Def Snippet
        <tree IterBinding="Task1Iterator" id="Task1">
          <nodeDefinition DefName="sample.common.publicModel.components.view.TaskVO"
                          Name="Task10">
            <AttrNames>
              <Item Value="TaskId"/>
              <Item Value="Subject"/>
              <Item Value="Description"/>
              <Item Value="PastDue"/>
            </AttrNames>
            <Accessors>
              <Item Value="TaskUser"/>
            </Accessors>
          </nodeDefinition>
          <nodeDefinition DefName="sample.common.publicModel.components.view.TaskUserVO"
                          Name="Task11">
            <AttrNames>
              <Item Value="ListName"/>
              <Item Value="PersonId"/>
              <Item Value="UserRole"/>
            </AttrNames>
          </nodeDefinition>
        </tree>
    Thanks,
    Srini

    Trying out with
    <af:iterator id="i1" rows="2" var="assigRow"  value="#{row.children}">
    Will keep the thread posted on my progress. Meanwhile, any suggestions welcome .
    Another way I could think of achieving this is to not use a UI iterator and instead get the value for my outputText using a bean method where I could get the present row of the tree and get the children and concatenate the Assignee names and return. But UI iterator should be a better way to do this if possible. So still exploring.

  • How to iterate through multiple records read from a file adapter?

    I am reading multiple records from a file using SyncRead file adapter.
    I want to iterate through the records to perform some action on every record. How to do this?
    I found few threads related to this..but did not get the solution.
    Please note that I am using Jdev 10.1.3.4
    Thanks

    For count expression, I am getting following error:
    <Faulthttp://schemas.oracle.com/bpel/extensionhttp://schemas.xmlsoap.org/soap/envelope/>
    <faultcode>null:subLanguageExecutionFault</faultcode>
    <faultstring>business exception</faultstring>
    <faultactor>cx-fault-actor</faultactor>
    <detail>
    <code>XPathExecutionError</code>
    <summary>XPath expression failed to execute. Error while processing xpath expression, the expression is "ora:countNodes(bpws:getVariableData('Invoke_3_SynchRead_OutputVariable','EmpCollection','/ns4:EmpCollection'))", the reason is FOTY0001: type error. Please verify the xpath query. </summary>
    </detail>
    </Fault>
    I hard-coded count, in order to proceed. Then I got following error
    <Faulthttp://schemas.oracle.com/bpel/extensionhttp://schemas.xmlsoap.org/soap/envelope/>
    <faultcode>null:bindingFault</faultcode>
    <faultstring>business exception</faultstring>
    <faultactor>cx-fault-actor</faultactor>
    <detail>
    <code>null</code>
    <summary>file:/C:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_BPELProcess4_1.0_dc4a703c46a242f69d6cea305b2df3a3.tmp/WriteDA.wsdl [ WriteDA_ptt::insert(VbEmpCollection) ] - WSIF JCA Execute of operation 'insert' failed due to: Mapping Not Found Exception. The mapping [C1] for descriptor [class bpel___localhost_default_BPELProcess4_1_0__MD5_ad2539e1386433a9e059bcc969732f11_.WriteDA.VbEmp] could not be found. The input xml record had an element [VbEmp/C1]. ; nested exception is: ORABPEL-11627 Mapping Not Found Exception. The mapping [C1] for descriptor [class bpel___localhost_default_BPELProcess4_1_0__MD5_ad2539e1386433a9e059bcc969732f11_.WriteDA.VbEmp] could not be found. The input xml record had an element [VbEmp/C1]. Make sure that the input xml is valid relative to the xsd and that the mapping exists in the Mappings.xml. If an old version of the descriptor without this mapping has been loaded by the database adapter, you may need to bounce the app server. If the same descriptor is described in two separate Mappings.xml files, make sure both versions include this attribute/mapping. </summary>
    <detail>null</detail>
    </detail>
    </Fault>
    The bpel code is as follows (I can share entire BPEL project..But not sure how to attach to the thread :( )
    <?xml version = "1.0" encoding = "UTF-8" ?>
    <!--
    Oracle JDeveloper BPEL Designer
    Created: Wed Feb 03 18:00:26 IST 2010
    Author: administrator
    Purpose: Synchronous BPEL Process
    -->
    <process name="BPELProcess4"
    targetNamespace="http://xmlns.oracle.com/BPELProcess4"
    xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:ns4="http://TargetNamespace.com/InboundService"
    xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
    xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:client="http://xmlns.oracle.com/BPELProcess4"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
    xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
    xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/file/ReadFA/"
    xmlns:ehdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions"
    xmlns:ns3="http://xmlns.oracle.com/pcbpel/adapter/db/top/WriteDA"
    xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/db/WriteDA/"
    xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
    <!--
    PARTNERLINKS
    List of services participating in this BPEL process
    -->
    <partnerLinks>
    <!--
    The 'client' role represents the requester of this service. It is
    used for callback. The location and correlation information associated
    with the client role are automatically set using WS-Addressing.
    -->
    <partnerLink name="client" partnerLinkType="client:BPELProcess4"
    myRole="BPELProcess4Provider"/>
    <partnerLink name="WriteDA" partnerRole="WriteDA_role"
    partnerLinkType="ns2:WriteDA_plt"/>
    <partnerLink name="ReadFA" partnerRole="SynchRead_role"
    partnerLinkType="ns1:SynchRead_plt"/>
    </partnerLinks>
    <!--
    VARIABLES
    List of messages and XML documents used within this BPEL process
    -->
    <variables>
    <!-- Reference to the message passed as input during initiation -->
    <!-- Reference to the message that will be returned to the requester-->
    <variable name="inputVariable"
    messageType="client:BPELProcess4RequestMessage"/>
    <variable name="outputVariable"
    messageType="client:BPELProcess4ResponseMessage"/>
    <variable name="Invoke_2_insert_InputVariable"
    messageType="ns2:VbEmpCollection_msg"/>
    <variable name="Invoke_3_SynchRead_InputVariable"
    messageType="ns1:Empty_msg"/>
    <variable name="Invoke_3_SynchRead_OutputVariable"
    messageType="ns1:EmpCollection_msg"/>
    <variable name="Invoke_3_SynchRead_InputVariable_1"
    messageType="ns1:Empty_msg"/>
    <variable name="Count" type="xsd:integer"/>
    <variable name="iterater" type="xsd:integer"/>
    </variables>
    <!--
    ORCHESTRATION LOGIC
    Set of activities coordinating the flow of messages across the
    services integrated within this business process
    -->
    <sequence name="main">
    <!-- Receive input from requestor. (Note: This maps to operation defined in BPELProcess4.wsdl) -->
    <receive name="receiveInput" partnerLink="client"
    portType="client:BPELProcess4" operation="process"
    variable="inputVariable" createInstance="yes"/>
    <!-- Generate reply to synchronous request -->
    <invoke name="Invoke_3" partnerLink="ReadFA" portType="ns1:SynchRead_ptt"
    operation="SynchRead"
    outputVariable="Invoke_3_SynchRead_OutputVariable"
    inputVariable="Invoke_3_SynchRead_InputVariable_1"/>
    <assign name="Assign_1">
    <copy>
    <from expression="1"/>
    <to variable="iterater"/>
    </copy>
    <copy>
    <from expression="1"/>
    <to variable="Count"/>
    </copy>
    </assign>
    <while name="While_1"
    condition="bpws:getVariableData('iterater') &lt;= bpws:getVariableData('Count')">
    <sequence name="Sequence_2">
    <switch name="Switch_1">
    <case condition="bpws:getVariableData('Invoke_3_SynchRead_OutputVariable','EmpCollection','/ns4:EmpCollection/ns4:Emp/ns4:C4') = &quot;Pune&quot;">
    <sequence name="Sequence_1">
    <assign name="Assign_3">
    <copy>
    <from expression="bpws:getVariableData('Invoke_3_SynchRead_OutputVariable','EmpCollection','/ns4:EmpCollection/ns4:Emp')[bpws:getVariableData('iterater')]"/>
    <to variable="Invoke_2_insert_InputVariable"
    part="VbEmpCollection"
    query="/ns3:VbEmpCollection/ns3:VbEmp"/>
    </copy>
    </assign>
    <invoke name="Invoke_2" partnerLink="WriteDA"
    portType="ns2:WriteDA_ptt" operation="insert"
    inputVariable="Invoke_2_insert_InputVariable"/>
    </sequence>
    </case>
    <otherwise>
    <sequence name="Sequence_3">
    <empty name="Empty_1"/>
    <assign name="Transform_1">
    <bpelx:annotation>
    <bpelx:pattern>transformation</bpelx:pattern>
    </bpelx:annotation>
    <copy>
    <from expression="ora:processXSLT('Transformation_3.xsl',bpws:getVariableData('Invoke_3_SynchRead_OutputVariable','EmpCollection'))"/>
    <to variable="Invoke_2_insert_InputVariable"
    part="VbEmpCollection"/>
    </copy>
    </assign>
    </sequence>
    </otherwise>
    </switch>
    <assign name="Assign_2">
    <copy>
    <from expression="bpws:getVariableData('iterater') + 1"/>
    <to variable="iterater"/>
    </copy>
    </assign>
    </sequence>
    </while>
    <reply name="replyOutput" partnerLink="client"
    portType="client:BPELProcess4" operation="process"
    variable="outputVariable"/>
    </sequence>
    </process>
    From the process flow, I can see that the array element expression works and the first employee record is correctly assigned to the Invoke_2_Input_Variable.
    However Invoke_2 is erroring out.
    Thanks
    Edited by: user8645981 on Feb 5, 2010 2:44 AM

  • Need to know how to iterate a list of field from the req xml in page servic

    Hi All,
    Please help me out with java code in which i am able to iterate a list of field coming in the request xml to my page service class under read(Pageheader header) method of mine queryPagemaintenace class.
    package com.splwg.cm.domain.pageService;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.List;
    import com.ibm.icu.math.BigDecimal;
    import com.splwg.base.api.businessObject.BusinessObjectDispatcher;
    import com.splwg.base.api.businessObject.BusinessObjectInstance;
    import com.splwg.base.api.businessObject.COTSInstanceListNode;
    import com.splwg.base.api.datatypes.Date;
    import com.splwg.base.api.lookup.BusinessObjectActionLookup;
    import com.splwg.base.api.service.DataElement;
    import com.splwg.base.api.service.ItemList;
    import com.splwg.base.api.service.PageHeader;
    import com.splwg.shared.common.ApplicationError;
    import com.splwg.shared.environ.FieldDefinition;
    import com.splwg.shared.environ.ListDefinition;
    import com.splwg.shared.logging.Logger;
    import com.splwg.shared.logging.LoggerFactory;
    * @author
    @QueryPage (program = CMUSER, service = CMUSER,
    * body = @DataElement (contents = { @ListField (name = USER_GROUP_LIST)
    * , @ListDataField (name = USR_GRP_ID)
    * , @DataField (name = MESSAGE_TEXT)
    * , @DataField (name = USER_ID)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)}),
    * actions = { "add"
    * ,"read"
    * , "delete"
    * , "change"},
    * header = { @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)},
    * headerFields = { @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = USR_GRP_ID)
    * , @DataField (name = EMAILID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)},
    * lists = { @List (name = USER_GROUP_LIST, size = 100, includeLCopybook = false,
    * body = @DataElement (contents = { @DataField (name = USR_GRP_ID)}))},modules = {})
    public class CMUSER extends CMUSER_Gen {
    public static final Logger logger = LoggerFactory.getLogger(CMUSER.class);
         DataElement root = new DataElement();
         PageHeader page = new PageHeader();
         protected DataElement read(PageHeader header) throws ApplicationError{
    I want to know how can i iterate this USER_GROUP_LIST in my read method and get the USR_GRP_ID field data from it.
    A Prompt reply from your end will help me to resolve this issue

    Guru Sir,
    i tried to override the add() method of the framework in that i was able to iterate the field from the list. But now the i am facing there is that i am not able to send back the response to the external system in XML format. I am getting a blank response in my SOAP UI Tool while testing here is the code:
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.List;
    import com.ibm.icu.math.BigDecimal;
    import com.splwg.base.api.businessObject.BusinessObjectDispatcher;
    import com.splwg.base.api.businessObject.BusinessObjectInstance;
    import com.splwg.base.api.businessObject.COTSInstanceListNode;
    import com.splwg.base.api.datatypes.Date;
    import com.splwg.base.api.lookup.BusinessObjectActionLookup;
    import com.splwg.base.api.service.DataElement;
    import com.splwg.base.api.service.ItemList;
    import com.splwg.base.api.service.PageHeader;
    import com.splwg.shared.common.ApplicationError;
    import com.splwg.shared.logging.Logger;
    import com.splwg.shared.logging.LoggerFactory;
    * @author
    @QueryPage (program = CMUSER4, service = CMUSER4,
    * body = @DataElement (contents = { @DataField (name = MESSAGE_TEXT)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)
    * , @ListDataField (name = USR_GRP_ID)
    * , @ListField (name = USER_GROUP_LIST)}),
    * actions = { "add"
    * , "delete"
    * , "change"
    * , "read"},
    * header = { @DataField (name = USER_ID)
    * , @DataField (name = MESSAGE_TEXT)},
    * headerFields = { @DataField (name = USER_ID)
    * , @DataField (name = MESSAGE_TEXT)},
    * lists = { @List (name = USER_GROUP_LIST, size = 100,
    * body = @DataElement (contents = { @DataField (name = USR_GRP_ID)}))}, modules = {})
    public class CMUSER4 extends CMUSER4_Gen {
         public static final Logger logger = LoggerFactory.getLogger(CMUSER4.class);
         DataElement root = new DataElement();
         PageHeader page = new PageHeader();
         protected PageHeader add(DataElement item) throws ApplicationError{
              BusinessObjectInstance boInstance = BusinessObjectInstance.create("CM-USER");
              String USR_GRP_ID = null;
              try{
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.USER_ID));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.FIRST_NAME));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.LAST_NAME));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.EMAILID));
              // logger.info("Data coming from the Service into the Application is :"+getInputHeader().getString(STRUCTURE.list_USER_GROUP_LIST.USR_GRP_ID));
              // Iterator it = STRUCTURE.
              ItemList sourceList = item.getList(STRUCTURE.list_USER_GROUP_LIST.name);
              List userGrpID = new ArrayList();
              logger.info("The Size of the User Group List here is :"+sourceList.size());
              Iterator iter;
              if ((sourceList != null) &&
              (sourceList.size() > 0)) {
              for (iter = sourceList.iterator(); iter.hasNext(); ) {
              DataElement myItem = (DataElement)iter.next();
              USR_GRP_ID = myItem.get(STRUCTURE.list_USER_GROUP_LIST.USR_GRP_ID);
              logger.info("The User Group Id coming in the List here is :"+USR_GRP_ID);
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.PASSWORD));
              boInstance.set("user", item.get(STRUCTURE.USER_ID));
              boInstance.set("firstName", item.get(STRUCTURE.FIRST_NAME));
              boInstance.set("lastName", item.get(STRUCTURE.LAST_NAME));
              boInstance.set("emailAddress", item.get(STRUCTURE.EMAILID));
              // COTSInstanceList userGrpList = boInstance.getList("userGroupUser");
              // COTSInstanceListNode userGroupList = userGrpList.newChild();
              COTSInstanceListNode userGroupList = boInstance.getList("userGroupUser").newChild();
              userGroupList.set("userGroup", USR_GRP_ID);
              logger.info("Data coming from the Service into the Application is :"+userGroupList.toString());
              /*boInstance.set
              boInstance.set("userGroup", getInputHeader().getString(STRUCTURE.HEADER.USR_GRP_ID));*/
              // UserTypeLookup.constants.TEMPLATE_USER
              //if(element.get(STRUCTURE.USER_TYPE_FLG))
              //boInstance.set("user", element.get(STRUCTURE.));
              boInstance.set("dashboardWidth","200");
              boInstance.set("homeNavigationOption","CI0000000574");
              boInstance.set("language","ENG");
              boInstance.set("toDoEntriesAge1", new BigDecimal(50));
              boInstance.set("toDoEntriesAge2",new BigDecimal(100));
              boInstance.set("displayProfileCode", "NORTHAM");
              String expirationDate = "2100-12-31";
              String[] array = expirationDate.split("-");
              userGroupList.set("expirationDate",new Date(Integer
                             .parseInt(array[0]), Integer
                             .parseInt(array[1]), Integer
                             .parseInt(array[2])));
              //boInstance.set("userGroupUser", userGroupList);
              COTSInstanceListNode roleUserList = boInstance.getList("roleUser").newChild();
              roleUserList.set("toDoRole","F1_DFLT");
              COTSInstanceListNode dataAccessList = boInstance.getList("dataAccessUser").newChild();
              dataAccessList.set("dataAccessRole","***");
              String expiryDate = "2100-01-01";
              String[] array1 = expiryDate.split("-");
              dataAccessList.set("expireDate",new Date(Integer
                             .parseInt(array1[0]), Integer
                             .parseInt(array1[1]), Integer
                             .parseInt(array1[2])));
              BusinessObjectDispatcher.execute(boInstance,
                             BusinessObjectActionLookup.constants.FAST_ADD);
              page.put(STRUCTURE.HEADER.MESSAGE_TEXT, "User Added Successfully");
              page.put(STRUCTURE.HEADER.USER_ID,item.get(STRUCTURE.USER_ID));
              }catch(Exception e){
                   e.printStackTrace();
                   page.put(STRUCTURE.HEADER.MESSAGE_TEXT, "Caught Exception in the ORMB System. Please reach out to the Admin"+e.getMessage());
                   page.put(STRUCTURE.HEADER.USER_ID,item.get(STRUCTURE.USER_ID));
              return page;
    If you can help me to find out what went wrong here while sending the response back it can close my issue.

  • Iterate through all the records in a table using Java API

    Hi All,
    What is the easiest way to iterate through all the records in a given table using Java API? I cannot find any methods that will return all records in a table and the only way I can use is to perform a free form search with a condition that is always true. The code works but is pretty ugly. Is there an alternative to this approach?
    Thanks!
    Kenny

    Hi Kenny,
    You can construct a new Search object with your table's code name, a new ResultSetDefinition object for your table and just execute this search using the GetResultSet method of CatalogData.
    Please look at the following code:
    Search search = new Search(<code name of your table>);
    ResultSetDefinition rsd = new ResultSetDefinition(<code name of your table>);
    rsd.AddField<code name of a field>);
    rsd.AddField(<code name of a field>);
    String sortField = <code name of your sort field>;
    boolean sortAscending = true;
    int page = 0; //page number
    A2iResultSet rs = <your CatalogData object>.GetResultSet(search, rsd, sortField, sortAscending, page);
    for (int i = 0; i < rs.GetRecordCount(); i++)
        Value fieldValue = rs.GetValueAt(i, <code name of a field>);
    Hope this helps,
    Nir
    PS - I really recommend you to start using the new API, as it is much more efficient and straight-forward.

Maybe you are looking for

  • Can i download a filefrom an external hard drive to an ipad

    can I download a file from an external hard drive to an I pad

  • Fire Wire Target Disk Mode

    I Have a MacBook Pro 2010 that I have put into FireWire target disk mode. Is there any way to just copy the entire hardrive onto my other MacBook Pro rather than going through the entire hard drive and transferring everything separately?

  • Outlook Exchange on iMac - crashes

    I cannot get Outlook for Mac 2011 to run on my iMac, even though it runs fine on both my MacBook Pro and Air. It boots up, starts to connect to the Exchange Server, and before long it crashes. Here is an example of a detailed error message I have rec

  • Problem upgrading to a new version of WCS

    Hi, I'm currently trying to upgrade my wcs from version 5.1.64.0 to 6.0.181.0. but every time i run the installation file it tells me that there are multiple copies of the WCS installed on the server and i can't upgrade i can only start a new install

  • What happened to the search box in toolbar in PDF Reader X

    Hi, Can anyone help on how to get the search box to show in the toolbar as had in previous versions of reader? There dosn't seem to be option to activate it in preferances. Seems idiotic to remove it, used it lot ot search documents, etc. If it's bee