Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 2.14 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. try
  2. {
  3.         String name_first = myReallyCoolGetStringFromXML(fstElmnt,"firstName"); // get first name
  4.         String name_last = myReallyCoolGetStringFromXML(fstElmnt,"lastName");   // get last name
  5.         String name_display = myReallyCoolGetStringFromXML(fstElmnt,"displayName");     //get displayName
  6.         String name_full = myReallyCoolGetStringFromXML(fstElmnt,"fullName"); // get fullName
  7.         String email = myReallyCoolGetStringFromXML(fstElmnt,"email");  // get email
  8.         String phone = myReallyCoolGetStringFromXML(fstElmnt,"phone");  // get phone
  9.         String zip_code = myReallyCoolGetStringFromXML(fstElmnt,"zip"); //get zip
  10.         String building = myReallyCoolGetStringFromXML(fstElmnt,"building");    //get building
  11.        
  12.         conAPI.setContentletProperty(con2, uanetidField, uanetID);
  13.         conAPI.setContentletProperty(con2, namefirstField, name_first);
  14.         conAPI.setContentletProperty(con2, namelastField, name_last);
  15.         conAPI.setContentletProperty(con2, namefullField, name_full);
  16.         conAPI.setContentletProperty(con2, namedisplayField, name_display);
  17.         conAPI.setContentletProperty(con2, buildingField, building);
  18.         conAPI.setContentletProperty(con2, phoneField, phone);
  19.         conAPI.setContentletProperty(con2, zipField, zip_code);
  20.         conAPI.setContentletProperty(con2, emailField, email);
  21. } catch (Exception e) {
  22.         System.out.println("set con2 contentlet properties: "+e.getMessage());
  23. }
  24. // check in to PEOPLE structure
  25. // is it at this point that we'd want to establish relstaionship to GROUP and PEOPLE_GROUP structures?
  26.  
  27. Map<Relationship, List<Contentlet>> relations = new HashMap<Relationship, List<Contentlet>>();
  28.  
  29. List<Relationship> rels = RelationshipFactory.getAllRelationshipsByStructure(importStructurePeople);
  30.  
  31. for (Relationship r : rels)
  32. {
  33.         if(!relations.containsKey(r))
  34.         {
  35.                 relations.put(r, new ArrayList<Contentlet>());
  36.         }
  37.         List<Contentlet> cons = conAPI.getRelatedContent(con2, r, PublicUserFactory.getSystemUser(), true);
  38.         for (Contentlet co : cons)
  39.         {
  40.                 List<Contentlet> l2 = relations.get(r);
  41.                 l2.add(co);
  42.         }
  43. }
  44.  
  45. // this is what it was before --> conAPI.checkin(con2, PublicUserFactory.getSystemUser(), true);
  46. conAPI.checkin(con2, relations, PublicUserFactory.getSystemUser(), true);