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;
}
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);
}
}
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);
}
}
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);
}
}
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;
}
Aggregations