Search in sources :

Example 1 with AuditEntryBean

use of io.apiman.manager.api.beans.audit.AuditEntryBean in project apiman by apiman.

the class EsMarshalling method unmarshallAuditEntry.

/**
 * Unmarshals the given map source into a bean.
 * @param source the source
 * @return the audit entry
 */
public static AuditEntryBean unmarshallAuditEntry(Map<String, Object> source) {
    if (source == null) {
        return null;
    }
    AuditEntryBean bean = new AuditEntryBean();
    bean.setId(asLong(source.get("id")));
    bean.setOrganizationId(asString(source.get("organizationId")));
    bean.setCreatedOn(asDate(source.get("createdOn")));
    bean.setData(asString(source.get("data")));
    bean.setEntityId(asString(source.get("entityId")));
    bean.setEntityType(asEnum(source.get("entityType"), AuditEntityType.class));
    bean.setEntityVersion(asString(source.get("entityVersion")));
    bean.setWhat(asEnum(source.get("what"), AuditEntryType.class));
    bean.setWho(asString(source.get("who")));
    postMarshall(bean);
    return bean;
}
Also used : AuditEntityType(io.apiman.manager.api.beans.audit.AuditEntityType) AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean) AuditEntryType(io.apiman.manager.api.beans.audit.AuditEntryType)

Example 2 with AuditEntryBean

use of io.apiman.manager.api.beans.audit.AuditEntryBean in project apiman by apiman.

the class UserResourceImpl method getActivity.

/**
 * @see IUserResource#getActivity(java.lang.String, int, int)
 */
@Override
public SearchResultsBean<AuditEntryBean> getActivity(String userId, int page, int pageSize) throws NotAuthorizedException {
    securityContext.checkIfUserIsCurrentUser(userId);
    if (page <= 1) {
        page = 1;
    }
    if (pageSize == 0) {
        pageSize = 20;
    }
    try {
        SearchResultsBean<AuditEntryBean> rval;
        PagingBean paging = new PagingBean();
        paging.setPage(page);
        paging.setPageSize(pageSize);
        rval = query.auditUser(userId, paging);
        return rval;
    } catch (StorageException e) {
        throw new SystemErrorException(e);
    }
}
Also used : SystemErrorException(io.apiman.manager.api.rest.exceptions.SystemErrorException) PagingBean(io.apiman.manager.api.beans.search.PagingBean) AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean) StorageException(io.apiman.manager.api.core.exceptions.StorageException)

Example 3 with AuditEntryBean

use of io.apiman.manager.api.beans.audit.AuditEntryBean in project apiman by apiman.

the class OrganizationResourceImpl method getPlanVersionActivity.

/**
 * @see IOrganizationResource#getPlanVersionActivity(java.lang.String, java.lang.String, java.lang.String, int, int)
 */
@Override
public SearchResultsBean<AuditEntryBean> getPlanVersionActivity(String organizationId, String planId, String version, int page, int pageSize) throws PlanVersionNotFoundException, NotAuthorizedException {
    securityContext.checkPermissions(PermissionType.planView, organizationId);
    if (page <= 1) {
        page = 1;
    }
    if (pageSize == 0) {
        pageSize = 20;
    }
    try {
        SearchResultsBean<AuditEntryBean> rval;
        PagingBean paging = new PagingBean();
        paging.setPage(page);
        paging.setPageSize(pageSize);
        rval = query.auditEntity(organizationId, planId, version, PlanBean.class, paging);
        return rval;
    } catch (StorageException e) {
        throw new SystemErrorException(e);
    }
}
Also used : SystemErrorException(io.apiman.manager.api.rest.exceptions.SystemErrorException) PagingBean(io.apiman.manager.api.beans.search.PagingBean) AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean) PlanBean(io.apiman.manager.api.beans.plans.PlanBean) UsagePerPlanBean(io.apiman.manager.api.beans.metrics.UsagePerPlanBean) NewPlanBean(io.apiman.manager.api.beans.plans.NewPlanBean) ApiPlanBean(io.apiman.manager.api.beans.apis.ApiPlanBean) UpdatePlanBean(io.apiman.manager.api.beans.plans.UpdatePlanBean) ResponseStatsPerPlanBean(io.apiman.manager.api.beans.metrics.ResponseStatsPerPlanBean) StorageException(io.apiman.manager.api.core.exceptions.StorageException)

Example 4 with AuditEntryBean

use of io.apiman.manager.api.beans.audit.AuditEntryBean in project apiman by apiman.

the class OrganizationResourceImpl method getPlanActivity.

/**
 * @see IOrganizationResource#getPlanActivity(java.lang.String, java.lang.String, int, int)
 */
@Override
public SearchResultsBean<AuditEntryBean> getPlanActivity(String organizationId, String planId, int page, int pageSize) throws PlanNotFoundException, NotAuthorizedException {
    securityContext.checkPermissions(PermissionType.planView, organizationId);
    if (page <= 1) {
        page = 1;
    }
    if (pageSize == 0) {
        pageSize = 20;
    }
    try {
        SearchResultsBean<AuditEntryBean> rval;
        PagingBean paging = new PagingBean();
        paging.setPage(page);
        paging.setPageSize(pageSize);
        rval = query.auditEntity(organizationId, planId, null, PlanBean.class, paging);
        return rval;
    } catch (StorageException e) {
        throw new SystemErrorException(e);
    }
}
Also used : SystemErrorException(io.apiman.manager.api.rest.exceptions.SystemErrorException) PagingBean(io.apiman.manager.api.beans.search.PagingBean) AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean) PlanBean(io.apiman.manager.api.beans.plans.PlanBean) UsagePerPlanBean(io.apiman.manager.api.beans.metrics.UsagePerPlanBean) NewPlanBean(io.apiman.manager.api.beans.plans.NewPlanBean) ApiPlanBean(io.apiman.manager.api.beans.apis.ApiPlanBean) UpdatePlanBean(io.apiman.manager.api.beans.plans.UpdatePlanBean) ResponseStatsPerPlanBean(io.apiman.manager.api.beans.metrics.ResponseStatsPerPlanBean) StorageException(io.apiman.manager.api.core.exceptions.StorageException)

Example 5 with AuditEntryBean

use of io.apiman.manager.api.beans.audit.AuditEntryBean in project apiman by apiman.

the class AuditUtils method policiesReordered.

/**
 * Called when the user reorders the policies in a API.
 * @param apiVersion the API version
 * @param policyType the policy type
 * @param securityContext the security context
 * @return the audit entry
 */
public static AuditEntryBean policiesReordered(ApiVersionBean apiVersion, PolicyType policyType, ISecurityContext securityContext) {
    AuditEntryBean entry = newEntry(apiVersion.getApi().getOrganization().getId(), AuditEntityType.Api, securityContext);
    entry.setEntityId(apiVersion.getApi().getId());
    entry.setEntityVersion(apiVersion.getVersion());
    entry.setWhat(AuditEntryType.ReorderPolicies);
    return entry;
}
Also used : AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean)

Aggregations

AuditEntryBean (io.apiman.manager.api.beans.audit.AuditEntryBean)47 PagingBean (io.apiman.manager.api.beans.search.PagingBean)8 StorageException (io.apiman.manager.api.core.exceptions.StorageException)8 SystemErrorException (io.apiman.manager.api.rest.exceptions.SystemErrorException)8 ContractData (io.apiman.manager.api.beans.audit.data.ContractData)3 ClientBean (io.apiman.manager.api.beans.clients.ClientBean)3 GatewayAuthenticationException (io.apiman.manager.api.gateway.GatewayAuthenticationException)3 AbstractRestException (io.apiman.manager.api.rest.exceptions.AbstractRestException)3 ApiAlreadyExistsException (io.apiman.manager.api.rest.exceptions.ApiAlreadyExistsException)3 ApiDefinitionNotFoundException (io.apiman.manager.api.rest.exceptions.ApiDefinitionNotFoundException)3 ApiNotFoundException (io.apiman.manager.api.rest.exceptions.ApiNotFoundException)3 ApiVersionAlreadyExistsException (io.apiman.manager.api.rest.exceptions.ApiVersionAlreadyExistsException)3 ApiVersionNotFoundException (io.apiman.manager.api.rest.exceptions.ApiVersionNotFoundException)3 ClientAlreadyExistsException (io.apiman.manager.api.rest.exceptions.ClientAlreadyExistsException)3 ClientNotFoundException (io.apiman.manager.api.rest.exceptions.ClientNotFoundException)3 ClientVersionAlreadyExistsException (io.apiman.manager.api.rest.exceptions.ClientVersionAlreadyExistsException)3 ClientVersionNotFoundException (io.apiman.manager.api.rest.exceptions.ClientVersionNotFoundException)3 ContractAlreadyExistsException (io.apiman.manager.api.rest.exceptions.ContractAlreadyExistsException)3 ContractNotFoundException (io.apiman.manager.api.rest.exceptions.ContractNotFoundException)3 EntityStillActiveException (io.apiman.manager.api.rest.exceptions.EntityStillActiveException)3