@Test public void testAssignRoles() { UIRepositoryObjectAcl selectedRoleAcl = new UIRepositoryObjectAcl( createRoleAce( ROLE1 ) ); repositoryObjectAcls.addAcl( selectedRoleAcl ); repositoryObjectAclModel.setAclsList( null, defaultRoleNameList ); List<Object> objectRoleList = Arrays.asList( new Object[] { ROLE2 } ); repositoryObjectAclModel.assignRoles( objectRoleList ); assertStringListMatches( Arrays.asList( new String[] { ROLE3 } ), repositoryObjectAclModel.getAvailableRoleList() ); assertNameToAclListMatches( Arrays.asList( new String[] { ROLE2 } ), repositoryObjectAclModel .getSelectedAssignedRoles() ); assertNameToAclListMatches( Arrays.asList( new String[] { ROLE2 } ), repositoryObjectAclModel.getAclsToAdd() ); repositoryObjectAclModel.updateSelectedAcls(); assertNameToAclListMatches( Arrays.asList( new String[] { ROLE1, ROLE2 } ), repositoryObjectAclModel .getSelectedAcls().getAcls() ); repositoryObjectAclModel.getAclsToAdd().clear(); UIRepositoryObjectAcl role2Acl = repositoryObjectAclModel.getSelectedRole( 1 ); repositoryObjectAclModel.unassign( Arrays.asList( new Object[] { role2Acl, selectedRoleAcl } ) ); assertEquals( 0, repositoryObjectAclModel.getSelectedAssignedRoles().size() ); assertStringListMatches( defaultRoleNameList, repositoryObjectAclModel.getAvailableRoleList() ); repositoryObjectAclModel.updateSelectedAcls(); assertEquals( 0, repositoryObjectAclModel.getSelectedAcls().getAcls().size() ); }
public void assignRoles( List<Object> rolesToAssign ) { List<UIRepositoryObjectAcl> acls = new ArrayList<UIRepositoryObjectAcl>(); for ( Object role : rolesToAssign ) { if ( role instanceof String ) { String roleToAssign = (String) role; acls.add( assignRole( roleToAssign ) ); } } this.firePropertyChange( "selectedRoleList", null, getSelectedRoleList() ); setSelectedAssignedRoles( acls ); setSelectedAvailableRoles( new ArrayList<String>() ); }
UIRepositoryObjectAclModel extends XulEventSourceAdapter implements java.io.Serializable { public void assignRoles( List<Object> rolesToAssign ) { List<UIRepositoryObjectAcl> acls = new ArrayList<UIRepositoryObjectAcl>(); for ( Object role : rolesToAssign ) { if ( role instanceof String ) { String roleToAssign = (String) role; acls.add( assignRole( roleToAssign ) ); } } this.firePropertyChange( "selectedRoleList", null, getSelectedRoleList() ); setSelectedAssignedRoles( acls ); setSelectedAvailableRoles( new ArrayList<String>() ); } }
UIRepositoryObjectAclModel extends XulEventSourceAdapter implements java.io.Serializable { public void assignRoles( List<Object> rolesToAssign ) { List<UIRepositoryObjectAcl> acls = new ArrayList<UIRepositoryObjectAcl>(); for ( Object role : rolesToAssign ) { if ( role instanceof String ) { String roleToAssign = (String) role; acls.add( assignRole( roleToAssign ) ); } } this.firePropertyChange( "selectedRoleList", null, getSelectedRoleList() ); setSelectedAssignedRoles( acls ); setSelectedAvailableRoles( new ArrayList<String>() ); } UIRepositoryObjectAclModel( UIRepositoryObjectAcls acls ); }
UIRepositoryObjectAclModel extends XulEventSourceAdapter implements java.io.Serializable { public void assignRoles( List<Object> rolesToAssign ) { List<UIRepositoryObjectAcl> acls = new ArrayList<UIRepositoryObjectAcl>(); for ( Object role : rolesToAssign ) { if ( role instanceof String ) { String roleToAssign = (String) role; acls.add( assignRole( roleToAssign ) ); } } this.firePropertyChange( "selectedRoleList", null, getSelectedRoleList() ); setSelectedAssignedRoles( acls ); setSelectedAvailableRoles( 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 assignRoles( List<Object> rolesToAssign ) { List<UIRepositoryObjectAcl> acls = new ArrayList<UIRepositoryObjectAcl>(); for ( Object role : rolesToAssign ) { if ( role instanceof String ) { String roleToAssign = (String) role; acls.add( assignRole( roleToAssign ) ); } } this.firePropertyChange( "selectedRoleList", null, getSelectedRoleList() ); setSelectedAssignedRoles( acls ); setSelectedAvailableRoles( 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 );  }