Search in sources :

Example 1 with AuditLogAction

use of jetbrains.buildServer.serverSide.audit.AuditLogAction in project teamcity-rest by JetBrains.

the class Build method getStatusChangeComment.

/**
 * This is a temporary workaround, will be removed in the future versions
 */
@XmlElement
public Comment getStatusChangeComment() {
    return ValueWithDefault.decideDefault(myFields.isIncluded("statusChangeComment", false, false), () -> {
        // can improve the code by requesting only 1 item
        final List<AuditLogAction> logActions = ((BuildPromotionEx) myBuildPromotion).getAuditLogActions(new ActionTypesFilter(ActionType.BUILD_MARKED_AS_FAILED, ActionType.BUILD_MARKED_AS_SUCCESSFUL));
        if (logActions.isEmpty())
            return null;
        // the most recent action
        AuditLogAction action = logActions.get(0);
        return new Comment(action.getComment(), myFields.getNestedField("statusChangeComment", Fields.NONE, Fields.LONG), myBeanContext);
    });
}
Also used : AuditLogAction(jetbrains.buildServer.serverSide.audit.AuditLogAction) ActionTypesFilter(jetbrains.buildServer.serverSide.impl.audit.filters.ActionTypesFilter) XmlElement(javax.xml.bind.annotation.XmlElement)

Example 2 with AuditLogAction

use of jetbrains.buildServer.serverSide.audit.AuditLogAction in project teamcity-rest by JetBrains.

the class AuditRequest method get.

@GET
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get all audit events.", nickname = "getAllAuditEvents")
public AuditEvents get(@ApiParam(format = LocatorName.AUDIT) @QueryParam("locator") String locator, @QueryParam("fields") String fields, @Context UriInfo uriInfo, @Context HttpServletRequest request) {
    AuthorityHelper.checkGlobalPermission(myBeanContext, Permission.VIEW_AUDIT_LOG);
    PagedSearchResult<AuditLogAction> items = myAuditEventFinder.getItems(locator);
    final PagerData pagerData = new PagerData(uriInfo.getRequestUriBuilder(), request.getContextPath(), items, locator, "locator");
    return new AuditEvents(items.myEntries, pagerData, new Fields(fields), myBeanContext);
}
Also used : Fields(jetbrains.buildServer.server.rest.model.Fields) AuditLogAction(jetbrains.buildServer.serverSide.audit.AuditLogAction) PagerData(jetbrains.buildServer.server.rest.model.PagerData) AuditEvents(jetbrains.buildServer.server.rest.model.audit.AuditEvents) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

AuditLogAction (jetbrains.buildServer.serverSide.audit.AuditLogAction)2 ApiOperation (io.swagger.annotations.ApiOperation)1 XmlElement (javax.xml.bind.annotation.XmlElement)1 Fields (jetbrains.buildServer.server.rest.model.Fields)1 PagerData (jetbrains.buildServer.server.rest.model.PagerData)1 AuditEvents (jetbrains.buildServer.server.rest.model.audit.AuditEvents)1 ActionTypesFilter (jetbrains.buildServer.serverSide.impl.audit.filters.ActionTypesFilter)1