Search in sources :

Example 1 with HttpServletContentWrapper

use of com.synopsys.integration.alert.common.rest.HttpServletContentWrapper in project hub-alert by blackducksoftware.

the class AbstractFunctionController method postConfig.

@PostMapping
public T postConfig(HttpServletRequest httpRequest, HttpServletResponse httpResponse, @RequestBody FieldModel restModel) {
    HttpServletContentWrapper servletContentWrapper = new HttpServletContentWrapper(httpRequest, httpResponse);
    ActionResponse<T> result = functionAction.createResponse(restModel, servletContentWrapper);
    return ResponseFactory.createContentResponseFromAction(result);
}
Also used : HttpServletContentWrapper(com.synopsys.integration.alert.common.rest.HttpServletContentWrapper) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 2 with HttpServletContentWrapper

use of com.synopsys.integration.alert.common.rest.HttpServletContentWrapper in project hub-alert by blackducksoftware.

the class ProcessingSelectCustomFunctionAction method createActionResponse.

@Override
public ActionResponse<LabelValueSelectOptions> createActionResponse(FieldModel fieldModel, HttpServletContentWrapper servletContentWrapper) {
    String channelName = fieldModel.getFieldValue(ChannelDescriptor.KEY_CHANNEL_NAME).orElse("");
    List<LabelValueSelectOption> options = Arrays.stream(ProcessingType.values()).filter(processingType -> this.shouldInclude(processingType, channelName)).map(processingType -> new LabelValueSelectOption(processingType.getLabel(), processingType.name())).collect(Collectors.toList());
    LabelValueSelectOptions optionList = new LabelValueSelectOptions(options);
    return new ActionResponse<>(HttpStatus.OK, optionList);
}
Also used : AuthorizationManager(com.synopsys.integration.alert.common.security.authorization.AuthorizationManager) Arrays(java.util.Arrays) LabelValueSelectOptions(com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions) AlertFieldStatus(com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus) Collection(java.util.Collection) ChannelDescriptor(com.synopsys.integration.alert.common.descriptor.ChannelDescriptor) Set(java.util.Set) Autowired(org.springframework.beans.factory.annotation.Autowired) CustomFunctionAction(com.synopsys.integration.alert.common.action.CustomFunctionAction) Collectors(java.util.stream.Collectors) HttpServletContentWrapper(com.synopsys.integration.alert.common.rest.HttpServletContentWrapper) HttpStatus(org.springframework.http.HttpStatus) LabelValueSelectOption(com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOption) List(java.util.List) Component(org.springframework.stereotype.Component) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse) ProcessingType(com.synopsys.integration.alert.common.enumeration.ProcessingType) FieldModel(com.synopsys.integration.alert.common.rest.model.FieldModel) IssueTrackerChannelKey(com.synopsys.integration.alert.descriptor.api.model.IssueTrackerChannelKey) LabelValueSelectOption(com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOption) LabelValueSelectOptions(com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse)

Aggregations

HttpServletContentWrapper (com.synopsys.integration.alert.common.rest.HttpServletContentWrapper)2 ActionResponse (com.synopsys.integration.alert.common.action.ActionResponse)1 CustomFunctionAction (com.synopsys.integration.alert.common.action.CustomFunctionAction)1 ChannelDescriptor (com.synopsys.integration.alert.common.descriptor.ChannelDescriptor)1 LabelValueSelectOption (com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOption)1 LabelValueSelectOptions (com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions)1 AlertFieldStatus (com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus)1 ProcessingType (com.synopsys.integration.alert.common.enumeration.ProcessingType)1 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)1 AuthorizationManager (com.synopsys.integration.alert.common.security.authorization.AuthorizationManager)1 IssueTrackerChannelKey (com.synopsys.integration.alert.descriptor.api.model.IssueTrackerChannelKey)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 HttpStatus (org.springframework.http.HttpStatus)1 Component (org.springframework.stereotype.Component)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1