@Test( expected = KException.class ) public void shouldFailWhenChildNotFound() throws Exception { this.permission.getChild( getTransaction(), "bogus" ); }
@Override public KomodoObject getChild( final UnitOfWork transaction, final String name ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state must be NOT_STARTED" ); ArgCheck.isNotEmpty( name, "name" ); KomodoObject[] matches = getConditions( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } matches = getMasks( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } throw new KException( Messages.getString( org.komodo.repository.Messages.Komodo.CHILD_NOT_FOUND, name, getAbsolutePath() ) ); }
PermissionImpl extends RelationalObjectImpl implements Permission { @Override public KomodoObject getChild( final UnitOfWork transaction, final String name ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state must be NOT_STARTED" ); ArgCheck.isNotEmpty( name, "name" ); KomodoObject[] matches = getConditions( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } matches = getMasks( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } throw new KException( Messages.getString( org.komodo.repository.Messages.Komodo.CHILD_NOT_FOUND, name, getAbsolutePath() ) ); } }
PermissionImpl extends RelationalObjectImpl implements Permission { @Override public KomodoObject getChild( final UnitOfWork transaction, final String name ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state must be NOT_STARTED" ); ArgCheck.isNotEmpty( name, "name" ); KomodoObject[] matches = getConditions( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } matches = getMasks( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } throw new KException( Messages.getString( org.komodo.repository.Messages.Komodo.CHILD_NOT_FOUND, name, getAbsolutePath() ) ); } PermissionImpl( final UnitOfWork uow,
                           final Repository repository,
                           final String workspacePath ); }
PermissionImpl extends RelationalObjectImpl implements Permission { @Override public KomodoObject getChild( final UnitOfWork transaction, final String name ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state must be NOT_STARTED" ); ArgCheck.isNotEmpty( name, "name" ); KomodoObject[] matches = getConditions( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } matches = getMasks( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } throw new KException( Messages.getString( org.komodo.repository.Messages.Komodo.CHILD_NOT_FOUND, name, getAbsolutePath() ) ); } PermissionImpl( final UnitOfWork uow,
                           final Repository repository,
                           final String workspacePath ); @Override KomodoType getTypeIdentifier(UnitOfWork uow); @Override Condition addCondition( final UnitOfWork transaction,
                                   final String conditionName ); @Override Mask addMask( final UnitOfWork transaction,
                         final String maskName ); @Override KomodoObject getChild( final UnitOfWork transaction,
                                  final String name ); @Override KomodoObject getChild( final UnitOfWork transaction,
                                  final String name,
                                  final String typeName ); @Override KomodoType[] getChildTypes(); @Override KomodoObject[] getChildren( final UnitOfWork transaction,
                                       final String... namePatterns ); @Override KomodoObject[] getChildrenOfType( final UnitOfWork transaction,
                                             final String type,
                                             final String... namePatterns ); @Override Condition[] getConditions( final UnitOfWork transaction,
                                      final String... namePatterns ); @Override Mask[] getMasks( final UnitOfWork transaction,
                            final String... namePatterns ); @Override DataRole getParent( final UnitOfWork transaction ); @Override String getResourceName( final UnitOfWork transaction ); @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( UnitOfWork transaction ); @Override boolean isAllowAlter( final UnitOfWork uow ); @Override boolean isAllowCreate( final UnitOfWork uow ); @Override boolean isAllowDelete( final UnitOfWork uow ); @Override boolean isAllowExecute( final UnitOfWork uow ); @Override boolean isAllowLanguage( final UnitOfWork uow ); @Override boolean isAllowRead( final UnitOfWork uow ); @Override boolean isAllowUpdate( final UnitOfWork uow ); @Override void removeCondition( final UnitOfWork transaction,
                                 final String conditionToRemove ); @Override void removeMask( final UnitOfWork transaction,
                            final String maskToRemove ); @Override void setAllowAlter( final UnitOfWork uow,
                               final boolean newAllowAlter ); @Override void setAllowCreate( final UnitOfWork uow,
                                final boolean newAllowCreate ); @Override void setAllowDelete( final UnitOfWork uow,
                                final boolean newAllowDelete ); @Override void setAllowExecute( final UnitOfWork uow,
                                 final boolean newAllowExecute ); @Override void setAllowLanguage( final UnitOfWork uow,
                                  final boolean newAllowLanguage ); @Override void setAllowRead( final UnitOfWork uow,
                              final boolean newAllowRead ); @Override void setAllowUpdate( final UnitOfWork uow,
                                final boolean newAllowUpdate ); }
PermissionImpl extends RelationalObjectImpl implements Permission { @Override public KomodoObject getChild( final UnitOfWork transaction, final String name ) throws KException { ArgCheck.isNotNull( transaction, "transaction" ); ArgCheck.isTrue( ( transaction.getState() == State.NOT_STARTED ), "transaction state must be NOT_STARTED" ); ArgCheck.isNotEmpty( name, "name" ); KomodoObject[] matches = getConditions( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } matches = getMasks( transaction, name ); if ( matches.length != 0 ) { return matches[ 0 ]; } throw new KException( Messages.getString( org.komodo.repository.Messages.Komodo.CHILD_NOT_FOUND, name, getAbsolutePath() ) ); } PermissionImpl( final UnitOfWork uow,
                           final Repository repository,
                           final String workspacePath ); @Override KomodoType getTypeIdentifier(UnitOfWork uow); @Override Condition addCondition( final UnitOfWork transaction,
                                   final String conditionName ); @Override Mask addMask( final UnitOfWork transaction,
                         final String maskName ); @Override KomodoObject getChild( final UnitOfWork transaction,
                                  final String name ); @Override KomodoObject getChild( final UnitOfWork transaction,
                                  final String name,
                                  final String typeName ); @Override KomodoType[] getChildTypes(); @Override KomodoObject[] getChildren( final UnitOfWork transaction,
                                       final String... namePatterns ); @Override KomodoObject[] getChildrenOfType( final UnitOfWork transaction,
                                             final String type,
                                             final String... namePatterns ); @Override Condition[] getConditions( final UnitOfWork transaction,
                                      final String... namePatterns ); @Override Mask[] getMasks( final UnitOfWork transaction,
                            final String... namePatterns ); @Override DataRole getParent( final UnitOfWork transaction ); @Override String getResourceName( final UnitOfWork transaction ); @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( UnitOfWork transaction ); @Override boolean isAllowAlter( final UnitOfWork uow ); @Override boolean isAllowCreate( final UnitOfWork uow ); @Override boolean isAllowDelete( final UnitOfWork uow ); @Override boolean isAllowExecute( final UnitOfWork uow ); @Override boolean isAllowLanguage( final UnitOfWork uow ); @Override boolean isAllowRead( final UnitOfWork uow ); @Override boolean isAllowUpdate( final UnitOfWork uow ); @Override void removeCondition( final UnitOfWork transaction,
                                 final String conditionToRemove ); @Override void removeMask( final UnitOfWork transaction,
                            final String maskToRemove ); @Override void setAllowAlter( final UnitOfWork uow,
                               final boolean newAllowAlter ); @Override void setAllowCreate( final UnitOfWork uow,
                                final boolean newAllowCreate ); @Override void setAllowDelete( final UnitOfWork uow,
                                final boolean newAllowDelete ); @Override void setAllowExecute( final UnitOfWork uow,
                                 final boolean newAllowExecute ); @Override void setAllowLanguage( final UnitOfWork uow,
                                  final boolean newAllowLanguage ); @Override void setAllowRead( final UnitOfWork uow,
                              final boolean newAllowRead ); @Override void setAllowUpdate( final UnitOfWork uow,
                                final boolean newAllowUpdate );  }