Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
12 replies Latest Post - ‏2014-02-19T12:23:15Z by AdapterDeveloper
AdapterDeveloper
AdapterDeveloper
36 Posts
ACCEPTED ANSWER

Pinned topic Multipla valued attribute modification

‏2014-02-12T07:45:56Z |

Hi,

I have a multivalued attribute with value S,M,T,W,T,F etc. I am selecting multiple values for modify request from itim(example S,M,W) . 

I am getting this attribute using getAttribute() it shows me [WU, SMW]. First one is old value and the second one is new.

Then I add the SMW value to one of the parameter of target system Store procedure and it gets modified successfully .But ITIM does not understand this SMW value. Please let me know if there is any way we can send all the values separately to itim or I can change my solution in any way.

 

 

 

Thanks

     

  • mark99
    mark99
    26 Posts
    ACCEPTED ANSWER

    Re: Multipla valued attribute modification

    ‏2014-02-12T12:31:57Z  in response to AdapterDeveloper

    hi

     

    You posted the question 2 times. In both questions it is unclear  what you try to do 

    I presume you create your own adapter in TDI. (But if this is the case why did you not put this in your post) 

    getAttribute() returns an Attribute not a value 

    see http://www.stephen-swann.co.uk/javadoc/tdi7.0/com/ibm/di/entry/Attribute.html

    var a = work.getAttribute("sn");

    for (var i=0;i<a.size();i++)

    a.getValueOper(i);

    a.getValue(i);

    }

     

     

    Putting the following in your adapter definition changes the behavior

     

    • AdapterDeveloper
      AdapterDeveloper
      36 Posts
      ACCEPTED ANSWER

      Re: Multipla valued attribute modification

      ‏2014-02-12T13:21:22Z  in response to mark99

      Hi

       

      I am developing one custom adapter and the issue is with modifying multivalued attribute to one Oracle target system. For this I have one oracle stored procedure which one parameter in it's stored procedure which will take input from Adapter. Find my code.

      var objAttrMulti = work.getAttribute("leaveday"); //[WU, SMW]
                
                  var j = 0;
                  var iValOp;
                  var aAttrVals = objAttrMulti.getValuesAV();
                  for (j = 0; j < aAttrVals.length; j++) {
                  iValOp = aAttrVals[j].getOper();
                  task.logmsg("$$$ OPeartion in value $$$" +aAttrVals[j]+"is"+ iValOp);    
                  if (iValOp == Packages.com.ibm.di.entry.AttributeValue.AV_ADD){
                  var offday = new String(aAttrVals[j].getValue());
                  task.logmsg("value received for adding is: '" + offday + "'");// value coming SMW(value to be added)
                  
                  
                  }
              }

      Now I am setting this to Oracle stored procedure

      cstmt.setString(9,    offday),

      Now when result reaches to ITIM ,itim can not understand SMW value. ITIM has value S,M,W separately. ITIM added one more value called SMW to leaveday attribute.  

       

      ****Type of the leave day attribute in itim is listbox.

      Please let me know if I am missing anything .

      Updated on 2014-02-12T13:23:08Z at 2014-02-12T13:23:08Z by AdapterDeveloper
      • mark99
        mark99
        26 Posts
        ACCEPTED ANSWER

        Re: Multipla valued attribute modification

        ‏2014-02-14T14:28:21Z  in response to AdapterDeveloper

         

        Did you clear the attibutes of the work item before sending a reply to tim ?

         

        work.removeAllAttributes();
        work.setProperty(Packages.com.ibm.di.dispatcher.Defs.STATUSCODE, new Packages.java.lang.Integer(Packages.com.ibm.itim.remoteservices.provider.Status.SUCCESSFUL));
        • AdapterDeveloper
          AdapterDeveloper
          36 Posts
          ACCEPTED ANSWER

          Re: Multipla valued attribute modification

          ‏2014-02-16T06:33:07Z  in response to mark99

          yes I have done the same....Even when printing work entry it is showing null....

          • Grantk
            Grantk
            321 Posts
            ACCEPTED ANSWER

            Re: Multipla valued attribute modification

            ‏2014-02-18T08:53:17Z  in response to AdapterDeveloper

            When you say - result reaches TIM.  What operation is this?  Is this a reconciliation or an add/modify.

            If it is a recon, the TIM will use the value in the attribute map.  You can dump this just before it is sent to TIM and check if it as expected.

            If it is add/modify, then TIM only receives a status response (success/error).  No attribute update would go back to TIM.

             

            In your code snippet, you get the attribute values and you set them for your stored proced, however there is nothing showing where you modify the attribute values to be sent back to TIM.

            • AdapterDeveloper
              AdapterDeveloper
              36 Posts
              ACCEPTED ANSWER

              Re: Multipla valued attribute modification

              ‏2014-02-18T10:16:58Z  in response to Grantk

              Hi Grantk,

              Thanks for your reply. In this request I am performing account modification for a multivalued attribute through one custom adapter.

              Suppose I have values S and M in this attribute which I have sent at the time of account creation. Then I need to modify this with new values W,D and T. I perform one account modification with new value of this attribute(W,D,T). When I perform getAttribute in my adapter  result is [SM, WDT]. Then I get WDT from this using getOper method and set this to oracle stored procedure.

              After procedure call is over I have performed work.removeAllAttribute().

              In target WDT is successfully modified but ITIM does not undestand WDT separately that is (W,D,T).

              It added one new value to the attribute called WDT.

              If my adapter does not send any value apart from status code at the time of account modification how ITIM understand it has to add WDT at it's end.

              Also let me know if I can make any array then set it to itim account attribute so that it understand W,D,T instead of WDT.

              • Grantk
                Grantk
                321 Posts
                ACCEPTED ANSWER

                Re: Multipla valued attribute modification

                ‏2014-02-18T11:31:00Z  in response to AdapterDeveloper

                Hi,

                 

                OK, forget about the adaptor side of things, what you are after is all on the TIM side.  You say that getAttribute returns [SM, WDT].  So this is the value that you have updated this attribute in TIM (Nothing you do in the adaptor from this point will change this)

                When you perform an account modify in TIM, the data that is sent from TIM to the adaptor in the operation is what will be stored in the TIM ldap (assuming a successful response).

                So if I understand correctly you want TIM to have this value as [W,D,T] instead.  So you need to get this data correct in TIM first.

                What type of object control are you using in the account form? (Date, listbox etc).  This is where you will define the format of the data being passed from TIM to your adaptor.

                • AdapterDeveloper
                  AdapterDeveloper
                  36 Posts
                  ACCEPTED ANSWER

                  Re: Multipla valued attribute modification

                  ‏2014-02-18T12:29:21Z  in response to Grantk

                  Hi Grantk,

                  We are using listbox type of attribute in account form. I did not get any other type in itim where we can provide user to access multiple value for a particular attribute in ITIM. Please find attached screen shot.

                  Also I have shared screen shot of request in itim view request.

                  Please let me know how to resolve this issue.

                  • Grantk
                    Grantk
                    321 Posts
                    ACCEPTED ANSWER

                    Re: Multipla valued attribute modification

                    ‏2014-02-18T13:29:04Z  in response to AdapterDeveloper

                    Hi

                    Maybe I am not understanding your problem correctly.

                    In the request screen shot it shows TIM has updated the value from SH to [M,S]  Isn't this what you want?

                    • AdapterDeveloper
                      AdapterDeveloper
                      36 Posts
                      ACCEPTED ANSWER

                      Re: Multipla valued attribute modification

                      ‏2014-02-18T14:55:13Z  in response to Grantk

                      Hi ,

                       

                      This is the request(in screen shot) when we started change account request from itim.

                      But In adapter we are getting [SM, WDT] as a array type .

                      After completion of the request ITIM cannot understand all the values separately and it added one extra value WDT to itim.

                      Example:-Before Change

                      offday

                      S

                      M

                      T

                      W

                      U

                      F

                      After change

                      when I am sending T,U at the time of account change.After account change the attribute and values are showing like 

                      offday

                      S

                      M

                      T

                      W

                      U

                      F

                      TU      (This is what happening)

                       Please let me know your input

                       

                      • Grantk
                        Grantk
                        321 Posts
                        ACCEPTED ANSWER

                        Re: Multipla valued attribute modification

                        ‏2014-02-19T10:35:08Z  in response to AdapterDeveloper

                        Hi,

                        Where are you seeing this data displaying like that? Are you checking the TIM ldap directly for this?

                        So if I understand correctly, you have a multivalued attribute which displays using a listbox.

                        Before the modify request this displays value1, value2, value3 as being selected.  This is represented by 3 seperate values in the multivalued attribute on the ldap.

                        attribute[value1]

                        attribute[value2]

                        attribute[value3]

                        You then modify by selecting 2 options in the list box (lets say value1 and value 5).

                        This is now represented in the ldap as 4 seperate values in the multivalued attribute

                        attribute[value1]

                        attribute[value2]

                        attribute[value3]

                        attribute[value1,value5]

                         

                        What you are expecting is for this to overwrite the original attribute values as end up with:

                        attribute[value1]

                        attribute[value5]

                         

                        Is this correct?

                        • AdapterDeveloper
                          AdapterDeveloper
                          36 Posts
                          ACCEPTED ANSWER

                          Re: Multipla valued attribute modification

                          ‏2014-02-19T12:23:15Z  in response to Grantk

                          Hi,

                           

                          You are right. I am seeing this attribute value both from itim account form as well as ldap.

                          Rest are are also as per your thinking.

                           

                          Thanks