Package org.openwms.common.location.impl
Class LocationServiceImpl
java.lang.Object
org.openwms.common.location.impl.LocationServiceImpl
- All Implemented Interfaces:
LocationService
A LocationServiceImpl is a Spring managed transactional Service that operates on
Location
entities and spans the tx boundary.- Author:
- Heiko Scherrer
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.springframework.context.ApplicationContext
private final LocationMapper
private static final org.slf4j.Logger
private final LocationRepository
private final ErrorCodeTransformers.LocationStateIn
private final ErrorCodeTransformers.LocationStateOut
private final org.ameba.i18n.Translator
-
Constructor Summary
ConstructorDescriptionLocationServiceImpl
(org.ameba.i18n.Translator translator, LocationMapper locationMapper, LocationRepository repository, ErrorCodeTransformers.LocationStateIn stateInTransformer, ErrorCodeTransformers.LocationStateOut stateOutTransformer, org.springframework.context.ApplicationContext ctx) -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeState
(@NotBlank String pKey, @NotNull ErrorCodeVO errorCode) Change the infeed and outfeed state of aLocation
in respect of the accordingLocationGroup
.void
changeState
(@NotNull LocationPK locationId, @NotNull ErrorCodeVO errorCode) Change the infeed and outfeed state of aLocation
in respect of the accordingLocationGroup
.private void
changeStateInternal
(Location location, ErrorCodeVO errorCode) @NotNull Location
Create a new non-existingLocation
.Find and return all Locations that belong to aLocationGroup
.findByErpCode
(@NotBlank String erpCode) Find and return aLocation
.findByLocationId
(@NotBlank String locationId) Find and return aLocation
.findByLocationIdInternal
(String locationId) @NotNull Location
findByLocationIdOrThrow
(@NotBlank String locationId) Find and return aLocation
.findByLocationPk
(@NotNull LocationPK locationId) Find and return aLocation
.private Location
findByLocationPkOrThrow
(LocationPK locationId) @NotNull Location
findByPKey
(@NotBlank String pKey) Find and return aLocation
.findByPlcCode
(@NotBlank String plcCode) Find and return aLocation
.private Location
findInternal
(String pKey) findLocations
(@NotNull LocationPK locationPK) Find and return allLocation
s that match thelocationIds
whereas the attributes of theLocationPK
may include SQL wildcard operators, like '%', '_'.@NotNull Location
Modify and update an existingLocation
.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
translator
private final org.ameba.i18n.Translator translator -
locationMapper
-
repository
-
stateInTransformer
-
stateOutTransformer
-
ctx
private final org.springframework.context.ApplicationContext ctx
-
-
Constructor Details
-
LocationServiceImpl
LocationServiceImpl(org.ameba.i18n.Translator translator, LocationMapper locationMapper, LocationRepository repository, ErrorCodeTransformers.LocationStateIn stateInTransformer, ErrorCodeTransformers.LocationStateOut stateOutTransformer, org.springframework.context.ApplicationContext ctx)
-
-
Method Details
-
create
@Measured @NotNull public @NotNull Location create(@NotNull @Valid @NotNull @Valid Location location) Create a new non-existingLocation
.- Specified by:
create
in interfaceLocationService
- Parameters:
location
- The representation with the mandatory data to create the Location- Returns:
- The created instance
-
findByPKey
Find and return aLocation
.- Specified by:
findByPKey
in interfaceLocationService
- Parameters:
pKey
- The persistent key- Returns:
- The instance
-
findInternal
-
findByLocationPk
@Measured @Transactional(readOnly=true) public Optional<Location> findByLocationPk(@NotNull @NotNull LocationPK locationId) Find and return aLocation
.- Specified by:
findByLocationPk
in interfaceLocationService
- Parameters:
locationId
- The business key of the Location to search for as String- Returns:
- The Location instance
-
findByLocationPkOrThrow
-
findByPlcCode
@Measured @Transactional(readOnly=true) public Optional<Location> findByPlcCode(@NotBlank @NotBlank String plcCode) Find and return aLocation
.- Specified by:
findByPlcCode
in interfaceLocationService
- Parameters:
plcCode
- The PLC Code of the Location to search for- Returns:
- The Location instance
-
findByLocationId
Find and return aLocation
.- Specified by:
findByLocationId
in interfaceLocationService
- Parameters:
locationId
- The business key of the Location to search for as String- Returns:
- The Location instance
-
findByLocationIdInternal
-
findByLocationIdOrThrow
@Measured @NotNull public @NotNull Location findByLocationIdOrThrow(@NotBlank @NotBlank String locationId) Find and return aLocation
.- Specified by:
findByLocationIdOrThrow
in interfaceLocationService
- Parameters:
locationId
- The business key of the Location to search for as String- Returns:
- The Location instance
-
findAllOf
@Measured @NotNull public @NotNull List<Location> findAllOf(@NotEmpty @NotEmpty List<String> locationGroupNames) Find and return all Locations that belong to aLocationGroup
.- Specified by:
findAllOf
in interfaceLocationService
- Parameters:
locationGroupNames
- The identifying names of the LocationGroups to search Locations for- Returns:
- The LocationGroup instances or an empty list, never null
-
changeState
@Measured public void changeState(@NotBlank @NotBlank String pKey, @NotNull @NotNull ErrorCodeVO errorCode) Change the infeed and outfeed state of aLocation
in respect of the accordingLocationGroup
.- Specified by:
changeState
in interfaceLocationService
- Parameters:
pKey
- The persistent key identifier of the Location to changeerrorCode
- Contains the error bitmap to encode the state
-
changeStateInternal
-
changeState
@Measured public void changeState(@NotNull @NotNull LocationPK locationId, @NotNull @NotNull ErrorCodeVO errorCode) Change the infeed and outfeed state of aLocation
in respect of the accordingLocationGroup
.- Specified by:
changeState
in interfaceLocationService
- Parameters:
locationId
- The business key identifier of the Location to changeerrorCode
- Contains the error bitmap to encode the state
-
findLocations
@Measured @NotNull public @NotNull List<Location> findLocations(@NotNull @NotNull LocationPK locationPK) Find and return allLocation
s that match thelocationIds
whereas the attributes of theLocationPK
may include SQL wildcard operators, like '%', '_'.- Specified by:
findLocations
in interfaceLocationService
- Parameters:
locationPK
- The business keys of the Locations to search for as Strings- Returns:
- The Location instances or an empty list, never null
-
findByErpCode
Find and return aLocation
.- Specified by:
findByErpCode
in interfaceLocationService
- Parameters:
erpCode
- The ERP Code of the Location to search for- Returns:
- The Location instance
-
save
Modify and update an existingLocation
.- Specified by:
save
in interfaceLocationService
- Parameters:
location
- Modified instance- Returns:
- Saved instance
-