Package de.dlr.proseo.ordermgr.rest
Class MissionControllerImpl
java.lang.Object
de.dlr.proseo.ordermgr.rest.MissionControllerImpl
- All Implemented Interfaces:
MissionController
Spring MVC controller for the prosEO Order Manager; implements the services required to manage missions. Handles the HTTP requests
related to mission management.
- Author:
- Ranjitha Vignesh
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) OrdermgrConfigurationThe Order Manager configuration(package private) org.springframework.boot.web.client.RestTemplateBuilderREST template builder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<RestMission> createMission(@Valid RestMission mission) Creates a new mission with the provided data.org.springframework.http.ResponseEntity<?> deleteMissionById(Long id, Boolean force, Boolean deleteProducts) Delete a mission by ID.org.springframework.http.ResponseEntity<RestMission> getMissionById(Long id) Retrieves the mission with the specified ID.org.springframework.http.ResponseEntity<List<RestMission>> getMissions(String missionCode) Retrieves a list of all missions or a mission with a specific code.org.springframework.http.ResponseEntity<RestMission> modifyMission(Long id, @Valid RestMission mission) Updates the mission with the specified ID using the attribute values of the given JSON object.
-
Field Details
-
orderManagerConfig
The Order Manager configuration -
rtb
@Autowired org.springframework.boot.web.client.RestTemplateBuilder rtbREST template builder
-
-
Constructor Details
-
MissionControllerImpl
public MissionControllerImpl()
-
-
Method Details
-
getMissions
Retrieves a list of all missions or a mission with a specific code.- Specified by:
getMissionsin interfaceMissionController- Parameters:
missionCode- The code of the mission to retrieve.- Returns:
- A response entity with either a list of missions and HTTP status OK or an error message and an HTTP status indicating failure.
-
createMission
public org.springframework.http.ResponseEntity<RestMission> createMission(@Valid @Valid RestMission mission) throws IllegalArgumentException Creates a new mission with the provided data.- Specified by:
createMissionin interfaceMissionController- Parameters:
mission- The JSON object representing the mission to be created.- Returns:
- A response entity containing the JSON object corresponding to the created mission (with ID and version for all contained objects) and HTTP status "CREATED" or an error message and an HTTP status indicating failure.
- Throws:
IllegalArgumentException- If any of the input data is invalid.
-
getMissionById
Retrieves the mission with the specified ID.- Specified by:
getMissionByIdin interfaceMissionController- Parameters:
id- The ID of the mission to retrieve.- Returns:
- A response entity corresponding to the found mission and HTTP status "OK", or an error message and HTTP status "NOT_FOUND" if no mission with the given ID exists.
-
modifyMission
public org.springframework.http.ResponseEntity<RestMission> modifyMission(Long id, @Valid @Valid RestMission mission) Updates the mission with the specified ID using the attribute values of the given JSON object.- Specified by:
modifyMissionin interfaceMissionController- Parameters:
id- The ID of the mission to update.mission- A JSON object containing the modified (and unmodified) attributes.- Returns:
- A response entity containing a JSON object corresponding to the mission after modification (with ID and version for all contained objects) and HTTP status "OK", or HTTP status "FORBIDDEN" and an error message if a cross-mission data access was attempted, or HTTP status "NOT_FOUND" and an error message if no mission with the given ID exists.
-
deleteMissionById
public org.springframework.http.ResponseEntity<?> deleteMissionById(Long id, Boolean force, Boolean deleteProducts) Delete a mission by ID.- Specified by:
deleteMissionByIdin interfaceMissionController- Parameters:
id- the ID of the mission to deleteforce- flag whether to also delete all configured items (but not products)deleteProducts- flag whether to also delete all stored products (also from all processing facilities, requires "force")- Returns:
- a response entity with HTTP status "NO_CONTENT", if the deletion was successful, "BAD_REQUEST" if "deleteProducts" was specified without "force" or if dependent objects exist for the mission, "NOT_FOUND" if the mission did not exist, or "NOT_MODIFIED" if the deletion was unsuccessful
-