本文整理匯總了Java中com.odoo.core.rpc.listeners.OdooSyncResponse類的典型用法代碼示例。如果您正苦於以下問題:Java OdooSyncResponse類的具體用法?Java OdooSyncResponse怎麽用?Java OdooSyncResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OdooSyncResponse類屬於com.odoo.core.rpc.listeners包,在下文中一共展示了OdooSyncResponse類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSessionInfo
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void getSessionInfo(final OdooResponse callback, OdooSyncResponse backResponse) {
String url = serverURL + "/web/session/get_session_info";
newJSONPOSTRequest(url, null, new OdooResponse() {
@Override
public void onResponse(OdooResult response) {
odooSession = OdooSession.parseSessionInfo(response);
if (callback != null)
callback.onResponse(response);
}
@Override
public void onError(OdooError error) {
if (callback != null)
callback.onError(error);
}
}, backResponse);
}
示例2: installedOnServer
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void installedOnServer(String moduleName, final IModuleInstallListener callback,
OdooSyncResponse backResponse) {
OdooFields fields = new OdooFields();
fields.addAll(new String[]{"state", "name"});
ODomain domain = new ODomain();
domain.add("name", "=", moduleName);
searchRead("ir.module.module", fields, domain, 0, 0, null, new OdooResponse() {
@Override
public void onResponse(OdooResult response) {
if (response.getRecords().size() > 0) {
OdooRecord rec = response.getRecords().get(0);
callback.installedOnServer(rec.getString("state").equals("installed"));
}
}
@Override
public void onError(OdooError error) {
OdooLog.e(error);
callback.installedOnServer(false);
}
}, backResponse);
}
示例3: getSessionInfo
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void getSessionInfo(final IOdooResponse callback, OdooSyncResponse backResponse) {
String url = serverURL + "/web/session/get_session_info";
newJSONPOSTRequest(url, null, new IOdooResponse() {
@Override
public void onResponse(OdooResult response) {
odooSession = OdooSession.parseSessionInfo(response);
if (callback != null)
callback.onResponse(response);
}
@Override
public void onError(OdooError error) {
if (callback != null)
callback.onError(error);
}
}, backResponse);
}
示例4: callMethod
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void callMethod(String model, String method, OArguments arguments,
HashMap<String, Object> kwargs, HashMap<String, Object> context,
IOdooResponse callback, OdooSyncResponse backResponse) {
String url = serverURL + "/web/dataset/call_kw";
try {
JSONObject params = new JSONObject();
params.put("model", model);
params.put("method", method);
params.put("args", arguments.getArray());
params.put("kwargs", (kwargs != null)
? new JSONObject(gson.toJson(kwargs)) : new JSONObject());
params.put("context", (context != null) ?
new JSONObject(gson.toJson(updateContext(context)))
: odooSession.getUserContext());
newJSONPOSTRequest(url, params, callback, backResponse);
} catch (Exception e) {
OdooLog.e(e, e.getMessage());
}
}
示例5: installedOnServer
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void installedOnServer(String moduleName, final IModuleInstallListener callback,
OdooSyncResponse backResponse) {
OdooFields fields = new OdooFields();
fields.addAll(new String[]{"state", "name"});
ODomain domain = new ODomain();
domain.add("name", "=", moduleName);
searchRead("ir.module.module", fields, domain, 0, 0, null, new IOdooResponse() {
@Override
public void onResponse(OdooResult response) {
if (response.getRecords().size() > 0) {
OdooRecord rec = response.getRecords().get(0);
callback.installedOnServer(rec.getString("state").equals("installed"));
}
}
@Override
public void onError(OdooError error) {
OdooLog.e(error);
callback.installedOnServer(false);
}
}, backResponse);
}
示例6: getVersionInfo
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
public OdooResult getVersionInfo() throws OdooVersionException {
OdooSyncResponse response = new OdooSyncResponse();
getVersionInfo(null, response);
OdooResult version = validateResult(response);
mVersion = OdooVersion.parseVersion(version);
return version;
}
示例7: authenticate
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
public OUser authenticate(String username, String password, String database) {
OdooSyncResponse response = new OdooSyncResponse();
authenticate(username, password, database, null, response);
OdooResult userResult = response.get().result;
if (!(userResult.get("uid") instanceof Boolean)) {
userResult.put("username", username);
bindOdooSession(userResult);
generateUserObject(username, password, database, userResult, null, response);
if (response.getObject() != null)
return (OUser) response.getObject();
}
return null;
}
示例8: nameSearch
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void nameSearch(String model, String query, ODomain domain, int limit, OdooResponse callback
, OdooSyncResponse backResponse) {
try {
HashMap<String, Object> kwargs = new HashMap<>();
kwargs.put("name", query);
kwargs.put("args", (domain != null) ? domain.getAsList() : new ArrayList<>());
kwargs.put("operator", "ilike");
kwargs.put("limit", limit);
callMethod(model, "name_search", new OArguments(), kwargs, null, callback, backResponse);
} catch (Exception e) {
OdooLog.e(e, e.getMessage());
}
}
示例9: searchCount
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void searchCount(String model, ODomain domain, OdooResponse callback,
OdooSyncResponse backResponse) {
try {
JSONObject params = new JSONObject();
params.put("model", model);
params.put("method", "search_count");
OArguments args = new OArguments();
args.add(domain.getArray());
callMethod(model, "search_count", args, new HashMap<String, Object>(), new HashMap<String, Object>(),
callback, backResponse);
} catch (Exception e) {
OdooLog.e(e, e.getMessage());
}
}
示例10: executeWorkFlow
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void executeWorkFlow(String model, int id, String signal, OdooResponse callback,
OdooSyncResponse backResponse) {
String url = serverURL + "/web/dataset/exec_workflow";
try {
JSONObject params = new JSONObject();
params.put("model", model);
params.put("id", id);
params.put("signal", signal);
newJSONPOSTRequest(url, params, callback, backResponse);
} catch (Exception e) {
OdooLog.e(e, e.getMessage());
}
}
示例11: getModelFields
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void getModelFields(String model, OdooResponse callback, OdooSyncResponse backResponse) {
OdooFields fields = new OdooFields();
fields.addAll(new String[]{"name", "field_description", "ttype", "model_id"});
ODomain domain = new ODomain();
domain.add("model_id", "=", model);
searchRead("ir.model.fields", fields, domain, 0, 0, null, callback, backResponse);
}
示例12: permRead
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void permRead(String model, List<Integer> ids, OdooResponse callback, OdooSyncResponse backResponse) {
try {
OArguments args = new OArguments();
args.add(new JSONArray(ids.toString()));
callMethod(model, "perm_read", args, null, null, callback, backResponse);
} catch (JSONException e) {
OdooLog.e(e, e.getMessage());
}
}
示例13: createRecord
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
private void createRecord(String model, ORecordValues values, OdooResponse callback, OdooSyncResponse backResponse) {
try {
OArguments args = new OArguments();
args.add(new JSONObject(gson.toJson(values)));
HashMap<String, Object> map = new HashMap<>();
map.put("context", gson.fromJson(odooSession.getUserContext() + "",
HashMap.class));
callMethod(model, "create", args, map, null, callback, backResponse);
} catch (Exception e) {
OdooLog.e(e, e.getMessage());
}
}
示例14: updateRecord
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
public OdooResult updateRecord(String model, ORecordValues values, int id) {
OdooSyncResponse response = new OdooSyncResponse();
List<Integer> ids = new ArrayList<>();
ids.add(id);
updateRecord(model, values, ids, null, response);
return validateResult(response);
}
示例15: unlinkRecord
import com.odoo.core.rpc.listeners.OdooSyncResponse; //導入依賴的package包/類
public OdooResult unlinkRecord(String model, int id) {
List<Integer> ids = new ArrayList<>();
ids.add(id);
OdooSyncResponse response = new OdooSyncResponse();
unlinkRecord(model, ids, null, response);
return validateResult(response);
}