PermissionImpl extends RelationalObjectImpl implements Permission { @Override public Condition[] getConditions( 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" ); Condition[] result = null; final KomodoObject grouping = getConditionsGroupingNode( transaction ); if ( grouping != null ) { final List< Condition > temp = new ArrayList<>(); for ( final KomodoObject kobject : grouping.getChildrenOfType( transaction, VdbLexicon.DataRole.Permission.Condition.CONDITION, namePatterns ) ) { final Condition condition = new ConditionImpl( transaction, getRepository(), kobject.getAbsolutePath() ); temp.add( condition ); } result = temp.toArray( new Condition[ temp.size() ] ); } else { result = Condition.NO_CONDITIONS; } return result; } 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 );  }
@Test public void shouldNotHaveConditionsAfterConstruction() throws Exception { assertThat( this.permission.getConditions( getTransaction() ), is( notNullValue() ) ); assertThat( this.permission.getConditions( getTransaction() ).length, is( 0 ) ); }