private void deleteAllPolicies(OrganizationBean organizationBean, String entityId) throws StorageException { String jpql = "DELETE PolicyBean b " + " WHERE b.organizationId = :orgId "; if (entityId != null) { jpql += String.format("AND b.entityId = '%s'", entityId); } Query query = getActiveEntityManager().createQuery(jpql); query.setParameter("orgId", organizationBean.getId()); }
private void deleteAllMemberships(OrganizationBean organizationBean) throws StorageException { String jpql = "DELETE RoleMembershipBean b " + " WHERE b.organizationId = :orgId "; Query query = getActiveEntityManager().createQuery(jpql); query.setParameter("orgId", organizationBean.getId()); query.executeUpdate(); }
private void deleteAllAuditEntries(OrganizationBean organizationBean, AuditEntityType entityType, String entityId) throws StorageException { String jpql = "DELETE AuditEntryBean b " + " WHERE b.organizationId = :orgId "; if (entityId != null && entityType != null) { jpql += String.format("AND b.entityId = '%s' AND b.entityType = '%s' ", entityId, entityType.name()); } Query query = getActiveEntityManager().createQuery(jpql); query.setParameter("orgId", organizationBean.getId()); query.executeUpdate(); }
public void deleteAllPlans(OrganizationBean organizationBean) throws StorageException { deleteAllPlanVersions(organizationBean); String jpql = "DELETE PlanBean p " + " WHERE p.organization.id = :orgId "; Query query = getActiveEntityManager().createQuery(jpql); query.setParameter("orgId", organizationBean.getId()); query.executeUpdate(); }
/** * @see io.apiman.manager.api.core.IStorage#updateOrganization(io.apiman.manager.api.beans.orgs.OrganizationBean) */ @Override public void updateOrganization(OrganizationBean organization) throws StorageException { updateEntity("organization", organization.getId(), EsMarshalling.marshall(organization)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#createOrganization(io.apiman.manager.api.beans.orgs.OrganizationBean) */ @Override public void createOrganization(OrganizationBean organization) throws StorageException { indexEntity("organization", organization.getId(), EsMarshalling.marshall(organization), true); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#createClient(io.apiman.manager.api.beans.clients.ClientBean) */ @Override public void createClient(ClientBean client) throws StorageException { indexEntity("client", id(client.getOrganization().getId(), client.getId()), EsMarshalling.marshall(client)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#updateClient(io.apiman.manager.api.beans.clients.ClientBean) */ @Override public void updateClient(ClientBean client) throws StorageException { updateEntity("client", id(client.getOrganization().getId(), client.getId()), EsMarshalling.marshall(client)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#updateApi(io.apiman.manager.api.beans.apis.ApiBean) */ @Override public void updateApi(ApiBean api) throws StorageException { updateEntity("api", id(api.getOrganization().getId(), api.getId()), EsMarshalling.marshall(api)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#updatePlan(io.apiman.manager.api.beans.plans.PlanBean) */ @Override public void updatePlan(PlanBean plan) throws StorageException { updateEntity("plan", id(plan.getOrganization().getId(), plan.getId()), EsMarshalling.marshall(plan)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#updateClient(io.apiman.manager.api.beans.clients.ClientBean) */ @Override public void updateClient(ClientBean client) throws StorageException { updateEntity("client", id(client.getOrganization().getId(), client.getId()), EsMarshalling.marshall(client)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#deleteClientVersion(io.apiman.manager.api.beans.clients.ClientVersionBean) */ @Override public void deleteClientVersion(ClientVersionBean version) throws StorageException { ClientBean client = version.getClient(); deleteEntity("clientVersion", id(client.getOrganization().getId(), client.getId(), version.getVersion())); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#deletePlanVersion(io.apiman.manager.api.beans.plans.PlanVersionBean) */ @Override public void deletePlanVersion(PlanVersionBean version) throws StorageException { PlanBean plan = version.getPlan(); deleteEntity("planVersion", id(plan.getOrganization().getId(), plan.getId(), version.getVersion())); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#createPlanVersion(io.apiman.manager.api.beans.plans.PlanVersionBean) */ @Override public void createPlanVersion(PlanVersionBean version) throws StorageException { PlanBean plan = version.getPlan(); String id = id(plan.getOrganization().getId(), plan.getId(), version.getVersion()); indexEntity("planVersion", id, EsMarshalling.marshall(version)); //$NON-NLS-1$ PoliciesBean policies = PoliciesBean.from(PolicyType.Plan, plan.getOrganization().getId(), plan.getId(), version.getVersion()); indexEntity("planPolicies", id, EsMarshalling.marshall(policies)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#createClientVersion(io.apiman.manager.api.beans.clients.ClientVersionBean) */ @Override public void createClientVersion(ClientVersionBean version) throws StorageException { ClientBean client = version.getClient(); String id = id(client.getOrganization().getId(), client.getId(), version.getVersion()); indexEntity("clientVersion", id, EsMarshalling.marshall(version)); //$NON-NLS-1$ PoliciesBean policies = PoliciesBean.from(PolicyType.Client, client.getOrganization().getId(), client.getId(), version.getVersion()); indexEntity("clientPolicies", id, EsMarshalling.marshall(policies)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#createApiVersion(io.apiman.manager.api.beans.apis.ApiVersionBean) */ @Override public void createApiVersion(ApiVersionBean version) throws StorageException { ApiBean api = version.getApi(); String id = id(api.getOrganization().getId(), api.getId(), version.getVersion()); indexEntity("apiVersion", id, EsMarshalling.marshall(version)); //$NON-NLS-1$ PoliciesBean policies = PoliciesBean.from(PolicyType.Api, api.getOrganization().getId(), api.getId(), version.getVersion()); indexEntity("apiPolicies", id, EsMarshalling.marshall(policies)); //$NON-NLS-1$ }
/** * @see io.apiman.manager.api.core.IStorage#updatePlanVersion(io.apiman.manager.api.beans.plans.PlanVersionBean) */ @Override public void updatePlanVersion(PlanVersionBean version) throws StorageException { PlanBean plan = version.getPlan(); updateEntity("planVersion", id(plan.getOrganization().getId(), plan.getId(), version.getVersion()), //$NON-NLS-1$ EsMarshalling.marshall(version)); }
/** * @see io.apiman.manager.api.core.IStorage#updateClientVersion(io.apiman.manager.api.beans.clients.ClientVersionBean) */ @Override public void updateClientVersion(ClientVersionBean version) throws StorageException { ClientBean client = version.getClient(); updateEntity("clientVersion", id(client.getOrganization().getId(), client.getId(), version.getVersion()), //$NON-NLS-1$ EsMarshalling.marshall(version)); }
/** * @see io.apiman.manager.api.core.IStorage#deleteApiVersion(io.apiman.manager.api.beans.apis.ApiVersionBean) */ @Override public void deleteApiVersion(ApiVersionBean version) throws StorageException { deleteApiDefinition(version); ApiBean api = version.getApi(); String id = id(api.getOrganization().getId(), api.getId(), version.getVersion()); deleteEntity("apiVersion", id); //$NON-NLS-1$ deleteEntity("apiPolicies", id); //$NON-NLS-1$ }
/** * @param api */ private ApiVersionBean minifyApi(ApiVersionBean api) { ApiVersionBean rval = new ApiVersionBean(); rval.setVersion(api.getVersion()); rval.setApi(new ApiBean()); rval.getApi().setId(api.getApi().getId()); rval.getApi().setOrganization(new OrganizationBean()); rval.getApi().getOrganization().setId(api.getApi().getOrganization().getId()); return rval; }