Java Code Examples for com.nextgis.maplib.util.NGWUtil#getFeatureAttachmentUrl()

The following examples show how to use com.nextgis.maplib.util.NGWUtil#getFeatureAttachmentUrl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NGWVectorLayer.java    From android_maplib with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected HttpResponse sendFeatureAttachOnServer(JSONObject result, long featureId, AttachItem attach) throws JSONException, IOException {
    // add attachment to row
    JSONObject postJsonData = new JSONObject();
    JSONArray uploadMetaArray = result.getJSONArray("upload_meta");
    postJsonData.put("file_upload", uploadMetaArray.get(0));
    postJsonData.put("description", attach.getDescription());
    String postload = postJsonData.toString();
    if (Constants.DEBUG_MODE) {
        Log.d(Constants.TAG, "postload: " + postload);
    }

    // get account data
    AccountUtil.AccountData accountData = AccountUtil.getAccountData(mContext, mAccountName);

    // upload file
    String url = NGWUtil.getFeatureAttachmentUrl(accountData.url, mRemoteId, featureId);

    // update record in NGW
    return NetworkUtil.post(url, postload, accountData.login, accountData.password, false);
}
 
Example 2
Source File: NGWVectorLayer.java    From android_maplib with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected HttpResponse changeAttachOnServer(long featureId, long attachId, String putData) throws IOException {
    AccountUtil.AccountData accountData = AccountUtil.getAccountData(mContext, mAccountName);
    String url = NGWUtil.getFeatureAttachmentUrl(accountData.url, mRemoteId, featureId) + attachId;
    return NetworkUtil.put(url, putData, accountData.login,
                                            accountData.password, false);
}