@Override
    public void deleteApiDefinition(String organizationId, String apiId, String version)
            throws OrganizationNotFoundException, ApiVersionNotFoundException, NotAuthorizedException {
        if (!securityContext.hasPermission(PermissionType.apiEdit, organizationId))
            throw ExceptionFactory.notAuthorizedException();
        try {
            storage.beginTx();
            ApiVersionBean apiVersion = storage.getApiVersion(organizationId, apiId, version);
            if (apiVersion == null) {
                throw ExceptionFactory.apiVersionNotFoundException(apiId, version);
            }
            apiVersion.setDefinitionType(ApiDefinitionType.None);
            apiVersion.setModifiedBy(securityContext.getCurrentUser());
            apiVersion.setModifiedOn(new Date());
            storage.createAuditEntry(AuditUtils.apiDefinitionDeleted(apiVersion, securityContext));
            storage.deleteApiDefinition(apiVersion);
            storage.updateApiVersion(apiVersion);
            storage.commitTx();
            log.debug(String.format("Deleted API %s definition %s", apiId, apiVersion)); //$NON-NLS-1$
        } catch (AbstractRestException e) {
            storage.rollbackTx();
            throw e;
        } catch (Exception e) {
            storage.rollbackTx();
            throw new SystemErrorException(e);
        }
    }
@ Override public void deleteApiDefinition ( String organizationId , String apiId , String version ) throws OrganizationNotFoundException , ApiVersionNotFoundException , NotAuthorizedException { if ( ! securityContext . hasPermission ( PermissionType . apiEdit , organizationId ) ) throw ExceptionFactory . notAuthorizedException ( ) ; try { storage . beginTx ( ) ; ApiVersionBean apiVersion = storage . getApiVersion ( organizationId , apiId , version ) ; if ( apiVersion == null ) { throw ExceptionFactory . apiVersionNotFoundException ( apiId , version ) ; } apiVersion . setDefinitionType ( ApiDefinitionType . None ) ; apiVersion . setModifiedBy ( securityContext . getCurrentUser ( ) ) ; apiVersion . setModifiedOn ( new Date ( ) ) ; storage . createAuditEntry ( AuditUtils . apiDefinitionDeleted ( apiVersion , securityContext ) ) ; storage . deleteApiDefinition ( apiVersion ) ; storage . updateApiVersion ( apiVersion ) ; storage . commitTx ( ) ; log . debug ( String . format ( "Deleted API %s definition %s" , apiId , apiVersion ) ) ; } catch ( AbstractRestException e ) { storage . rollbackTx ( ) ; throw e ; } catch ( Exception e ) { storage . rollbackTx ( ) ; throw new SystemErrorException ( e ) ; } }
@see io.apiman.manager.api.rest.contract.IOrganizationResource#deleteApiDefinition(java.lang.String, java.lang.String, java.lang.String)