@Test public void testAssignUsers() { UIRepositoryObjectAcl selectedUserAcl = new UIRepositoryObjectAcl( createUserAce( USER1 ) ); repositoryObjectAcls.addAcl( selectedUserAcl ); repositoryObjectAclModel.setAclsList( defaultUserNameList, null ); List<Object> objectUserList = Arrays.asList( new Object[] { USER2 } ); repositoryObjectAclModel.assignUsers( objectUserList ); assertStringListMatches( Arrays.asList( new String[] { USER3 } ), repositoryObjectAclModel.getAvailableUserList() ); assertNameToAclListMatches( Arrays.asList( new String[] { USER2 } ), repositoryObjectAclModel .getSelectedAssignedUsers() ); assertNameToAclListMatches( Arrays.asList( new String[] { USER2 } ), repositoryObjectAclModel.getAclsToAdd() ); repositoryObjectAclModel.updateSelectedAcls(); assertNameToAclListMatches( Arrays.asList( new String[] { USER1, USER2 } ), repositoryObjectAclModel .getSelectedAcls().getAcls() ); repositoryObjectAclModel.getAclsToAdd().clear(); UIRepositoryObjectAcl user2Acl = repositoryObjectAclModel.getSelectedUser( 1 ); repositoryObjectAclModel.unassign( Arrays.asList( new Object[] { user2Acl, selectedUserAcl } ) ); assertEquals( 0, repositoryObjectAclModel.getSelectedAssignedUsers().size() ); assertStringListMatches( defaultUserNameList, repositoryObjectAclModel.getAvailableUserList() ); repositoryObjectAclModel.updateSelectedAcls(); assertEquals( 0, repositoryObjectAclModel.getSelectedAcls().getAcls().size() ); }
public void assignUsers( List<Object> usersToAssign ) { List<UIRepositoryObjectAcl> previousVal = new ArrayList<UIRepositoryObjectAcl>(); previousVal.addAll( getSelectedUserList() ); List<UIRepositoryObjectAcl> assignList = new ArrayList<UIRepositoryObjectAcl>(); for ( Object user : usersToAssign ) { if ( user instanceof String ) assignList.add( assignUser( (String) user ) ); } this.firePropertyChange( "selectedUserList", null, getSelectedUserList() ); setSelectedAssignedUsers( assignList ); setSelectedAvailableUsers( new ArrayList<String>() ); }
UIRepositoryObjectAclModel extends XulEventSourceAdapter implements java.io.Serializable { public void assignUsers( List<Object> usersToAssign ) { List<UIRepositoryObjectAcl> previousVal = new ArrayList<UIRepositoryObjectAcl>(); previousVal.addAll( getSelectedUserList() ); List<UIRepositoryObjectAcl> assignList = new ArrayList<UIRepositoryObjectAcl>(); for ( Object user : usersToAssign ) { if ( user instanceof String ) assignList.add( assignUser( (String) user ) ); } this.firePropertyChange( "selectedUserList", null, getSelectedUserList() ); setSelectedAssignedUsers( assignList ); setSelectedAvailableUsers( new ArrayList<String>() ); } }
UIRepositoryObjectAclModel extends XulEventSourceAdapter implements java.io.Serializable { public void assignUsers( List<Object> usersToAssign ) { List<UIRepositoryObjectAcl> previousVal = new ArrayList<UIRepositoryObjectAcl>(); previousVal.addAll( getSelectedUserList() ); List<UIRepositoryObjectAcl> assignList = new ArrayList<UIRepositoryObjectAcl>(); for ( Object user : usersToAssign ) { if ( user instanceof String ) assignList.add( assignUser( (String) user ) ); } this.firePropertyChange( "selectedUserList", null, getSelectedUserList() ); setSelectedAssignedUsers( assignList ); setSelectedAvailableUsers( new ArrayList<String>() ); } UIRepositoryObjectAclModel( UIRepositoryObjectAcls acls ); }
UIRepositoryObjectAclModel extends XulEventSourceAdapter implements java.io.Serializable { public void assignUsers( List<Object> usersToAssign ) { List<UIRepositoryObjectAcl> previousVal = new ArrayList<UIRepositoryObjectAcl>(); previousVal.addAll( getSelectedUserList() ); List<UIRepositoryObjectAcl> assignList = new ArrayList<UIRepositoryObjectAcl>(); for ( Object user : usersToAssign ) { if ( user instanceof String ) assignList.add( assignUser( (String) user ) ); } this.firePropertyChange( "selectedUserList", null, getSelectedUserList() ); setSelectedAssignedUsers( assignList ); setSelectedAvailableUsers( new ArrayList<String>() ); } UIRepositoryObjectAclModel( UIRepositoryObjectAcls acls ); List<UIRepositoryObjectAcl> getAclsToAdd(); void setAclsToRemove( List<UIRepositoryObjectAcl> aclsToRemove ); List<String> getSelectedAvailableRoles(); void setSelectedAvailableRoles( List<String> selectedAvailableRoles ); void setSelectedAvailableRole( String selectedAvailableRole ); List<String> getSelectedAvailableUsers(); void setSelectedAvailableUsers( List<String> selectedAvailableUsers ); void setSelectedAvailableUser( String selectedAvailableUser ); List<UIRepositoryObjectAcl> getSelectedAssignedRoles(); void setSelectedAssignedRoles( List<UIRepositoryObjectAcl> selectedAssignedRoles ); List<UIRepositoryObjectAcl> getSelectedAssignedUsers(); void setSelectedAssignedUsers( List<UIRepositoryObjectAcl> selectedAssignedUsers ); void setSelectedAssignedUser( UIRepositoryObjectAcl selectedAssignedUser ); List<String> getAvailableUserList(); boolean isUserAssignmentPossible(); void setUserAssignmentPossible( boolean userAssignmentPossible ); boolean isUserUnassignmentPossible(); void setUserUnassignmentPossible( boolean userUnassignmentPossible ); boolean isRoleAssignmentPossible(); void setRoleAssignmentPossible( boolean roleAssignmentPossible ); boolean isRoleUnassignmentPossible(); void setRoleUnassignmentPossible( boolean roleUnassignmentPossible ); void setAclsList( List<String> userList, List<String> roleList ); void setAvailableUserList( List<String> userList ); List<String> getAvailableRoleList(); void setAvailableRoleList( List<String> roleList ); void assignRoles( List<Object> rolesToAssign ); UIRepositoryObjectAcl assignRole( String roleToAssign ); UIRepositoryObjectAcl getAcl( String aclName ); void unassign( List<Object> toUnassign ); void assignUsers( List<Object> usersToAssign ); UIRepositoryObjectAcl assignUser( String userToAssign ); UIRepositoryObjectAcls getSelectedAcls(); void setSelectedAcls( UIRepositoryObjectAcls selectedAcls ); List<UIRepositoryObjectAcl> getSelectedUserList(); List<UIRepositoryObjectAcl> getSelectedRoleList(); String getAvailableUser( int index ); int getAvailableUserIndex( String user ); String getAvailableRole( int index ); int getAvailableRoleIndex( String role ); boolean findByRecipientName( String recipientName ); void clear(); void updateSelectedAcls(); UIRepositoryObjectAcl getSelectedUser( int index ); int getSelectedUserIndex( UIRepositoryObjectAcl user ); UIRepositoryObjectAcl getSelectedRole( int index ); int getSelectedRoleIndex( UIRepositoryObjectAcl role ); }
UIRepositoryObjectAclModel extends XulEventSourceAdapter implements java.io.Serializable { public void assignUsers( List<Object> usersToAssign ) { List<UIRepositoryObjectAcl> previousVal = new ArrayList<UIRepositoryObjectAcl>(); previousVal.addAll( getSelectedUserList() ); List<UIRepositoryObjectAcl> assignList = new ArrayList<UIRepositoryObjectAcl>(); for ( Object user : usersToAssign ) { if ( user instanceof String ) assignList.add( assignUser( (String) user ) ); } this.firePropertyChange( "selectedUserList", null, getSelectedUserList() ); setSelectedAssignedUsers( assignList ); setSelectedAvailableUsers( new ArrayList<String>() ); } UIRepositoryObjectAclModel( UIRepositoryObjectAcls acls ); List<UIRepositoryObjectAcl> getAclsToAdd(); void setAclsToRemove( List<UIRepositoryObjectAcl> aclsToRemove ); List<String> getSelectedAvailableRoles(); void setSelectedAvailableRoles( List<String> selectedAvailableRoles ); void setSelectedAvailableRole( String selectedAvailableRole ); List<String> getSelectedAvailableUsers(); void setSelectedAvailableUsers( List<String> selectedAvailableUsers ); void setSelectedAvailableUser( String selectedAvailableUser ); List<UIRepositoryObjectAcl> getSelectedAssignedRoles(); void setSelectedAssignedRoles( List<UIRepositoryObjectAcl> selectedAssignedRoles ); List<UIRepositoryObjectAcl> getSelectedAssignedUsers(); void setSelectedAssignedUsers( List<UIRepositoryObjectAcl> selectedAssignedUsers ); void setSelectedAssignedUser( UIRepositoryObjectAcl selectedAssignedUser ); List<String> getAvailableUserList(); boolean isUserAssignmentPossible(); void setUserAssignmentPossible( boolean userAssignmentPossible ); boolean isUserUnassignmentPossible(); void setUserUnassignmentPossible( boolean userUnassignmentPossible ); boolean isRoleAssignmentPossible(); void setRoleAssignmentPossible( boolean roleAssignmentPossible ); boolean isRoleUnassignmentPossible(); void setRoleUnassignmentPossible( boolean roleUnassignmentPossible ); void setAclsList( List<String> userList, List<String> roleList ); void setAvailableUserList( List<String> userList ); List<String> getAvailableRoleList(); void setAvailableRoleList( List<String> roleList ); void assignRoles( List<Object> rolesToAssign ); UIRepositoryObjectAcl assignRole( String roleToAssign ); UIRepositoryObjectAcl getAcl( String aclName ); void unassign( List<Object> toUnassign ); void assignUsers( List<Object> usersToAssign ); UIRepositoryObjectAcl assignUser( String userToAssign ); UIRepositoryObjectAcls getSelectedAcls(); void setSelectedAcls( UIRepositoryObjectAcls selectedAcls ); List<UIRepositoryObjectAcl> getSelectedUserList(); List<UIRepositoryObjectAcl> getSelectedRoleList(); String getAvailableUser( int index ); int getAvailableUserIndex( String user ); String getAvailableRole( int index ); int getAvailableRoleIndex( String role ); boolean findByRecipientName( String recipientName ); void clear(); void updateSelectedAcls(); UIRepositoryObjectAcl getSelectedUser( int index ); int getSelectedUserIndex( UIRepositoryObjectAcl user ); UIRepositoryObjectAcl getSelectedRole( int index ); int getSelectedRoleIndex( UIRepositoryObjectAcl role );  }