Search in sources :

Example 1 with ExistenceModel

use of com.synopsys.integration.alert.common.rest.model.ExistenceModel in project blackduck-alert by blackducksoftware.

the class AbstractUploadAction method uploadFileExists.

public ActionResponse<ExistenceModel> uploadFileExists() {
    if (isTargetUndefined()) {
        return new ActionResponse<>(HttpStatus.INTERNAL_SERVER_ERROR, META_DATA_MISSING);
    }
    if (!authorizationManager.hasUploadReadPermission(target.getContext(), target.getDescriptorKey())) {
        return new ActionResponse<>(HttpStatus.FORBIDDEN, ActionResponse.FORBIDDEN_MESSAGE);
    }
    String targetFilename = target.getFilename();
    Boolean exists = filePersistenceUtil.uploadFileExists(targetFilename);
    ExistenceModel content = new ExistenceModel(exists);
    return new ActionResponse<>(HttpStatus.OK, content);
}
Also used : ExistenceModel(com.synopsys.integration.alert.common.rest.model.ExistenceModel) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse)

Example 2 with ExistenceModel

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

the class AbstractUploadAction method uploadFileExists.

public ActionResponse<ExistenceModel> uploadFileExists() {
    if (isTargetUndefined()) {
        return new ActionResponse<>(HttpStatus.INTERNAL_SERVER_ERROR, META_DATA_MISSING);
    }
    if (!authorizationManager.hasUploadReadPermission(target.getContext(), target.getDescriptorKey())) {
        return new ActionResponse<>(HttpStatus.FORBIDDEN, ActionResponse.FORBIDDEN_MESSAGE);
    }
    String targetFilename = target.getFilename();
    Boolean exists = filePersistenceUtil.uploadFileExists(targetFilename);
    ExistenceModel content = new ExistenceModel(exists);
    return new ActionResponse<>(HttpStatus.OK, content);
}
Also used : ExistenceModel(com.synopsys.integration.alert.common.rest.model.ExistenceModel) ActionResponse(com.synopsys.integration.alert.common.action.ActionResponse)

Aggregations

ActionResponse (com.synopsys.integration.alert.common.action.ActionResponse)2 ExistenceModel (com.synopsys.integration.alert.common.rest.model.ExistenceModel)2