@Test( expected = IllegalArgumentException.class ) public void shouldNotBeAbleToAddNullMappedRole() throws Exception { this.dataRole.addMappedRole( getTransaction(), null ); }
@Override public String[] addMappedRole( final UnitOfWork transaction, final String roleNameToAdd ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); ArgCheck.isNotEmpty( roleNameToAdd, "roleNameToAdd" ); String[] result = null; final String[] current = getMappedRoles( transaction ); int i = 0; if ( current.length == 0 ) { result = new String[ 1 ]; } else { result = new String[ current.length + 1 ]; for ( final String mappedRoleName : current ) { if ( mappedRoleName.equals( roleNameToAdd ) ) { throw new KException( Messages.getString( Relational.DUPLICATE_ROLE_NAME, roleNameToAdd ) ); } result[i++] = mappedRoleName; } } result[i] = roleNameToAdd; setProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES, ( Object[] )result ); return result; }
DataRoleImpl extends RelationalObjectImpl implements DataRole { @Override public String[] addMappedRole( final UnitOfWork transaction, final String roleNameToAdd ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); ArgCheck.isNotEmpty( roleNameToAdd, "roleNameToAdd" ); String[] result = null; final String[] current = getMappedRoles( transaction ); int i = 0; if ( current.length == 0 ) { result = new String[ 1 ]; } else { result = new String[ current.length + 1 ]; for ( final String mappedRoleName : current ) { if ( mappedRoleName.equals( roleNameToAdd ) ) { throw new KException( Messages.getString( Relational.DUPLICATE_ROLE_NAME, roleNameToAdd ) ); } result[i++] = mappedRoleName; } } result[i] = roleNameToAdd; setProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES, ( Object[] )result ); return result; } }
DataRoleImpl extends RelationalObjectImpl implements DataRole { @Override public String[] addMappedRole( final UnitOfWork transaction, final String roleNameToAdd ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); ArgCheck.isNotEmpty( roleNameToAdd, "roleNameToAdd" ); String[] result = null; final String[] current = getMappedRoles( transaction ); int i = 0; if ( current.length == 0 ) { result = new String[ 1 ]; } else { result = new String[ current.length + 1 ]; for ( final String mappedRoleName : current ) { if ( mappedRoleName.equals( roleNameToAdd ) ) { throw new KException( Messages.getString( Relational.DUPLICATE_ROLE_NAME, roleNameToAdd ) ); } result[i++] = mappedRoleName; } } result[i] = roleNameToAdd; setProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES, ( Object[] )result ); return result; } DataRoleImpl( final UnitOfWork uow,
                         final Repository repository,
                         final String workspacePath ); }
DataRoleImpl extends RelationalObjectImpl implements DataRole { @Override public String[] addMappedRole( final UnitOfWork transaction, final String roleNameToAdd ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); ArgCheck.isNotEmpty( roleNameToAdd, "roleNameToAdd" ); String[] result = null; final String[] current = getMappedRoles( transaction ); int i = 0; if ( current.length == 0 ) { result = new String[ 1 ]; } else { result = new String[ current.length + 1 ]; for ( final String mappedRoleName : current ) { if ( mappedRoleName.equals( roleNameToAdd ) ) { throw new KException( Messages.getString( Relational.DUPLICATE_ROLE_NAME, roleNameToAdd ) ); } result[i++] = mappedRoleName; } } result[i] = roleNameToAdd; setProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES, ( Object[] )result ); return result; } DataRoleImpl( final UnitOfWork uow,
                         final Repository repository,
                         final String workspacePath ); @Override KomodoType getTypeIdentifier(UnitOfWork uow); @Override String[] addMappedRole( final UnitOfWork transaction,
                                   final String roleNameToAdd ); @Override Permission addPermission( final UnitOfWork transaction,
                                     final String permissionName ); @Override KomodoObject getChild( final UnitOfWork transaction,
                                  final String name ); @Override KomodoObject getChild( final UnitOfWork transaction,
                                  final String name,
                                  final String typeName ); @Override KomodoObject[] getChildren( final UnitOfWork transaction,
                                       final String... namePatterns ); @Override KomodoObject[] getChildrenOfType( final UnitOfWork transaction,
                                             final String type,
                                             final String... namePatterns ); @Override KomodoType[] getChildTypes(); @Override String getDescription( final UnitOfWork uow ); @Override String[] getMappedRoles( final UnitOfWork transaction,
                                    final String... namePatterns ); @Override Vdb getParent( final UnitOfWork transaction ); @Override Permission[] getPermissions( final UnitOfWork transaction,
                                        final String... namePatterns ); @Override int getTypeId(); @Override boolean hasChild( final UnitOfWork transaction,
                             final String name ); @Override boolean hasChild( final UnitOfWork transaction,
                             final String name,
                             final String typeName ); @Override boolean hasChildren( final UnitOfWork transaction ); @Override boolean isAllowCreateTempTables( final UnitOfWork uow ); @Override boolean isAnyAuthenticated( final UnitOfWork uow ); @Override boolean isGrantAll( final UnitOfWork uow ); @Override String[] removeMappedRole( final UnitOfWork transaction,
                                      final String roleNameToRemove ); @Override void removePermission( final UnitOfWork transaction,
                                  final String permissionToRemove ); @Override void setAllowCreateTempTables( final UnitOfWork uow,
                                          final boolean newAllowCreateTempTables ); @Override void setAnyAuthenticated( final UnitOfWork uow,
                                     final boolean newAnyAuthenticated ); @Override void setDescription( final UnitOfWork uow,
                                final String newDescription ); @Override void setGrantAll( final UnitOfWork uow,
                             final boolean newGrantAll ); }
DataRoleImpl extends RelationalObjectImpl implements DataRole { @Override public String[] addMappedRole( final UnitOfWork transaction, final String roleNameToAdd ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); ArgCheck.isNotEmpty( roleNameToAdd, "roleNameToAdd" ); String[] result = null; final String[] current = getMappedRoles( transaction ); int i = 0; if ( current.length == 0 ) { result = new String[ 1 ]; } else { result = new String[ current.length + 1 ]; for ( final String mappedRoleName : current ) { if ( mappedRoleName.equals( roleNameToAdd ) ) { throw new KException( Messages.getString( Relational.DUPLICATE_ROLE_NAME, roleNameToAdd ) ); } result[i++] = mappedRoleName; } } result[i] = roleNameToAdd; setProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES, ( Object[] )result ); return result; } DataRoleImpl( final UnitOfWork uow,
                         final Repository repository,
                         final String workspacePath ); @Override KomodoType getTypeIdentifier(UnitOfWork uow); @Override String[] addMappedRole( final UnitOfWork transaction,
                                   final String roleNameToAdd ); @Override Permission addPermission( final UnitOfWork transaction,
                                     final String permissionName ); @Override KomodoObject getChild( final UnitOfWork transaction,
                                  final String name ); @Override KomodoObject getChild( final UnitOfWork transaction,
                                  final String name,
                                  final String typeName ); @Override KomodoObject[] getChildren( final UnitOfWork transaction,
                                       final String... namePatterns ); @Override KomodoObject[] getChildrenOfType( final UnitOfWork transaction,
                                             final String type,
                                             final String... namePatterns ); @Override KomodoType[] getChildTypes(); @Override String getDescription( final UnitOfWork uow ); @Override String[] getMappedRoles( final UnitOfWork transaction,
                                    final String... namePatterns ); @Override Vdb getParent( final UnitOfWork transaction ); @Override Permission[] getPermissions( final UnitOfWork transaction,
                                        final String... namePatterns ); @Override int getTypeId(); @Override boolean hasChild( final UnitOfWork transaction,
                             final String name ); @Override boolean hasChild( final UnitOfWork transaction,
                             final String name,
                             final String typeName ); @Override boolean hasChildren( final UnitOfWork transaction ); @Override boolean isAllowCreateTempTables( final UnitOfWork uow ); @Override boolean isAnyAuthenticated( final UnitOfWork uow ); @Override boolean isGrantAll( final UnitOfWork uow ); @Override String[] removeMappedRole( final UnitOfWork transaction,
                                      final String roleNameToRemove ); @Override void removePermission( final UnitOfWork transaction,
                                  final String permissionToRemove ); @Override void setAllowCreateTempTables( final UnitOfWork uow,
                                          final boolean newAllowCreateTempTables ); @Override void setAnyAuthenticated( final UnitOfWork uow,
                                     final boolean newAnyAuthenticated ); @Override void setDescription( final UnitOfWork uow,
                                final String newDescription ); @Override void setGrantAll( final UnitOfWork uow,
                             final boolean newGrantAll );  }