io.securecodebox.persistence.defectdojo.service.DefectDojoService Maven / Gradle / Ivy
Show all versions of defectdojo-client Show documentation
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
package io.securecodebox.persistence.defectdojo.service;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.securecodebox.persistence.defectdojo.model.Model;
import lombok.NonNull;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* Basic CRUD interface for DefectDojo REST API
*
* @param Type of model the implementation deals with
*/
public interface DefectDojoService {
/**
* Get a single model object by its id from DefectDojo
*
* TODO: Use Optional here instead of null as return value
*
* @param id must not be less than 1
* @return maybe {@code null}
*/
T get(long id);
/**
* Search for model objects by query parameters (name value pairs) in DefectDojo
*
* @param queryParams not {@code null}
* @return not {@code null}, maybe empty
* @throws URISyntaxException
* @throws JsonProcessingException
*/
List search(@NonNull Map queryParams) throws URISyntaxException, JsonProcessingException;
/**
* Get list of all model objects in DefectDojo
*
* @return never {@code null}, maybe empty
* @throws URISyntaxException
* @throws JsonProcessingException
*/
List search() throws URISyntaxException, JsonProcessingException;
/**
* Search for a single model object in DefectDojo
*
* If multiple objects were found the first one will be returned.
*
*
* @param searchObject not {@code null}
* @return never {@code null}
* @throws URISyntaxException
* @throws JsonProcessingException
*/
Optional searchUnique(@NonNull T searchObject) throws URISyntaxException, JsonProcessingException;
/**
* Search for a single model object in DefectDojo
*
* If multiple objects were found the first one will be returned.
*
*
* @param queryParams not {@code null}
* @return never {@code null}
* @throws URISyntaxException
* @throws JsonProcessingException
*/
Optional searchUnique(@NonNull Map queryParams) throws URISyntaxException, JsonProcessingException;
/**
* Create the given model object in DefectDojo
*
* Use the returned object for further processing because DefectDojo may alter it (e.g. the id).
*
*
* @param object not {@code null}
* @return never {@code null}
*/
T create(@NonNull T object);
/**
* Delete the given model object in DefectDojo identified by its id
*
* @param id must not be less than 1
*/
void delete(long id);
/**
* Update the given model object in DefectDojo identified by its id
*
*
* Use the returned object for further processing because DefectDojo may alter it (e.g. the id).
*
*
* @param object not {@code null}
* @param id must not be less than 1
* @return never {@code null}
*/
T update(@NonNull T object, long id);
}