@Override
    public void deleteClient(@PathParam("organizationId") String organizationId, @PathParam("clientId") String clientId) 
            throws OrganizationNotFoundException, NotAuthorizedException, EntityStillActiveException {
        try {
            if (!securityContext.hasPermission(PermissionType.clientAdmin, organizationId))
                throw ExceptionFactory.notAuthorizedException();

            storage.beginTx();
            ClientBean client = storage.getClient(organizationId, clientId);
            if (client == null) {
                throw ExceptionFactory.clientNotFoundException(clientId);
            }
            Iterator<ClientVersionBean> clientVersions = storage.getAllClientVersions(organizationId, clientId);
            Iterable<ClientVersionBean> iterable = () -> clientVersions;

            List<ClientVersionBean> registeredElems = StreamSupport.stream(iterable.spliterator(), false)
                    .filter(clientVersion -> clientVersion.getStatus() == ClientStatus.Registered)
                    .limit(5)
                    .collect(toList());

            if (!registeredElems.isEmpty()) {
                throw ExceptionFactory.entityStillActiveExceptionClientVersions(registeredElems);
            }

            storage.deleteClient(client);
            storage.commitTx();
            log.debug("Deleted ClientApp: " + client.getName()); //$NON-NLS-1$
        } catch (AbstractRestException e) {
            storage.rollbackTx();
            throw e;
        } catch (Exception e) {
            storage.rollbackTx();
            throw new SystemErrorException(e);
        }
    }
@ Override public void deleteClient ( @ PathParam ( "organizationId" ) String organizationId , @ PathParam ( "clientId" ) String clientId ) throws OrganizationNotFoundException , NotAuthorizedException , EntityStillActiveException { try { if ( ! securityContext . hasPermission ( PermissionType . clientAdmin , organizationId ) ) throw ExceptionFactory . notAuthorizedException ( ) ; storage . beginTx ( ) ; ClientBean client = storage . getClient ( organizationId , clientId ) ; if ( client == null ) { throw ExceptionFactory . clientNotFoundException ( clientId ) ; } Iterator < ClientVersionBean > clientVersions = storage . getAllClientVersions ( organizationId , clientId ) ; Iterable < ClientVersionBean > iterable = ( ) -> clientVersions ; List < ClientVersionBean > registeredElems = StreamSupport . stream ( iterable . spliterator ( ) , false ) . filter ( clientVersion -> clientVersion . getStatus ( ) == ClientStatus . Registered ) . limit ( 5 ) . collect ( toList ( ) ) ; if ( ! registeredElems . isEmpty ( ) ) { throw ExceptionFactory . entityStillActiveExceptionClientVersions ( registeredElems ) ; } storage . deleteClient ( client ) ; storage . commitTx ( ) ; log . debug ( "Deleted ClientApp: " + client . getName ( ) ) ; } catch ( AbstractRestException e ) { storage . rollbackTx ( ) ; throw e ; } catch ( Exception e ) { storage . rollbackTx ( ) ; throw new SystemErrorException ( e ) ; } }
@see io.apiman.manager.api.rest.contract.IOrganizationResource#deleteClient(java.lang.String, java.lang.String)