1 Reply Latest reply on May 26, 2015 7:46 AM by Steven Hawkins

    adding data roles dynamically to VDB using java

    Sridhar Reddy Newbie

      I am trying to add data roles dynamically to a vdb(update .xml file vdb) using java. Here is the sample code


      Admin admin = AdminFactory.getInstance().createAdmin("localhost", 10000, "admin", "admin".toCharArray());



      List<DataPolicy> policyList = vdb.getDataPolicies();


      for(DataPolicy dp:policyList){

      List<String> mrole = dp.getMappedRoleNames(); 

      List<DataPermission> dperm = dp.getPermissions();

      System.out.println("data policy roles details: "+mrole.toString());

      for(DataPermission pmi:dperm){

          System.out.println("resouse name: "+pmi.getResourceName());

          System.out.println("resouse getAllowCreate: "+pmi.getAllowCreate());

          System.out.println("resouse getAllowRead: "+pmi.getAllowRead());

          System.out.println("resouse getAllowRead: "+pmi.getAllowRead());

          System.out.println("resouse getAllowRead: "+pmi.getAllowRead());





      DataPolicyMetadata roleOne = new DataPolicyMetadata();


      roleOne.setDescription("testOne described");

      PermissionMetaData perm1 = new PermissionMetaData();






      VDBMetaData vdbMeta = (VDBMetaData)vdb;



      //print the resource names again



      With this code I am able to see new resource name being added and re displayed in the log file. But it is not updating the xml file in VDB.

      Actual requirement is "allow users to add new roles which can be used accessing and constraining the VDB".