Copyright (c) 2012 CloudMine LLC, http://cloudmine.me
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software")...
If you think the Android project cloudmine-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.cloudmine.api.rest;
/*fromwww.java2s.com*/import com.android.volley.NetworkResponse;
import com.android.volley.Response;
import com.cloudmine.api.CMApiCredentials;
import com.cloudmine.api.CMSessionToken;
import com.cloudmine.api.rest.options.CMServerFunction;
import com.cloudmine.api.rest.response.ObjectModificationResponse;
import me.cloudmine.annotations.Expand;
import me.cloudmine.annotations.Optional;
import me.cloudmine.annotations.Single;
import java.util.Collection;
/**
* A Request for deleting a File, based on its fileId
* <br>
* Copyright CloudMine LLC. All rights reserved<br>
* See LICENSE file included with SDK for details.
*/publicclass BaseFileDeleteRequest extends CloudMineRequest<ObjectModificationResponse> {
publicstaticfinalint REQUEST_TYPE = 409;
staticfinal String BASE_ENDPOINT = "/data";
staticfinal CMURLBuilder BASE_URL = new CMURLBuilder(BASE_ENDPOINT, true);
/**
* Create a new BaseFileDeleteRequest for deleting one or more files
* @param fileIds The fileIds to delete
* @param sessionToken an optional CMSessionToken. If specified, it is assumed the files are user level
* @param serverFunction
* @param successListener
* @param errorListener
*/
@Expand
public BaseFileDeleteRequest(@Single Collection<String> fileIds, @Optional CMSessionToken sessionToken, @Optional CMApiCredentials apiCredentials, @Optional CMServerFunction serverFunction, Response.Listener<ObjectModificationResponse> successListener, @Optional Response.ErrorListener errorListener) {
super(Method.DELETE, BASE_URL.copy().user(sessionToken).objectIds(fileIds).serverFunction(serverFunction).asUrlString(), null, sessionToken, apiCredentials, successListener, errorListener);
}
@Override
protected Response<ObjectModificationResponse> parseNetworkResponse(NetworkResponse networkResponse) {
return Response.success(new ObjectModificationResponse(new String(networkResponse.data), networkResponse.statusCode), getCacheEntry(networkResponse));
}
@Override
publicint getRequestType() {
return REQUEST_TYPE;
}
}