public class SellerService extends Object
Modifier and Type | Field and Description |
---|---|
private Credentials |
credentials |
private Transport |
transport |
private URL |
url |
Constructor and Description |
---|
SellerService(URL url,
Credentials credentials,
Transport transport)
Constructs the service.
|
Modifier and Type | Method and Description |
---|---|
void |
deletePicture(int version,
String pictureFilename)
Deletes specified picture.
|
private String |
formatPictureUrl(String pictureFilename,
Integer version) |
SellerInfo |
get(Integer version)
Get latest information about seller from the server.
|
List<SellerModificationInfo> |
getModifications(int versionFrom,
int versionTo)
Gets list of seller modifications.
|
InputStream |
getPicture(Integer version,
String pictureFilename)
Returns body of the picture.
|
InputStream |
getPictureFromHistory(Integer pictureVersion,
String pictureFilename)
Returns body of the picture for particular version number.
|
List<String> |
getPicturePath(Integer version)
Returns list of picture relative paths .
|
SellerStatsInfo |
getStats()
Gets an information about availability of local control units, expiration of activation.
|
SellerVersion |
getThisVersion()
Returns latest version of this seller.
|
SellerVersion |
getThisVersionPublic(String sellerId)
Returns latest version of this public seller.
|
List<PublicSellerInfo> |
list(Integer firstResult,
Integer maxResults,
String like,
PublicSellerInfo.Fields orderBy,
Boolean orderDesc)
Returns list of entities which have publicAccess == true.
|
List<PictureInfo> |
listDiffPicture(int versionFrom,
int versionTo)
Returns list of seller pictures changes between two versions.
|
void |
put(int version,
SellerInfo sellerInfo)
Send information about seller to the server to store it.
|
void |
putPicture(int version,
String pictureFilename,
InputStream picture,
String contentType)
Send picture to the server.
|
void |
remove(String sellerId)
Remove seller and all information that concerns seller.
|
private URL url
private Credentials credentials
private Transport transport
public SellerService(URL url, Credentials credentials, Transport transport)
url
- of the servercredentials
- to work with the servertransport
- to know the method to reach the serverpublic SellerInfo get(Integer version)
version
- put value from getThisVersion()
. if you don't have any SellerInfo
instance, then pass null to return the data anywaySellerServiceSample
public void put(int version, SellerInfo sellerInfo)
sellerInfo
- the dataversion
- put value from getThisVersion()
VersionConflictJsonException
- if server has newer data sent from other client beforeSellerServiceSample
public void remove(String sellerId)
sellerId
- identifier of sellerpublic List<PublicSellerInfo> list(Integer firstResult, Integer maxResults, String like, PublicSellerInfo.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", "name", "vat"orderDesc
- field to direction of orderingpublic SellerVersion getThisVersion()
SellerServiceSample
public SellerVersion getThisVersionPublic(String sellerId)
sellerId
- id of the sellerForbiddenJsonException
- see:
ForbiddenErrorType.INSUFFICIENT_ACCESS_RIGHTS
SellerServiceSample
public SellerStatsInfo getStats()
public List<PictureInfo> listDiffPicture(int versionFrom, int versionTo)
versionFrom
- version from includedversionTo
- version to includedSellerServiceSample
public InputStream getPicture(Integer version, String pictureFilename)
version
- picture version or null if fresh content neededpictureFilename
- just a normal windows filename according to Constraints.WINDOWS_FILENAME_REGEX
NotFoundJsonException
- if image is not foundReferenceNotFoundJsonException
- if seller is not foundSellerServiceSample
public List<String> getPicturePath(Integer version)
version
- picture version or null if fresh content neededReferenceNotFoundJsonException
- if seller is not foundSellerServiceSample
public InputStream getPictureFromHistory(Integer pictureVersion, String pictureFilename)
pictureVersion
- particular version of picturepictureFilename
- just a normal windows filename according to Constraints.WINDOWS_FILENAME_REGEX
NotFoundJsonException
- if image is not foundReferenceNotFoundJsonException
- if seller is not foundSellerServiceSample
public void putPicture(int version, String pictureFilename, InputStream picture, String contentType)
version
- expected latest version of sellerpictureFilename
- picture filename. must match to Constraints.WINDOWS_FILENAME_REGEX
picture
- body of the picture. method doesn't close the streamcontentType
- content type of the imageReferenceNotFoundJsonException
- if seller is not foundVersionConflictJsonException
- if version doesn't match to seller versionSellerServiceSample
public void deletePicture(int version, String pictureFilename)
version
- version of seller, if mismatch VersionConflictJsonException
will be thrownpictureFilename
- picture filename. must match to Constraints.WINDOWS_FILENAME_REGEX
ReferenceNotFoundJsonException
- if seller is not foundVersionConflictJsonException
- if version doesn't match to seller versionSellerServiceSample
public List<SellerModificationInfo> getModifications(int versionFrom, int versionTo)
versionFrom
- version from includedversionTo
- version to includedCopyright © 2016. All rights reserved.