Search in sources :

Example 1 with ProcessFilter

use of com.walmartlabs.concord.server.process.queue.ProcessFilter in project concord by walmartlabs.

the class UserActivityResource method activity.

@GET
@Path("/activity")
@Produces(MediaType.APPLICATION_JSON)
@WithTimer
public UserActivityResponse activity(@QueryParam("maxProjectsPerOrg") @DefaultValue("5") int maxProjectsPerOrg, @QueryParam("maxOwnProcesses") @DefaultValue("5") int maxOwnProcesses) {
    UserPrincipal user = UserPrincipal.assertCurrent();
    Set<UUID> orgIds = userDao.getOrgIds(user.getId());
    OffsetDateTime t = startOfDay();
    Map<String, List<ProjectProcesses>> orgProcesses = processStatsDao.processByOrgs(maxProjectsPerOrg, orgIds, ORG_VISIBLE_STATUSES, t);
    Map<String, Integer> stats = processStatsDao.getCountByStatuses(orgIds, t, user.getId());
    ProcessFilter filter = ProcessFilter.builder().initiator(user.getUsername()).orgIds(orgIds).includeWithoutProject(true).limit(maxOwnProcesses).build();
    List<ProcessEntry> lastProcesses = processDao.list(filter);
    return new UserActivityResponse(stats, orgProcesses, lastProcesses);
}
Also used : ProcessEntry(com.walmartlabs.concord.server.process.ProcessEntry) UserPrincipal(com.walmartlabs.concord.server.security.UserPrincipal) OffsetDateTime(java.time.OffsetDateTime) ProcessFilter(com.walmartlabs.concord.server.process.queue.ProcessFilter) WithTimer(com.walmartlabs.concord.server.sdk.metrics.WithTimer)

Example 2 with ProcessFilter

use of com.walmartlabs.concord.server.process.queue.ProcessFilter in project concord by walmartlabs.

the class ProjectProcessResource method list.

@GET
@ApiOperation("List processes for the specified project")
@Path("/{orgName}/project/{projectName}/process")
@Produces(MediaType.APPLICATION_JSON)
@WithTimer
@Deprecated
public List<ProcessEntry> list(@ApiParam @PathParam("orgName") @ConcordKey String orgName, @ApiParam @PathParam("projectName") @ConcordKey String projectName, @ApiParam @QueryParam("status") ProcessStatus processStatus, @ApiParam @QueryParam("afterCreatedAt") OffsetDateTimeParam afterCreatedAt, @ApiParam @QueryParam("beforeCreatedAt") OffsetDateTimeParam beforeCreatedAt, @ApiParam @QueryParam("limit") @DefaultValue(DEFAULT_LIST_LIMIT) int limit, @ApiParam @QueryParam("offset") @DefaultValue("0") int offset) {
    OrganizationEntry org = orgManager.assertAccess(orgName, false);
    UUID projectId = projectDao.getId(org.getId(), projectName);
    if (projectId == null) {
        throw new ConcordApplicationException("Project not found: " + projectName, Response.Status.NOT_FOUND);
    }
    ProcessFilter filter = ProcessFilter.builder().projectId(projectId).status(processStatus).afterCreatedAt(unwrap(afterCreatedAt)).beforeCreatedAt(unwrap(beforeCreatedAt)).limit(limit).offset(offset).build();
    return queueDao.list(filter);
}
Also used : ConcordApplicationException(com.walmartlabs.concord.server.sdk.ConcordApplicationException) ProcessFilter(com.walmartlabs.concord.server.process.queue.ProcessFilter) WithTimer(com.walmartlabs.concord.server.sdk.metrics.WithTimer) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ProcessFilter (com.walmartlabs.concord.server.process.queue.ProcessFilter)2 WithTimer (com.walmartlabs.concord.server.sdk.metrics.WithTimer)2 ProcessEntry (com.walmartlabs.concord.server.process.ProcessEntry)1 ConcordApplicationException (com.walmartlabs.concord.server.sdk.ConcordApplicationException)1 UserPrincipal (com.walmartlabs.concord.server.security.UserPrincipal)1 ApiOperation (io.swagger.annotations.ApiOperation)1 OffsetDateTime (java.time.OffsetDateTime)1