public class CommodityService extends Object
User: Kirill, Date: 05.08.13 18:00
.Modifier and Type | Field and Description |
---|---|
private Credentials |
credentials |
private Transport |
transport |
private URL |
url |
Constructor and Description |
---|
CommodityService(URL url,
Credentials credentials,
Transport transport)
Constructs the service.
|
Modifier and Type | Method and Description |
---|---|
IdentifierInfo |
create(int version,
CommodityInfo commodityInfo)
Create commodity on the server.
|
void |
delete(int version,
String identifier)
Delete entity from the server.
|
CommodityInfo |
get(Integer version,
String identifier)
Returns an entity.
|
List<CommodityInfo> |
list(Integer version)
Returns list of entities.
|
List<CommodityInfo> |
list(Integer version,
Integer firstResult,
Integer maxResults,
String like,
CommodityInfo.Fields orderBy,
Boolean orderDesc)
Returns list of entities.
|
List<CommodityInfo> |
listAdvanced(Integer version,
Integer firstResult,
Integer maxResults,
String like,
CommodityInfo.Fields orderBy,
Boolean orderDesc)
Returns list of
CommodityAdvancedInfo . |
List<CommodityInfo> |
listDiff(int versionFrom,
int versionTo)
Returns list of item changes between two versions.
|
void |
put(int version,
CommodityInfo commodityInfo)
Put commodity to the server.
|
private URL url
private Credentials credentials
private Transport transport
public CommodityService(URL url, Credentials credentials, Transport transport)
url
- of the servercredentials
- to work with the servertransport
- to know the method to reach the serverpublic CommodityInfo get(Integer version, String identifier)
version
- latest version of seller, may be null (if latest data needed)identifier
- identifies entity. must match to Constraints.WINDOWS_FILENAME_REGEX
VersionConflictJsonException
- if version mismatchNotFoundJsonException
- if entity is not foundpublic void put(int version, CommodityInfo commodityInfo)
version
- expected latest version of sellercommodityInfo
- data to putVersionConflictJsonException
- if version mismatchReferenceNotFoundJsonException
- if category in CommodityInfo.category
is not found
if product in CommodityInfo.product
is not foundpublic IdentifierInfo create(int version, CommodityInfo commodityInfo)
version
- expected latest version of sellercommodityInfo
- data to putVersionConflictJsonException
- if version mismatchReferenceNotFoundJsonException
- if category in CommodityInfo.category
is not found
if product in CommodityInfo.product
is not foundpublic void delete(int version, String identifier)
version
- current seller versionidentifier
- identifies entity. must match to Constraints.WINDOWS_FILENAME_REGEX
VersionConflictJsonException
- if version mismatchpublic List<CommodityInfo> listDiff(int versionFrom, int versionTo)
versionFrom
- version from includedversionTo
- version to includedCommodityInfo.deleted
= true)public List<CommodityInfo> list(Integer version)
version
- version or null if fresh data requiredpublic List<CommodityInfo> list(Integer version, Integer firstResult, Integer maxResults, String like, CommodityInfo.Fields orderBy, Boolean orderDesc)
firstResult
- when pagination starts or nullmaxResults
- amount of items per page or nulllike
- search string filter or nullorderBy
- field to order by, possible values are "IDENTIFIER", "PRODUCT_NAME", "PRODUCT_BARCODE", "PRODUCT_NETTO", "CATEGORY_NAME",
"PRODUCT_SALES_UNIT", "PRODUCT_COUNTED_IN_PRICE"orderDesc
- field to direction of orderingversion
- field to order by, possible values arepublic List<CommodityInfo> listAdvanced(Integer version, Integer firstResult, Integer maxResults, String like, CommodityInfo.Fields orderBy, Boolean orderDesc)
CommodityAdvancedInfo
.firstResult
- when pagination starts or nullmaxResults
- amount of items per page or nulllike
- search string filter or nullorderBy
- field to order by, possible values are "IDENTIFIER", "PRODUCT_NAME", "PRODUCT_BARCODE", "PRODUCT_NETTO", "CATEGORY_NAME",
"PRODUCT_SALES_UNIT", "PRODUCT_COUNTED_IN_PRICE"orderDesc
- field to direction of orderingversion
- field to order by, possible values areCopyright © 2015. All rights reserved.