passphrase = SecurityAlgorithms.decryptAES(passphrase);
} catch (Exception e) {
// TODO ??
}
Response resp = client.sendAndWait(
ClientPrimitives.OE_UPLMANAGER_FOLDER, path, owner,
usersSelected, path, folderName);
String folderIdGraph = resp.getValue("folderId");
String acl = resp.getValue("acl");
String relativePath = path.replace(Configuration.URL_WEBDAV_SERVER, "");
String ownerPath = "/" + owner + relativePath + "/" + folderName;
FileSystemUtils.deletePrivateFiles();
new TokensResource(path).updateToken(owner, passphrase, acl);
int aclType = 0;
do {
aclType = Integer.valueOf(client.sendAndWait(
ClientPrimitives.OE_FIRST_STEP_JSON, path, owner).getValue(
"result"));
if (aclType == 1) {
boolean firstStep = true;
do {
firstStep = true;
do {
String json1 = client.sendAndWait(
ClientPrimitives.OE_JSON_UPLOAD, path, owner,
nextToken, String.valueOf(firstStep)).getValue(
"json");
if (json1.equals("{\"values\":[]}")) {
destinationACLReached = true;
} else {
FileSystemUtils.writePrivateFile("json.txt", json1);
String command = Configuration.EXECUTABLES_PATH
+ "/wpes1_linux";
command += firstStep ? "new1" : "newn";
command += Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/json.txt";
if (firstAesKey) {
command += Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKeyFin.txt";
}
command += firstStep ? passphrase
: Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKey.txt";
command += Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKey.txt";
command += folderIdGraph;
command += Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/next.txt";
command += acl;
RunnerExecutables.execute(command);
firstStep = false;
String next = FileSystemUtils
.readPrivateFile("next.txt");
nextToken = next;
destinationACLReached = Boolean
.valueOf(client
.sendAndWait(
ClientPrimitives.OE_FINISHED_UPLOAD_TOKEN,
path, owner, next)
.getValue("result"));
String jsonout = FileSystemUtils
.readPrivateFile("jsonout.txt");
client.sendAndWait(
ClientPrimitives.OE_PUT_TOKEN_DB, path,
owner, jsonout);
}
} while (!destinationACLReached);
File aesKeyFile = new File(
Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKey.txt");
if (firstAesKey && aesKeyFile.exists()) {
aesKeyFile.renameTo(new File(
Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKeyFin.txt"));
firstAesKey = false;
}
result3 = Boolean.valueOf(client.sendAndWait(
ClientPrimitives.OE_MORE_USERS_ACL, path, owner)
.getValue("result"));
} while (result3);
} else if (aclType == 3) {
String json2 = client.sendAndWait(
ClientPrimitives.OE_JSON_UPLOAD, path, owner, "",
String.valueOf(true)).getValue("json");
FileSystemUtils.writePrivateFile("json.txt", json2);
String command = Configuration.EXECUTABLES_PATH
+ "/wpes1_linux";
command += "new1";
command += Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/json.txt";
if (firstAesKey) {
command += Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKeyFin.txt";
}
command += passphrase;
command += Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKey.txt";
command += folderIdGraph;
command += Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/next.txt";
command += acl;
RunnerExecutables.execute(command);
firstAesKey = false;
if (firstAesKey) {
File aesKeyFile = new File(
Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKey.txt");
aesKeyFile.renameTo(new File(
Configuration.LOCAL_PRIVATE_RESOURCES_PATH
+ "/AesKeyFin.txt"));
}
String jsonout = "";
jsonout = FileSystemUtils.readPrivateFile("jsonout.txt");
client.sendAndWait(ClientPrimitives.OE_PUT_TOKEN_DB, path,
owner, jsonout);
} else if (aclType == 2) {
String act = "";
String notes = "";
Response resp2 = client.sendAndWait(
ClientPrimitives.OE_CURRENT_NOTE, path, owner);
act = resp2.getValue("act");
notes = resp2.getValue("notes");
FileSystemUtils.writePrivateFile("NoteJson.txt", notes);
String command[] = {
Configuration.EXECUTABLES_PATH + "/wpes1_linux",
"note",