コード例 #1
0
 public static OrgTreeNode[] convertOrgs(OrgOrganization[] orgs) {
   if (orgs == null || orgs.length == 0) return new OrgTreeNode[0];
   List<OrgTreeNode> nodelist = new ArrayList<OrgTreeNode>();
   for (int i = 0; i < orgs.length; i++) {
     OrgTreeNode node = OrgTreeNode.FACTORY.create();
     node.setNodeId(String.valueOf(orgs[i].getOrgid()));
     node.setNodeName(orgs[i].getOrgname());
     node.setIconCls(IconCls.ORGANIZATION);
     node.set(
         "parentId",
         orgs[i].getOrgOrganization() == null ? null : orgs[i].getOrgOrganization().getOrgid());
     nodelist.add(node);
   }
   return nodelist.toArray(new OrgTreeNode[] {});
 }
コード例 #2
0
  /**
   * @param orgPartyList
   * @return
   */
  public static DataObject[] buildOrgTreeNodes(List<Party> orgPartyList) {
    List<DataObject> results = new ArrayList<DataObject>();

    for (Party orgParty : orgPartyList) {
      OrgTreeNode node = OrgTreeNode.FACTORY.create();
      node.setNodeId(orgParty.getId());
      node.setNodeType(OrgOrganization.NODE_TYPE);
      node.setNodeName(orgParty.getName());
      node.setIconCls(IconCls.ORGANIZATION);
      node.set(IOrgConstants.ORGID_PROPERTY, String.valueOf(orgParty.getId()));
      node.set(IOrgConstants.ORGNAME_PROPERTY, String.valueOf(orgParty.getName()));
      node.set("isLeaf", false);
      node.set("expanded", false);
      results.add(node);
    }
    return results.toArray(new DataObject[results.size()]);
  }