Package org.openwms.common.location.api
Interface LocationApi
@FeignClient(name="common-service",
dismiss404=true,
qualifiers="locationApi")
public interface LocationApi
A LocationApi defines the public REST API to manage
Location
s. It is a Feign remote stub that can be used by client application.- Author:
- Heiko Scherrer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
changeState
(String pKey, String op, ErrorCodeVO errorCode) Change the state of aLocation
.void
changeState
(String locationId, ErrorCodeVO errorCode) Change the state of aLocation
.void
changeState
(String erpCode, LockType type, LockMode mode, Integer plcState) Change the currentmode
aLocation
, identified byerpCode
.createLocation
(LocationVO location) Create a newLocation
.findAll()
Find and return allLocationTypes
.Find and return allLocation
s that match the given criteria expressed by area/aisle/x/y/z.findByErpCode
(String erpCode) Find and return aLocation
representation by the givenerpCode
.Find and return aLocation
.findByPKey
(String pKey) Find and return aLocation
.findByPlcCode
(String plcCode) Find and return aLocation
representation by the givenplcCode
.findForLocationGroups
(List<String> locationGroupNames) Find and return allLocation
s that belong to one or moreLocationGroup
s identified by theirlocationGroupNames
.updateLocation
(LocationVO location) Save a modifiedLocation
.
-
Method Details
-
createLocation
@PostMapping(value="/v1/locations", produces="application/vnd.openwms.common.location-v1+json") @CacheEvict(cacheNames="locations", allEntries=true) LocationVO createLocation(@RequestBody LocationVO location) Create a newLocation
.- Parameters:
location
- The representation of the Location to create- Returns:
- The created instance
-
updateLocation
@PutMapping(value="/v1/locations", produces="application/vnd.openwms.common.location-v1+json") @CacheEvict(cacheNames="locations", allEntries=true) LocationVO updateLocation(@RequestBody LocationVO location) Save a modifiedLocation
.- Parameters:
location
- The representation of the modified Location to save- Returns:
- The updated and saved instance
-
findByPKey
@GetMapping(value="/v1/locations/{pKey}", produces="application/vnd.openwms.common.location-opt-v1+json") @Cacheable("locations") Optional<LocationVO> findByPKey(@PathVariable("pKey") String pKey) Find and return aLocation
.- Parameters:
pKey
- The persistent key- Returns:
- The instance
-
findAll
@GetMapping(value="/v1/location-types", produces="application/vnd.openwms.common.location-v1+json") @Cacheable("locations") List<LocationTypeVO> findAll()Find and return allLocationTypes
.- Returns:
- Never null
-
findById
@GetMapping(value="/v1/locations", params="locationId", produces="application/vnd.openwms.common.location-opt-v1+json") @Cacheable("locations") Optional<LocationVO> findById(@RequestParam("locationId") String locationId) Find and return aLocation
.- Parameters:
locationId
- The business key of the Location- Returns:
- Never null
- Throws:
IllegalArgumentException
- in case the given locationPK is invalid
-
findByPlcCode
@GetMapping(value="/v1/locations", params="plcCode", produces="application/vnd.openwms.common.location-opt-v1+json") @Cacheable("locations") Optional<LocationVO> findByPlcCode(@RequestParam("plcCode") String plcCode) Find and return aLocation
representation by the givenplcCode
.- Parameters:
plcCode
- The PLC code- Returns:
- Never null
-
findByErpCode
@GetMapping(value="/v1/locations", params="erpCode", produces="application/vnd.openwms.common.location-opt-v1+json") @Cacheable("locations") Optional<LocationVO> findByErpCode(@RequestParam("erpCode") String erpCode) Find and return aLocation
representation by the givenerpCode
.- Parameters:
erpCode
- The ERP code- Returns:
- Never null
-
findForLocationGroups
@GetMapping(value="/v1/locations", params="locationGroupNames", produces="application/vnd.openwms.common.location-v1+json") @Cacheable("locations") List<LocationVO> findForLocationGroups(@RequestParam("locationGroupNames") List<String> locationGroupNames) Find and return allLocation
s that belong to one or moreLocationGroup
s identified by theirlocationGroupNames
.- Parameters:
locationGroupNames
- A list of LocationGroup names- Returns:
- All Location instances or an empty list
-
changeState
@PatchMapping(value="/v1/location/{pKey}", params="op=change-state") @CacheEvict(cacheNames="locations", allEntries=true) void changeState(@PathVariable(name="pKey") String pKey, @RequestParam(name="op") String op, @RequestBody ErrorCodeVO errorCode) Change the state of aLocation
.- Parameters:
pKey
- The persistent key of the LocationerrorCode
- The decoded state
-
changeState
@PatchMapping(value="/v1/location", params={"locationId","op=change-state"}) @CacheEvict(cacheNames="locations", allEntries=true) void changeState(@RequestParam(name="locationId") String locationId, @RequestBody ErrorCodeVO errorCode) Change the state of aLocation
.- Parameters:
locationId
- The business key of the LocationerrorCode
- The decoded state
-
changeState
@PostMapping(path="/v1/locations", params={"erpCode","type!=PERMANENT_LOCK","mode"}) @CacheEvict(cacheNames="locations", allEntries=true) void changeState(@RequestParam("erpCode") String erpCode, @RequestParam("type") LockType type, @RequestParam("mode") LockMode mode, @RequestParam(value="plcState",required=false) Integer plcState) Change the currentmode
aLocation
, identified byerpCode
.- Parameters:
erpCode
- The ERP code of the Locationtype
- The type of lock to apply to the Locationmode
- The mode to apply to the Locations lock
-
findByCoordinate
@GetMapping(value="/v1/locations", params={"area","aisle","x","y","z"}, produces="application/vnd.openwms.common.location-v1+json") @Cacheable("locations") List<LocationVO> findByCoordinate(@RequestParam(value="area",required=false) String area, @RequestParam(value="aisle",required=false) String aisle, @RequestParam(value="x",required=false) String x, @RequestParam(value="y",required=false) String y, @RequestParam(value="z",required=false) String z) Find and return allLocation
s that match the given criteria expressed by area/aisle/x/y/z. Supported wildcards in coordinates:%,_
.- Parameters:
area
- The Area to search foraisle
- The Aisle to search forx
- The X to search for ory
- The Y to search for orz
- The Z to search for or- Returns:
- All Location instances or an empty list
-