Friday, October 18, 2013

Webcenter Content: How to get all Aliases

In Webcenter Content you can create a group of users that can be then referenced by a single name, or ALIAS, in workflows, subscriptions, and projects.

Sometimes you may need to develop a custom user interface to view or manage Aliases. Below you have an example code which I use to load list of Webcenter Content Aliases. What more, you can with this code get users list per each Alias:

  IdcClient idcClient;
  IdcContext userContext;

    // .......... 

    // UcmAlias is my custom object which contains alias metadata


    Map<String,UcmAlias> aliases = new LinkedHashMap<String,UcmAlias>();
    DataBinder binder = idcClient.createBinder();           
    binder.putLocal("IdcService", "GET_ALIASES");
    ServiceResponse response = idcClient.sendRequest (userContext, binder); 
    DataBinder serverBinder = response.getResponseAsBinder();
    DataResultSet resultSet =
        serverBinder.getResultSet("Alias");
    for (DataObject dataObject : resultSet.getRows()) {
      UcmAlias alias = new UcmAlias();
      String nazwa = dataObject.get("dAlias");
      alias.setDAlias(nazwa);
      alias.setDAliasDescription(dataObject.get("dAliasDescription"));
      alias.setDAliasDisplayName(dataObject.get("dAliasDisplayName"));
      List<String> users = new ArrayList<String>();
      alias.setUsers(users);
      
      aliases.put(nazwa,alias);
    }
    DataResultSet resultSet1 =
        serverBinder.getResultSet("AliasUserMap");
    for (DataObject dataObject : resultSet1.getRows()) {
      String nazwa = dataObject.get("dAlias");
      String user = dataObject.get("dUserName");
      
      aliases.get(nazwa).getUsers().add(user);
    }
   
    // here you get list of all aliases in custom map

No comments:

Post a Comment