none
how to use ActivityParty in DynamicEntity

    Question

  • Hi All,

     

    I am creating a Letter using DynamicEntity and the field "from" is not getting updated.  I am confused with reference to usage of ActivityParty in DynamicEntity.  Could someone pl help me with the following code writtin in Java.

     

    Following is the code snippet:

    ArrayList arrProps = new ArrayList(5);

    DynamicEntityArrayProperty deap = new DynamicEntityArrayProperty();

    DynamicEntity[] activityParties = new DynamicEntity[1]; 
    activityParties[0] = new DynamicEntity(); 
    activityParties[0].setName("activityparty");

     

    Property[] activityparty_cp = new Property[1];

    LookupProperty temp = new LookupProperty();
    temp.setName("from");
         
    Lookup lookup=new Lookup();
    lookup.set_value("Demo From");
    lookup.setType(EntityName.letter.toString());

    temp.setValue(lookup);

    activityparty_cp[0] = temp;

    activityParties[0].setProperties(activityparty_cp); 
           
    deap.setName("from");
    deap.setValue(activityParties);
    arrProps.add(deap);

     

    Property[] property = new Property[arrProps.size()];
      for(int d=0;d<arrProps.size();d++){
       Property temp = (Property)arrProps.get(d);
       propertyDrinks=temp;
      }

    ......

     

    Thanks in Advance,

     

    Yuva

    Tuesday, July 08, 2008 3:47 PM

Answers

  • Hi

     

    Thanks for all those who read the post.  I found the solution myself and got the letter created using dynamic entity.  Here is the sample code.

     

    Code snippet for adding an ActivityParty to the DynamicEntity:  Hope this is correct.  This is just a sample test code

     

    Code Snippet

    ArrayList arrProps = new ArrayList(1);

     

    LookupProperty temp = new LookupProperty();
    temp.setName("partyid");
    Lookup lookup=new Lookup();
    lookup.setName(strValue);
    lookup.set_value("user id");
    lookup.setType(EntityName.systemuser.toString());
         
    temp.setValue(lookup);
         
    Property[] p1 = new Property[1];
    p1[0]=temp;
         
    DynamicEntity[] deArray=new DynamicEntity[1];
    deArray[0] = new DynamicEntity();
    deArray[0].setProperties(p1);
    deArray[0].setName("activityparty");
         
    DynamicEntityArrayProperty deap = new DynamicEntityArrayProperty();
    deap.setName("from");
    deap.setValue(deArray);

    arrProps.add(deap);

     

    Property[] property = new Property[arrProps.size()];

     

    Then from the arrProps, read thru all the items and add to Property array, property[].

     

    try
      {
     
       taskEntity.setProperties(property);
       TargetCreateDynamic targetCreate = new TargetCreateDynamic();
       targetCreate.setEntity(taskEntity);
       CreateRequest create = new CreateRequest();
       create.setTarget(targetCreate);
         
       //Execute the request.
       CreateResponse created = (CreateResponse)binding.execute(create);
       String returnedResult = "{"+created.getId()+"}";
       System.out.println("Task created successfully.  The host Id is  : "+created.getId());
      }
      catch(Exception e)
      {

    }

     

     

    Regards

     

    Yuva

    Tuesday, July 15, 2008 1:18 PM

All replies

  • Hi

     

    Thanks for all those who read the post.  I found the solution myself and got the letter created using dynamic entity.  Here is the sample code.

     

    Code snippet for adding an ActivityParty to the DynamicEntity:  Hope this is correct.  This is just a sample test code

     

    Code Snippet

    ArrayList arrProps = new ArrayList(1);

     

    LookupProperty temp = new LookupProperty();
    temp.setName("partyid");
    Lookup lookup=new Lookup();
    lookup.setName(strValue);
    lookup.set_value("user id");
    lookup.setType(EntityName.systemuser.toString());
         
    temp.setValue(lookup);
         
    Property[] p1 = new Property[1];
    p1[0]=temp;
         
    DynamicEntity[] deArray=new DynamicEntity[1];
    deArray[0] = new DynamicEntity();
    deArray[0].setProperties(p1);
    deArray[0].setName("activityparty");
         
    DynamicEntityArrayProperty deap = new DynamicEntityArrayProperty();
    deap.setName("from");
    deap.setValue(deArray);

    arrProps.add(deap);

     

    Property[] property = new Property[arrProps.size()];

     

    Then from the arrProps, read thru all the items and add to Property array, property[].

     

    try
      {
     
       taskEntity.setProperties(property);
       TargetCreateDynamic targetCreate = new TargetCreateDynamic();
       targetCreate.setEntity(taskEntity);
       CreateRequest create = new CreateRequest();
       create.setTarget(targetCreate);
         
       //Execute the request.
       CreateResponse created = (CreateResponse)binding.execute(create);
       String returnedResult = "{"+created.getId()+"}";
       System.out.println("Task created successfully.  The host Id is  : "+created.getId());
      }
      catch(Exception e)
      {

    }

     

     

    Regards

     

    Yuva

    Tuesday, July 15, 2008 1:18 PM
  • Yuva, pls HELP !!!!! tell me what kind of Axis WSDL2Java tool You have used to generate stubs. I see You have properly generated Lookup entity. My Lookup  class doesnt have this method : "lookup.set_value("user id");" ... hence I cannot make relation between Entities. I know this was long time ago, but maybe this message will somehow reach YOU !!!
    Tuesday, November 30, 2010 11:46 AM