/** * @see io.apiman.manager.api.core.IStorage#getApi(java.lang.String, java.lang.String) */ @Override public ApiBean getApi(String organizationId, String id) throws StorageException { return this.delegate.getApi(organizationId, id); }
ApiBean api = storage.getApi(organizationId, apiId); if (api == null) { throw ExceptionFactory.apiNotFoundException(apiId);
ApiBean api = storage.getApi(organizationId, apiId); if (api == null) { throw ExceptionFactory.apiNotFoundException(apiId);
ApiBean api = storage.getApi(organizationId, apiId); if (api == null) { throw ExceptionFactory.apiNotFoundException(apiId);
ApiBean api = storage.getApi(organizationId, apiId); if (api == null) { throw ExceptionFactory.apiNotFoundException(apiId);
/** * @see io.apiman.manager.api.rest.contract.IOrganizationResource#getApi(java.lang.String, java.lang.String) */ @Override public ApiBean getApi(String organizationId, String apiId) throws ApiNotFoundException, NotAuthorizedException { try { storage.beginTx(); ApiBean bean = storage.getApi(organizationId, apiId); if (bean == null) { throw ExceptionFactory.apiNotFoundException(apiId); } storage.commitTx(); return bean; } catch (AbstractRestException e) { storage.rollbackTx(); throw e; } catch (Exception e) { storage.rollbackTx(); throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IOrganizationResource#getApi(java.lang.String, java.lang.String) */ @Override public ApiBean getApi(String organizationId, String apiId) throws ApiNotFoundException, NotAuthorizedException { try { storage.beginTx(); ApiBean bean = storage.getApi(organizationId, apiId); if (bean == null) { throw ExceptionFactory.apiNotFoundException(apiId); } storage.commitTx(); return bean; } catch (AbstractRestException e) { storage.rollbackTx(); throw e; } catch (Exception e) { storage.rollbackTx(); throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IOrganizationResource#updateApi(java.lang.String, java.lang.String, io.apiman.manager.api.beans.apis.UpdateApiBean) */ @Override public void updateApi(String organizationId, String apiId, UpdateApiBean bean) throws ApiNotFoundException, NotAuthorizedException { if (!securityContext.hasPermission(PermissionType.apiEdit, organizationId)) throw ExceptionFactory.notAuthorizedException(); try { storage.beginTx(); ApiBean apiForUpdate = storage.getApi(organizationId, apiId); if (apiForUpdate == null) { throw ExceptionFactory.apiNotFoundException(apiId); } EntityUpdatedData auditData = new EntityUpdatedData(); if (AuditUtils.valueChanged(apiForUpdate.getDescription(), bean.getDescription())) { auditData.addChange("description", apiForUpdate.getDescription(), bean.getDescription()); //$NON-NLS-1$ apiForUpdate.setDescription(bean.getDescription()); } storage.updateApi(apiForUpdate); storage.createAuditEntry(AuditUtils.apiUpdated(apiForUpdate, auditData, securityContext)); storage.commitTx(); } catch (AbstractRestException e) { storage.rollbackTx(); throw e; } catch (Exception e) { storage.rollbackTx(); throw new SystemErrorException(e); } }
/** * @see io.apiman.manager.api.rest.contract.IOrganizationResource#updateApi(java.lang.String, java.lang.String, io.apiman.manager.api.beans.apis.UpdateApiBean) */ @Override public void updateApi(String organizationId, String apiId, UpdateApiBean bean) throws ApiNotFoundException, NotAuthorizedException { if (!securityContext.hasPermission(PermissionType.apiEdit, organizationId)) throw ExceptionFactory.notAuthorizedException(); try { storage.beginTx(); ApiBean apiForUpdate = storage.getApi(organizationId, apiId); if (apiForUpdate == null) { throw ExceptionFactory.apiNotFoundException(apiId); } EntityUpdatedData auditData = new EntityUpdatedData(); if (AuditUtils.valueChanged(apiForUpdate.getDescription(), bean.getDescription())) { auditData.addChange("description", apiForUpdate.getDescription(), bean.getDescription()); //$NON-NLS-1$ apiForUpdate.setDescription(bean.getDescription()); } storage.updateApi(apiForUpdate); storage.createAuditEntry(AuditUtils.apiUpdated(apiForUpdate, auditData, securityContext)); storage.commitTx(); } catch (AbstractRestException e) { storage.rollbackTx(); throw e; } catch (Exception e) { storage.rollbackTx(); throw new SystemErrorException(e); } }
versionBean.setRetiredOn(new Date()); ApiBean api = storage.getApi(action.getOrganizationId(), action.getEntityId()); if (api == null) { throw new PublishingException("Error: could not find API - " + action.getOrganizationId() + "=>" + action.getEntityId()); //$NON-NLS-1$ //$NON-NLS-2$
versionBean.setRetiredOn(new Date()); ApiBean api = storage.getApi(action.getOrganizationId(), action.getEntityId()); if (api == null) { throw new PublishingException("Error: could not find API - " + action.getOrganizationId() + "=>" + action.getEntityId()); //$NON-NLS-1$ //$NON-NLS-2$
throw ExceptionFactory.organizationNotFoundException(organizationId); if (storage.getApi(orgBean.getId(), newApi.getId()) != null) { throw ExceptionFactory.apiAlreadyExistsException(bean.getName());
versionBean.setPublishedOn(new Date()); ApiBean api = storage.getApi(action.getOrganizationId(), action.getEntityId()); if (api == null) { throw new PublishingException("Error: could not find API - " + action.getOrganizationId() + "=>" + action.getEntityId()); //$NON-NLS-1$ //$NON-NLS-2$
versionBean.setPublishedOn(new Date()); ApiBean api = storage.getApi(action.getOrganizationId(), action.getEntityId()); if (api == null) { throw new PublishingException("Error: could not find API - " + action.getOrganizationId() + "=>" + action.getEntityId()); //$NON-NLS-1$ //$NON-NLS-2$
throw ExceptionFactory.organizationNotFoundException(organizationId); if (storage.getApi(orgBean.getId(), newApi.getId()) != null) { throw ExceptionFactory.apiAlreadyExistsException(bean.getName());