aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-06-10 01:30:20 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-06-10 01:31:28 +0200
commit067ffa876d4ec4e1f2ee63c851cb3c48f7eb1aa2 (patch)
treedfb89a5775dffc4b279082ff26b8ac620f464d8f /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java
parent97c679ada3461e676f65bd4c3258302ee5a44a51 (diff)
downloadopen-keychain-067ffa876d4ec4e1f2ee63c851cb3c48f7eb1aa2.tar.gz
open-keychain-067ffa876d4ec4e1f2ee63c851cb3c48f7eb1aa2.tar.bz2
open-keychain-067ffa876d4ec4e1f2ee63c851cb3c48f7eb1aa2.zip
import-log: add OperationResults, use it in ImportKeys operation
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java
new file mode 100644
index 000000000..e08b50500
--- /dev/null
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java
@@ -0,0 +1,63 @@
+package org.sufficientlysecure.keychain.service;
+
+import android.os.Parcel;
+
+public abstract class OperationResults {
+
+ public static class ImportResult extends OperationResultParcel {
+
+ public final int mNewKeys, mUpdatedKeys, mBadKeys;
+
+ // Operation ok, at least one new key (no warnings)
+ public static final int RESULT_OK_NEWKEYS = 1;
+ // Operation ok, at least one new and one updated key (no warnings)
+ public static final int RESULT_OK_BOTHKEYS = 2;
+ // Operation ok, no new keys but upated ones (no warnings)
+ public static final int RESULT_OK_UPDATED = 3;
+ // Operation ok, but with warnings
+ public static final int RESULT_OK_WITH_WARNINGS = 4;
+
+ // Operation partially ok, but at least one key failed!
+ public static final int RESULT_PARTIAL_WITH_ERRORS = 50;
+
+ // Operation failed, errors thrown and no new keys imported
+ public static final int RESULT_FAIL_ERROR = 100;
+ // Operation failed, no keys to import...
+ public static final int RESULT_FAIL_NOTHING = 101;
+
+ public ImportResult(Parcel source) {
+ super(source);
+ mNewKeys = source.readInt();
+ mUpdatedKeys = source.readInt();
+ mBadKeys = source.readInt();
+ }
+
+ public ImportResult(int result, OperationLog log,
+ int newKeys, int updatedKeys, int badKeys) {
+ super(result, log);
+ mNewKeys = newKeys;
+ mUpdatedKeys = updatedKeys;
+ mBadKeys = badKeys;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+ dest.writeInt(mNewKeys);
+ dest.writeInt(mUpdatedKeys);
+ dest.writeInt(mBadKeys);
+ }
+
+ public static Creator<ImportResult> CREATOR = new Creator<ImportResult>() {
+ public ImportResult createFromParcel(final Parcel source) {
+ return new ImportResult(source);
+ }
+
+ public ImportResult[] newArray(final int size) {
+ return new ImportResult[size];
+ }
+ };
+
+ }
+
+}