|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.netmera.mobile.NetmeraService
public class NetmeraService
NetmeraService is used to get NetmeraContent object by its search()
and get() methods. Many query options defined to help finding exact object.
| Nested Class Summary | |
|---|---|
static class |
NetmeraService.SortBy
|
static class |
NetmeraService.SortOrder
Sort order definitions |
| Constructor Summary | |
|---|---|
NetmeraService(java.lang.String objectName)
Default constructor for the NetmeraService that sets objectName and other default parameters. |
|
| Method Summary | ||
|---|---|---|
NetmeraService |
addSearchText(java.lang.String searchText)
Adds the searchText into the query. |
|
java.util.List<NetmeraContent> |
boxSearch(NetmeraGeoLocation firstPoint,
NetmeraGeoLocation secondPoint,
java.lang.String locationSearchField)
Creates box using the given two location (latitude,longitude) data and searches inside that box. |
|
void |
boxSearchInBackground(NetmeraGeoLocation firstPoint,
NetmeraGeoLocation secondPoint,
java.lang.String locationSearchField,
NetmeraCallback<java.util.List<NetmeraContent>> callback)
Creates box using the given two location (latitude,longitude) data and searches inside that box in the background thread.Since it runs on the background thread it does not block program.It is recommended over boxSearch() method. |
|
java.util.List<NetmeraContent> |
circleSearch(NetmeraGeoLocation startLocation,
double distance,
java.lang.String locationSearchField)
Searches the content by taking given location as a base and retrieves the contents that located given distance far away. |
|
void |
circleSearchInBackground(NetmeraGeoLocation startLocation,
double distance,
java.lang.String locationSearchField,
NetmeraCallback<java.util.List<NetmeraContent>> callback)
Searches the content by taking given location as a base and retrieves the contents that located given distance far away in the background thread.Since it runs on the background thread it does not block program.It is recommended over circleSearch() method. |
|
long |
count()
Gets the total number of results that matches the query. |
|
void |
countInBackground(NetmeraCallback<java.lang.Long> callback)
Gets the total number of results that match the query in the background thread.Since it runs on the background thread it does not block program.It is recommended over count() method. |
|
void |
deleteCacheResults()
Deletes everything from the cache |
|
NetmeraContent |
get()
Gets the single NetmeraContent object with the given path.Path of
the content can be setted using the setPath() method. |
|
|
get(java.lang.Class<T> classOfT)
Gets a single content and maps it to your model object. |
|
NetmeraCache.CacheType |
getCacheType()
Gets the defined cache type. |
|
java.util.List<NetmeraContent> |
getContents(java.util.List<java.lang.String> pathList)
Gets the list of NetmeraContent objects with the given path
list.If there is no matched content for the given path list, it returns
empty list. |
|
void |
getContentsInBackground(java.util.List<java.lang.String> pathList,
NetmeraCallback<java.util.List<NetmeraContent>> callback)
Gets the list of NetmeraContent objects with the given path list
in the background thread.If there is no matched content for the given
path list, it returns empty list.Since it runs on the background thread
it does not block program.It is recommended over getContents() method. |
|
|
getInBackground(java.lang.Class<T> classOfT,
NetmeraCallback<T> callback)
Gets a single content in background and maps it to your model object. |
|
void |
getInBackground(NetmeraCallback<NetmeraContent> callback)
Gets the single NetmeraContent object that matches the query in
the background thread.Since it runs on the background thread it does not
block program.It is recommended over get() method. |
|
long |
getMaxCacheAge()
Use to get max cache age field. |
|
static NetmeraService |
getNetmeraUserService()
It creates the NetmeraUser service object. |
|
java.lang.String |
getPath()
Returns the path of the content. |
|
java.util.List<NetmeraContent> |
search()
Retrieves the list of NetmeraContent objects that matches with
the query. |
|
|
search(java.lang.Class<T> classOfT)
Gets a list of contents and maps them to your model object. |
|
|
searchInBackground(java.lang.Class<T> classOfT,
NetmeraCallback<java.util.List<T>> callback)
Gets a list of contents in background and maps them to your model object. |
|
void |
searchInBackground(NetmeraCallback<java.util.List<NetmeraContent>> callback)
Retrieves the list of NetmeraContent objects that matches with
the query in the background thread.Since it runs on the background thread
it does not block program.It is recommended over search() method. |
|
java.util.List<NetmeraUser> |
searchUser()
Retrieves the list of NetmeraUser objects that matches with the
query. |
|
void |
searchUserInBackground(NetmeraCallback<java.util.List<NetmeraUser>> callback)
Retrieves the list of NetmeraUser objects that matches with the
query in the background thread.Since it runs on the background thread it
does not block program.It is recommended over searchUser() method. |
|
void |
setCacheType(NetmeraCache.CacheType cacheType)
Sets the cache type. |
|
void |
setMax(int max)
Sets the total number of results to return. |
|
void |
setMaxCacheAge(long maxCacheAge)
Set max cache age. |
|
void |
setPage(int page)
Sets the index of the page to retrieve data. |
|
void |
setPath(java.lang.String path)
Sets the path of the content.This is used to find the content to delete and update. |
|
void |
setSortBy(java.lang.String sortBy)
Sorts the content with the given key. |
|
void |
setSortOrder(NetmeraService.SortOrder sortOrder)
Sorts the content with the given order. |
|
NetmeraService |
whereAllContainedIn(java.lang.String key,
java.util.Collection<?> values)
Adds an options to the query where value that matches with the query contains all of the values in the given collection. |
|
NetmeraService |
whereContainedIn(java.lang.String key,
java.util.Collection<?> values)
Adds an options to the query where value that matches with the query contains any of the values in the given collection. |
|
NetmeraService |
whereEndsWith(java.lang.String key,
java.lang.String suffix)
Adds an options to the query where value that matches with the query ends with the given suffix. |
|
NetmeraService |
whereEndsWith(java.lang.String key,
java.lang.String suffix,
boolean isCaseInsensitive)
Adds an options to the query where value that matches with the query ends with the given suffix. |
|
NetmeraService |
whereEqual(java.lang.String key,
java.lang.Object value)
Adds an options to the query where value that matches with the query is equal to the given value. |
|
NetmeraService |
whereEqual(java.lang.String key,
java.lang.Object value,
boolean isCaseInsensitive)
Adds an options to the query where value that matches with the query is equal to the given value. |
|
NetmeraService |
whereExists(java.lang.String key,
boolean value)
Adds an options to the query where the given key is exists or not. |
|
NetmeraService |
whereGreaterThan(java.lang.String key,
java.lang.Object value)
Adds an options to the query where value that matches with the query is greater than the given value. |
|
NetmeraService |
whereGreaterThanOrEqual(java.lang.String key,
java.lang.Object value)
Adds an options to the query where value that matches with the query is greater than or equal to the given value. |
|
NetmeraService |
whereLessThan(java.lang.String key,
java.lang.Object value)
Adds an options to the query where value that matches with the query is less than the given value. |
|
NetmeraService |
whereLessThanOrEqual(java.lang.String key,
java.lang.Object value)
Adds an options to the query where value that matches with the query is less than or equal to the given value. |
|
NetmeraService |
whereMatches(java.lang.String key,
java.lang.String regex)
Adds an options to the query where value that returns from the query matches with the given regex. |
|
NetmeraService |
whereMatches(java.lang.String key,
java.lang.String regex,
boolean isCaseInsensitive)
Adds an options to the query where value that returns from the query matches with the given regex. |
|
NetmeraService |
whereNotEqual(java.lang.String key,
java.lang.Object value)
Adds an options to the query where value that matches with the query is not equal to the given value. |
|
NetmeraService |
whereOwnerEqual(NetmeraUser user)
This is used to get the contents of the logged user. |
|
NetmeraService |
whereStartsWith(java.lang.String key,
java.lang.String prefix)
Adds an options to the query where value that matches with the query starts with the given prefix. |
|
NetmeraService |
whereStartsWith(java.lang.String key,
java.lang.String prefix,
boolean isCaseInsensitive)
Adds an options to the query where value that matches with the query starts with the given prefix. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NetmeraService(java.lang.String objectName)
Default value for the max = 10 and page = 0. It returns 10 result in each page. It skips page * max in each iteration.
objectName - - Name of the content| Method Detail |
|---|
public NetmeraCache.CacheType getCacheType()
NetmeraCache.CacheTypepublic void setCacheType(NetmeraCache.CacheType cacheType)
cacheType - - type of the cache policypublic void deleteCacheResults()
public long getMaxCacheAge()
public void setMaxCacheAge(long maxCacheAge)
maxCacheAge - max cache agepublic void setMax(int max)
max - public void setPage(int page)
setPage(3); means that skip 3*max
page and retrieve the next max page.
page - public java.lang.String getPath()
public void setPath(java.lang.String path)
path - - path of the contentpublic void setSortBy(java.lang.String sortBy)
sortBy - key to sort contentpublic void setSortOrder(NetmeraService.SortOrder sortOrder)
sortOrder - order of the sort
public long count()
throws NetmeraException
NetmeraException - Throws exception if it cannot access server.public void countInBackground(NetmeraCallback<java.lang.Long> callback)
callback - - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
count operation finishes.public NetmeraService addSearchText(java.lang.String searchText)
searchText - - Text to search
public NetmeraService whereEqual(java.lang.String key,
java.lang.Object value)
key - - key to identify specified valuevalue - - value associates with the specified key
public NetmeraService whereEqual(java.lang.String key,
java.lang.Object value,
boolean isCaseInsensitive)
key - - key to identify specified valuevalue - - value associates with the specified keyisCaseInsensitive - - If true, search is done case insensitive
public NetmeraService whereGreaterThan(java.lang.String key,
java.lang.Object value)
key - - key to identify specified valuevalue - - value associates with the specified key
public NetmeraService whereLessThan(java.lang.String key,
java.lang.Object value)
key - - key to identify specified valuevalue - - value associates with the specified key
public NetmeraService whereNotEqual(java.lang.String key,
java.lang.Object value)
key - - key to identify specified valuevalue - - value associates with the specified key
public NetmeraService whereGreaterThanOrEqual(java.lang.String key,
java.lang.Object value)
key - - key to identify specified valuevalue - - value associates with the specified key
public NetmeraService whereLessThanOrEqual(java.lang.String key,
java.lang.Object value)
key - - key to identify specified valuevalue - - value associates with the specified key
public NetmeraService whereExists(java.lang.String key,
boolean value)
key - - key to identify specified valuevalue - - boolean value to check whether key exists or not
public NetmeraService whereMatches(java.lang.String key,
java.lang.String regex)
key - - key to identify specified valueregex - - value associates with the specified key
public NetmeraService whereMatches(java.lang.String key,
java.lang.String regex,
boolean isCaseInsensitive)
key - - key to identify specified valueregex - - value associates with the specified keyisCaseInsensitive - - If true, search is done case insensitive
public NetmeraService whereStartsWith(java.lang.String key,
java.lang.String prefix)
key - - key to identify specified valueprefix - - value associates with the specified key
public NetmeraService whereStartsWith(java.lang.String key,
java.lang.String prefix,
boolean isCaseInsensitive)
key - - key to identify specified valueprefix - - value associates with the specified keyisCaseInsensitive - - If true, search is done case insensitive
public NetmeraService whereEndsWith(java.lang.String key,
java.lang.String suffix)
key - - key to identify specified valuesuffix - - value associates with the specified key
public NetmeraService whereEndsWith(java.lang.String key,
java.lang.String suffix,
boolean isCaseInsensitive)
key - - key to identify specified valuesuffix - - value associates with the specified keyisCaseInsensitive - - If true, search is done case insensitive
public NetmeraService whereContainedIn(java.lang.String key,
java.util.Collection<?> values)
key - - key to identify specified valuevalues - - value associates with the specified key
public NetmeraService whereAllContainedIn(java.lang.String key,
java.util.Collection<?> values)
key - - key to identify specified valuevalues - - value associates with the specified key
public NetmeraService whereOwnerEqual(NetmeraUser user)
throws NetmeraException
user - current user
NetmeraException - Throws exception if it cannot access server.
public java.util.List<NetmeraContent> circleSearch(NetmeraGeoLocation startLocation,
double distance,
java.lang.String locationSearchField)
throws NetmeraException
startLocation - base location to search near it.distance - is used to create circle by taking the startLocation as a
center.locationSearchField - name of the field that holds location data.
NetmeraContent object.
NetmeraException - Throws exception if it cannot access server.
public void circleSearchInBackground(NetmeraGeoLocation startLocation,
double distance,
java.lang.String locationSearchField,
NetmeraCallback<java.util.List<NetmeraContent>> callback)
startLocation - base location to search near it.distance - is used to create circle by taking the startLocation as a
center.locationSearchField - name of the field that holds location data.callback - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
search operation finishes.
public java.util.List<NetmeraContent> boxSearch(NetmeraGeoLocation firstPoint,
NetmeraGeoLocation secondPoint,
java.lang.String locationSearchField)
throws NetmeraException
firstPoint - NetmeraGeoLocation objectsecondPoint - NetmeraGeoLocation objectlocationSearchField - name of the field that holds location data.
NetmeraContent object.
NetmeraException - Throws exception if it cannot access server.
public void boxSearchInBackground(NetmeraGeoLocation firstPoint,
NetmeraGeoLocation secondPoint,
java.lang.String locationSearchField,
NetmeraCallback<java.util.List<NetmeraContent>> callback)
firstPoint - NetmeraGeoLocation objectsecondPoint - NetmeraGeoLocation objectlocationSearchField - name of the field that holds location data.callback - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
search operation finishes.
public java.util.List<NetmeraContent> search()
throws NetmeraException
NetmeraContent objects that matches with
the query.
It also checks NetmeraCache.CacheType and finds data using cache policy.
NetmeraContent object
NetmeraException - Throws exception if it cannot access server.public void searchInBackground(NetmeraCallback<java.util.List<NetmeraContent>> callback)
NetmeraContent objects that matches with
the query in the background thread.Since it runs on the background thread
it does not block program.It is recommended over search() method.
callback - - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
search operation finishes.
public NetmeraContent get()
throws NetmeraException
NetmeraContent object with the given path.Path of
the content can be setted using the setPath() method.
It also checks NetmeraCache.CacheType and finds data using cache policy.
NetmeraContent object
NetmeraException - Throws exception if it cannot access server.
public void getContentsInBackground(java.util.List<java.lang.String> pathList,
NetmeraCallback<java.util.List<NetmeraContent>> callback)
NetmeraContent objects with the given path list
in the background thread.If there is no matched content for the given
path list, it returns empty list.Since it runs on the background thread
it does not block program.It is recommended over getContents() method.
callback - - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
get operation finishes.
public java.util.List<NetmeraContent> getContents(java.util.List<java.lang.String> pathList)
throws NetmeraException
NetmeraContent objects with the given path
list.If there is no matched content for the given path list, it returns
empty list.
pathList - Path List of NetmeraContent objects
NetmeraContent object
NetmeraException - Throws exception if it cannot access server.
public <T> T get(java.lang.Class<T> classOfT)
throws NetmeraException
NetmeraService service = new NetmeraService("Your content name on Netmera");
service.setPath("your content path");
try {
MyModel result = service.get(MyModel.class);
} catch (NetmeraException e) {
e.printStackTrace();
}
classOfT - your model class
NetmeraException - if there is invalid field on your content
public <T> void getInBackground(java.lang.Class<T> classOfT,
NetmeraCallback<T> callback)
NetmeraService service = new NetmeraService("Your content name on Netmera");
service.setPath("your content path");
service.getInBackground(MyModel.class, new NetmeraCallback<MyModel>() {
@Override
public void onSuccess(MyModel model) {
//Success
}
@Override
public void onFail(NetmeraException ex) {
//Failure
}
});
classOfT - your model classcallback - - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
get operation finishes.
public <T> java.util.List<T> search(java.lang.Class<T> classOfT)
throws NetmeraException
NetmeraService service = new NetmeraService("Your content name on Netmera");
try {
List<MyModel> resultList = service.search(MyModel.class);
} catch (NetmeraException e) {
e.printStackTrace();
}
classOfT - your model class
NetmeraException - if there is invalid field on your content
public <T> void searchInBackground(java.lang.Class<T> classOfT,
NetmeraCallback<java.util.List<T>> callback)
NetmeraService service = new NetmeraService("Your content name on Netmera");
service.searchInBackground(MyModel.class, new NetmeraCallback<List<MyModel>>() {
@Override
public void onSuccess(List<MyModel> listOfModel) {
//Success
}
@Override
public void onFail(NetmeraException ex) {
//Failure
}
});
classOfT - your model classcallback - - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
search operation finishes.public void getInBackground(NetmeraCallback<NetmeraContent> callback)
NetmeraContent object that matches the query in
the background thread.Since it runs on the background thread it does not
block program.It is recommended over get() method.
callback - - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
get operation finishes.
public java.util.List<NetmeraUser> searchUser()
throws NetmeraException
NetmeraUser objects that matches with the
query.
NetmeraUser object
NetmeraExceptionpublic void searchUserInBackground(NetmeraCallback<java.util.List<NetmeraUser>> callback)
NetmeraUser objects that matches with the
query in the background thread.Since it runs on the background thread it
does not block program.It is recommended over searchUser() method.
callback - - NetmeraCallback.onFail(NetmeraException) or
NetmeraCallback.onSuccess(Object) methods called when
searchUser operation finishes.public static NetmeraService getNetmeraUserService()
NetmeraService object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||