Package ch.helvethink.odoo4java.jsonrpc
Class OdooClient
java.lang.Object
ch.helvethink.odoo4java.jsonrpc.OdooClient
- All Implemented Interfaces:
OdooRpcClient
Abstraction of Odoo's JSON-RPC API
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOdooClient(String instanceUrl, String dbName, String username, String password) Constructor with direct connectionOdooClient(okhttp3.OkHttpClient httpCli, String instanceUrl, String dbName, String username, String password, boolean mustConnect) Constructor -
Method Summary
Modifier and TypeMethodDescriptionfindByCriteria(int limit, Class<T> classToConvert, String... criteria) Find an Odoo object using criteria.findListByIds(List<OdooId> idsToFetch, Class<T> classToConvert) findListByIdsInt(List<Integer> idsToFetch, Class<T> classToConvert) <T extends OdooObj>
TfindObjectById(OdooId idToFetch, Class<T> classToConvert)
-
Field Details
-
LOG
public static final org.slf4j.Logger LOGSimple logger
-
-
Constructor Details
-
OdooClient
public OdooClient(String instanceUrl, String dbName, String username, String password) throws IOException Constructor with direct connection- Parameters:
instanceUrl- The odoo Instance URLdbName- The odoo DB Nameusername- The Odoo username when authenticatingpassword- The Odoo password when authenticating- Throws:
IOException- Exceptions from OkHttpClient
-
OdooClient
public OdooClient(okhttp3.OkHttpClient httpCli, String instanceUrl, String dbName, String username, String password, boolean mustConnect) throws IOException Constructor- Parameters:
httpCli- The ok http instanceinstanceUrl- The odoo Instance URLdbName- The odoo DB Nameusername- The Odoo username when authenticatingpassword- The Odoo password when authenticatingmustConnect- - describes if we must try to connect or not- Throws:
IOException- Exceptions from OkHttpClient
-
-
Method Details
-
findByCriteria
public <T extends OdooObj> List<T> findByCriteria(int limit, Class<T> classToConvert, String... criteria) Find an Odoo object using criteria. If no criteria, will send all the objects (id >=0 )- Specified by:
findByCriteriain interfaceOdooRpcClient- Type Parameters:
T- The target type- Parameters:
limit- Number of objects we want to retrieveclassToConvert- Type of the target objectcriteria- The search criteria- Returns:
- List of corresponding objects
-
findObjectById
- Specified by:
findObjectByIdin interfaceOdooRpcClient
-
findListByIdsInt
public <T extends OdooObj> List<T> findListByIdsInt(List<Integer> idsToFetch, Class<T> classToConvert) - Specified by:
findListByIdsIntin interfaceOdooRpcClient
-
findListByIds
- Specified by:
findListByIdsin interfaceOdooRpcClient
-