Package org.openwms.common.transport
Interface TransportUnitService
- All Known Implementing Classes:
TransportUnitServiceImpl
public interface TransportUnitService
A TransportService offers functionality to create, read, update and delete
TransportUnit
s. Additionally it defines useful methods regarding the general
handling with TransportUnit
s.- Author:
- Heiko Scherrer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an error to aTransportUnit
.@NotNull TransportUnit
changeTarget
(@NotNull Barcode barcode, @NotBlank String targetLocationId) Change the target of theTransportUnit
identified with itsbarcode
to the Location identified by thetargetLocationId
.@NotNull TransportUnit
create
(@NotBlank String transportUnitBK, @NotBlank String transportUnitType, @NotBlank String actualLocation, Boolean strict) @NotNull TransportUnit
create
(@NotBlank String transportUnitBK, @NotNull TransportUnitType transportUnitType, @NotNull LocationPK actualLocation, Boolean strict) @NotNull TransportUnit
void
Delete aTransportUnit
after requesting all parties for removal.void
deleteTransportUnits
(@NotNull List<TransportUnit> transportUnits) Delete already persistedTransportUnit
s from the persistent storage.@NotNull List
<TransportUnit> findAll()
Find and return all existingTransportUnit
s.@NotNull TransportUnit
findByBarcode
(@NotBlank String transportUnitBK) Find and return aTransportUnit
by it'stransportUnitBK
.@NotNull List
<TransportUnit> findByBarcodes
(@NotEmpty List<Barcode> barcodes) Find and return allTransportUnit
s identified by their particularBarcode
.@NotNull TransportUnit
findByPKey
(@NotBlank String pKey) Find and return aTransportUnit
identified by the givenpKey
.@NotNull List
<TransportUnit> findOnLocation
(@NotBlank String actualLocation) Find and return allTransportUnit
s that are located on theLocation
identified by the givenactualLocation
.@NotNull TransportUnit
moveTransportUnit
(@NotNull Barcode barcode, @NotBlank String targetLocation) Move aTransportUnit
identified by itsBarcode
to theLocation
identified by the giventargetLocationPK
.void
Change the state of aTransportUnit
.void
Trigger a synchronization of TransportUnits.@NotNull TransportUnit
update
(@NotNull Barcode barcode, @Valid @NotNull TransportUnit tu) Take the TransportUnittu
and try to update it as-is in the persistent storage.
-
Method Details
-
create
@NotNull @NotNull TransportUnit create(@NotBlank @NotBlank String transportUnitBK, @NotNull @NotNull TransportUnitType transportUnitType, @NotNull @NotNull LocationPK actualLocation, Boolean strict) Create a newTransportUnit
with the typeTransportUnitType
placed on an initialLocation
. The newTransportUnit
has the givenBarcode
as identifier.- Parameters:
transportUnitBK
- The business identifier of the TransportUnittransportUnitType
- The type of the TransportUnitactualLocation
- The Location where the TransportUnit is placed onstrict
- Whether the implementation shall throw an exception when a TransportUnit already exists (true) or not (false- Returns:
- The newly created instance
-
create
@NotNull @NotNull TransportUnit create(@NotBlank @NotBlank String transportUnitBK, @NotBlank @NotBlank String transportUnitType, @NotBlank @NotBlank String actualLocation, Boolean strict) Create a newTransportUnit
with theTransportUnitType
placed on the givenactualLocation
. The newTransportUnit
has the givenBarcode
as identifier.- Parameters:
transportUnitBK
- The business identifier of the TransportUnit, must not be nulltransportUnitType
- The type of the TransportUnit, must not be nullactualLocation
- The Location where the TransportUnit is placed on, must not be nullstrict
- Whether the implementation shall throw an exception when a TransportUnit already exists (true) or not (false- Returns:
- The newly created instance
- Throws:
org.ameba.exception.ServiceLayerException
- when invalid parameters
-
createNew
@NotNull @NotNull TransportUnit createNew(@NotBlank @NotBlank String transportUnitType, @NotBlank @NotBlank String actualLocation) Create a newTransportUnit
with theTransportUnitType
placed on the givenactualLocation
. The newTransportUnit
has aBarcode
generated by the system.- Parameters:
transportUnitType
- The type of the TransportUnit, must not be nullactualLocation
- The Location where the TransportUnit is placed on, must not be null- Returns:
- The newly created instance
- Throws:
org.ameba.exception.ServiceLayerException
- when invalid parameters
-
update
@NotNull @NotNull TransportUnit update(@NotNull @NotNull Barcode barcode, @Valid @NotNull @Valid @NotNull TransportUnit tu) Take the TransportUnittu
and try to update it as-is in the persistent storage.The implementation does not require any further checks. Assume that it tries to detach the entity class with the persistence context and save the given state.
- Parameters:
barcode
- The business identifier of the TransportUnittu
- The TransportUnit instance to save- Returns:
- The updated instance
-
moveTransportUnit
@NotNull @NotNull TransportUnit moveTransportUnit(@NotNull @NotNull Barcode barcode, @NotBlank @NotBlank String targetLocation) Move aTransportUnit
identified by itsBarcode
to theLocation
identified by the giventargetLocationPK
.- Parameters:
barcode
- The business identifier of the TransportUnittargetLocation
- Unique identifier of the target Location, either the LocationID, ERPCode or PLCCode- Returns:
- The moved instance
-
changeTarget
@NotNull @NotNull TransportUnit changeTarget(@NotNull @NotNull Barcode barcode, @NotBlank @NotBlank String targetLocationId) Change the target of theTransportUnit
identified with itsbarcode
to the Location identified by thetargetLocationId
.- Parameters:
barcode
- The business identifier of the TransportUnittargetLocationId
- The LocationPK or null to reset the current target
-
deleteTransportUnits
Delete already persistedTransportUnit
s from the persistent storage. It is not allowed in every case to delete aTransportUnit
, potentially an activeTransportOrder
could exist or Inventory is still linked with one of thetransportUnit
s.- Parameters:
transportUnits
- A collection ofTransportUnit
s to delete
-
delete
Delete aTransportUnit
after requesting all parties for removal.- Parameters:
pKey
- The persistent key
-
findByBarcode
Find and return aTransportUnit
by it'stransportUnitBK
.- Parameters:
transportUnitBK
- The business identifier of the TransportUnit- Returns:
- The TransportUnit
- Throws:
org.ameba.exception.NotFoundException
- may throw if not found
-
findByBarcodes
Find and return allTransportUnit
s identified by their particularBarcode
.- Parameters:
barcodes
- A list of business identifiers of the TransportUnits- Returns:
- A List of TransportUnits or an empty List, never null
-
findOnLocation
Find and return allTransportUnit
s that are located on theLocation
identified by the givenactualLocation
.- Parameters:
actualLocation
- The Location where the TransportUnits are placed on- Returns:
- All TransportUnits or an empty List, never null
-
findByPKey
Find and return aTransportUnit
identified by the givenpKey
.- Parameters:
pKey
- The persistent key- Returns:
- The instance, never null
- Throws:
org.ameba.exception.NotFoundException
- may throw if not found
-
addError
Add an error to aTransportUnit
.- Parameters:
transportUnitBK
- The business identifier of the TransportUniterrorCode
- The errorCode bitmap
-
findAll
Find and return all existingTransportUnit
s.- Returns:
- a List of all existing or an empty List but never null
-
setState
Change the state of aTransportUnit
.- Parameters:
transportUnitBK
- The business identifier of the TransportUnitstate
- The desired state- Throws:
StateChangeException
- if change is not allowed
-
synchronizeTransportUnits
void synchronizeTransportUnits()Trigger a synchronization of TransportUnits.
-