@Test public void shouldNotHaveMappedRolesAfterConstruction() throws Exception { assertThat( this.dataRole.getMappedRoles( getTransaction() ), is( notNullValue() ) ); assertThat( this.dataRole.getMappedRoles( getTransaction() ).length, is( 0 ) ); }
@Override public String[] getMappedRoles( final UnitOfWork transaction, final String... namePatterns ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); final Property property = getProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES ); if ( property == null ) { return StringConstants.EMPTY_ARRAY; } final boolean matchPattern = ( ( namePatterns != null ) && ( namePatterns.length != 0 ) ); final List< String > roleNames = new ArrayList< >(); for ( final String value : property.getStringValues( transaction ) ) { if ( matchPattern ) { for ( final String pattern : namePatterns ) { final String regex = pattern.replace( "*", ".*" ); if ( value.matches( regex ) ) { roleNames.add( value ); } } } else { roleNames.add( value ); } } return roleNames.toArray( new String[ roleNames.size() ] ); }
DataRoleImpl extends RelationalObjectImpl implements DataRole { @Override public String[] getMappedRoles( final UnitOfWork transaction, final String... namePatterns ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); final Property property = getProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES ); if ( property == null ) { return StringConstants.EMPTY_ARRAY; } final boolean matchPattern = ( ( namePatterns != null ) && ( namePatterns.length != 0 ) ); final List< String > roleNames = new ArrayList< >(); for ( final String value : property.getStringValues( transaction ) ) { if ( matchPattern ) { for ( final String pattern : namePatterns ) { final String regex = pattern.replace( "*", ".*" ); if ( value.matches( regex ) ) { roleNames.add( value ); } } } else { roleNames.add( value ); } } return roleNames.toArray( new String[ roleNames.size() ] ); } }
DataRoleImpl extends RelationalObjectImpl implements DataRole { @Override public String[] getMappedRoles( final UnitOfWork transaction, final String... namePatterns ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); final Property property = getProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES ); if ( property == null ) { return StringConstants.EMPTY_ARRAY; } final boolean matchPattern = ( ( namePatterns != null ) && ( namePatterns.length != 0 ) ); final List< String > roleNames = new ArrayList< >(); for ( final String value : property.getStringValues( transaction ) ) { if ( matchPattern ) { for ( final String pattern : namePatterns ) { final String regex = pattern.replace( "*", ".*" ); if ( value.matches( regex ) ) { roleNames.add( value ); } } } else { roleNames.add( value ); } } return roleNames.toArray( new String[ roleNames.size() ] ); } DataRoleImpl( final UnitOfWork uow,
                         final Repository repository,
                         final String workspacePath ); }
DataRoleImpl extends RelationalObjectImpl implements DataRole { @Override public String[] getMappedRoles( final UnitOfWork transaction, final String... namePatterns ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); final Property property = getProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES ); if ( property == null ) { return StringConstants.EMPTY_ARRAY; } final boolean matchPattern = ( ( namePatterns != null ) && ( namePatterns.length != 0 ) ); final List< String > roleNames = new ArrayList< >(); for ( final String value : property.getStringValues( transaction ) ) { if ( matchPattern ) { for ( final String pattern : namePatterns ) { final String regex = pattern.replace( "*", ".*" ); if ( value.matches( regex ) ) { roleNames.add( value ); } } } else { roleNames.add( value ); } } return roleNames.toArray( new String[ roleNames.size() ] ); } 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[] getMappedRoles( final UnitOfWork transaction, final String... namePatterns ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state is not NOT_STARTED" ); final Property property = getProperty( transaction, VdbLexicon.DataRole.MAPPED_ROLE_NAMES ); if ( property == null ) { return StringConstants.EMPTY_ARRAY; } final boolean matchPattern = ( ( namePatterns != null ) && ( namePatterns.length != 0 ) ); final List< String > roleNames = new ArrayList< >(); for ( final String value : property.getStringValues( transaction ) ) { if ( matchPattern ) { for ( final String pattern : namePatterns ) { final String regex = pattern.replace( "*", ".*" ); if ( value.matches( regex ) ) { roleNames.add( value ); } } } else { roleNames.add( value ); } } return roleNames.toArray( new String[ roleNames.size() ] ); } 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 );  }