2017-11-04 7 views
1

Oracle Identity Manager API를 통해 상위 조직에서 하위 조직으로 조직 구성원을 이동하려고합니다. 나는 그들 둘 다를위한 orgkey를 가지고있다. 나는 아래 코드 스 니펫을 작성했다. srcOrgOrganizationMembers 변수에서 상위 조직 회원 목록을 가져올 수 있습니다. 오류를 받기Oracle Identity Manager API를 사용하여 조직 구성원을 다른 곳으로 이동

oracle.iam.identity.exception.ValidationFailedException : IAM-3056148은 : usr_pwd_warn_date는 시스템 속성과

당신이 PLS 제거하는 방법을 제안 할 수 있습니다 API를 통해 설정할 수 없습니다 이 문제. 미리 도움을 주셔서 감사합니다!

OrganizationManager orgManager = oimClient.getService(OrganizationManager.class); 


     List<String> childOrgList = new ArrayList<String>(); 

     String orgkey = "54"; 

     try { 

       HashMap<String, Object> configParams = new HashMap<String, Object>(); 
       Set<String> retAttrs = new HashSet<String>(); 
       List<Organization> ChildOrg = new ArrayList<Organization>(); 

       ChildOrg = orgManager.getChildOrganizations(orgkey, retAttrs, configParams); 

       List srcOrgOrganizationMembers = orgManager.getOrganizationMembers(orgkey, retAttrs, null, configParams); 
       System.out.println("Child Organizations Details : " + ChildOrg); 
       System.out.println("Parent Organization Users : " + srcOrgOrganizationMembers); 



        System.out.println("Child Organizations Details : " + ChildOrg); 

        if (ChildOrg != null) { 

          for (int s = 0; s < ChildOrg.size(); s++) { 

           String childorgkey = ChildOrg.get(s).getEntityId(); 
           System.out.println("Child Org Key : " + childorgkey); 

           childOrgList.add(childorgkey); 



           List<Organization> grandChildOrg = new ArrayList<Organization>(); 
           grandChildOrg = orgManager.getChildOrganizations(childorgkey, retAttrs, configParams); 
           if (grandChildOrg != null) { 

             for (int a = 0; a < grandChildOrg.size(); a++) { 

               String grandchildorgkey = grandChildOrg.get(a).getEntityId(); 
               System.out.println("Grand Child Org Key : " + grandchildorgkey); 

               childOrgList.add(grandchildorgkey); 

               List<Organization> garndgrandChildOrg = new ArrayList<Organization>(); 
               garndgrandChildOrg = orgManager.getChildOrganizations(grandchildorgkey, retAttrs, 
                  configParams); 
               if (garndgrandChildOrg != null) { 

                for (int b = 0; b < garndgrandChildOrg.size(); b++) { 

                  String garndgrandchildorgkey = garndgrandChildOrg.get(b).getEntityId(); 
                  System.out.println("Grand Grand Child Org Key : " + garndgrandchildorgkey); 

                  childOrgList.add(garndgrandchildorgkey); 

                } 

               } 

             } 

           } 

          } 

        } 

        System.out.println("Child Org List outside while: " + childOrgList); 

        UserManager orgUsrMgr = oimClient.getService(UserManager.class); 
        System.out.println("\n \n values in orgUsrMgr" + orgUsrMgr); 

        List<User> resultUsers = new ArrayList<User>(); 


        for(String childOrgzKey : childOrgList){ 

          UserManagerResult result = null; 

          for(Object usrObj : srcOrgOrganizationMembers){ 

          User fromUser = (User)usrObj; 
          HashMap mapOfSrcUserAttribute = fromUser.getAttributes(); 
          //System.out.println("Organization Names of the Users" + fromUser.getAttribute("Organization Name")); 
          //User toUser = new User(""); 


          //fromUser.setAttribute("Organization Name", "Requests"); 

          System.out.println("\n\n Values in Source User Hashmap :" + mapOfSrcUserAttribute); 

          /* 
          System.out.println("\n\n Values in Source User Hashmap Keys :" + mapOfSrcUserAttribute.keySet()); 

          for(Object attrName : mapOfSrcUserAttribute.keySet()){ 
           toUser.setAttribute(attrName.toString(), mapOfSrcUserAttribute.get(attrName)); 
          } 
          System.out.println("\n\n Values in toUser : " + toUser);*/ 

          fromUser.setOrganizationKey(childOrgzKey); 

          try { 
           result = orgUsrMgr.modify(fromUser); 
           System.out.println(fromUser +"User Sucessfully got Created" + result); 
           resultUsers.add(fromUser); 

           } catch (Exception e) { 
            System.out.print(e); 
          } 

         } 
        } 

        System.out.println("List of all created users = " + resultUsers); 

답변

1

당신은이 조직

User usr = new User(fromUser.getId()); 
usr.setOrganizationKey(childOrgzKey); 

orgUserMgr.modify(user) 
+0

감사 필립을 변경하려면 다음을 사용해야합니다! 이것은 코드가 막힌 부분입니다. 당신이 제안한 변화에 완벽하게 부합합니다. – Sandip