Эх сурвалжийг харах

Resolve #3148 adding lombok to more data classes

Andy Scherzinger 6 жил өмнө
parent
commit
1f5bae0dbb

+ 17 - 133
src/main/java/com/owncloud/android/datamodel/DecryptedFolderMetadata.java

@@ -24,9 +24,16 @@ package com.owncloud.android.datamodel;
 import java.util.HashMap;
 import java.util.Map;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * Decrypted class representation of metadata json of folder metadata.
  */
+@Getter
+@Setter
+@AllArgsConstructor
 public class DecryptedFolderMetadata {
     private Metadata metadata;
     private Map<String, DecryptedFile> files;
@@ -36,170 +43,47 @@ public class DecryptedFolderMetadata {
         this.files = new HashMap<>();
     }
 
-    public DecryptedFolderMetadata(Metadata metadata, Map<String, DecryptedFile> files) {
-        this.metadata = metadata;
-        this.files = files;
-    }
-
-    public Metadata getMetadata() {
-        return metadata;
-    }
-
-    public void setMetadata(Metadata metadata) {
-        this.metadata = metadata;
-    }
-
-    public Map<String, DecryptedFile> getFiles() {
-        return files;
-    }
-
-    public void setFiles(Map<String, DecryptedFile> files) {
-        this.files = files;
-    }
-
+    @Getter
+    @Setter
     public static class Metadata {
         private Map<Integer, String> metadataKeys; // each keys is encrypted on its own, decrypt on use
         private Sharing sharing;
         private int version;
 
-        public Map<Integer, String> getMetadataKeys() {
-            return metadataKeys;
-        }
-
-        public void setMetadataKeys(Map<Integer, String> metadataKeys) {
-            this.metadataKeys = metadataKeys;
-        }
-
-        public Sharing getSharing() {
-            return sharing;
-        }
-
-        public void setSharing(Sharing sharing) {
-            this.sharing = sharing;
-        }
-
-        public int getVersion() {
-            return version;
-        }
-
-        public void setVersion(int version) {
-            this.version = version;
-        }
-
         @Override
         public String toString() {
             return String.valueOf(version);
         }
     }
 
+    @Getter
+    @Setter
     public static class Encrypted {
         private Map<Integer, String> metadataKeys;
-
-        public Map<Integer, String> getMetadataKeys() {
-            return metadataKeys;
-        }
-
-        public void setMetadataKeys(Map<Integer, String> metadataKeys) {
-            this.metadataKeys = metadataKeys;
-        }
     }
 
+    @Getter
+    @Setter
     public static class Sharing {
         private Map<String, String> recipient;
         private String signature;
-
-        public Map<String, String> getRecipient() {
-            return recipient;
-        }
-
-        public void setRecipient(Map<String, String> recipient) {
-            this.recipient = recipient;
-        }
-
-        public String getSignature() {
-            return signature;
-        }
-
-        public void setSignature(String signature) {
-            this.signature = signature;
-        }
     }
 
+    @Getter
+    @Setter
     public static class DecryptedFile {
         private Data encrypted;
         private String initializationVector;
         private String authenticationTag;
         private int metadataKey;
-
-        public Data getEncrypted() {
-            return encrypted;
-        }
-
-        public void setEncrypted(Data encrypted) {
-            this.encrypted = encrypted;
-        }
-
-        public String getInitializationVector() {
-            return initializationVector;
-        }
-
-        public void setInitializationVector(String initializationVector) {
-            this.initializationVector = initializationVector;
-        }
-
-        public String getAuthenticationTag() {
-            return authenticationTag;
-        }
-
-        public void setAuthenticationTag(String authenticationTag) {
-            this.authenticationTag = authenticationTag;
-        }
-
-        public int getMetadataKey() {
-            return metadataKey;
-        }
-
-        public void setMetadataKey(int metadataKey) {
-            this.metadataKey = metadataKey;
-        }
     }
 
+    @Getter
+    @Setter
     public static class Data {
         private String key;
         private String filename;
         private String mimetype;
         private int version;
-
-        public String getKey() {
-            return key;
-        }
-
-        public void setKey(String key) {
-            this.key = key;
-        }
-
-        public String getFilename() {
-            return filename;
-        }
-
-        public void setFilename(String filename) {
-            this.filename = filename;
-        }
-
-        public String getMimetype() {
-            return mimetype;
-        }
-
-        public void setMimetype(String mimetype) {
-            this.mimetype = mimetype;
-        }
-
-        public int getVersion() {
-            return version;
-        }
-
-        public void setVersion(int version) {
-            this.version = version;
-        }
     }
 }

+ 11 - 46
src/main/java/com/owncloud/android/datamodel/DecryptedPushMessage.java

@@ -22,54 +22,19 @@ package com.owncloud.android.datamodel;
 
 import org.parceler.Parcel;
 
-@Parcel public class DecryptedPushMessage {
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Parcel
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+public class DecryptedPushMessage {
     public String app;
-
     public String type;
-
     public String subject;
-
     public String id;
-
-    public DecryptedPushMessage(String app, String type, String subject, String id) {
-        this.app = app;
-        this.type = type;
-        this.subject = subject;
-        this.id = id;
-    }
-
-    public DecryptedPushMessage() {
-    }
-
-    public String getApp() {
-        return app;
-    }
-
-    public void setApp(String app) {
-        this.app = app;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public String getSubject() {
-        return subject;
-    }
-
-    public void setSubject(String subject) {
-        this.subject = subject;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
 }

+ 9 - 54
src/main/java/com/owncloud/android/datamodel/EncryptedFolderMetadata.java

@@ -23,71 +23,26 @@ package com.owncloud.android.datamodel;
 
 import java.util.Map;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * Encrypted class representation of metadata json of folder metadata
  */
-
+@Getter
+@Setter
+@AllArgsConstructor
 public class EncryptedFolderMetadata {
     private DecryptedFolderMetadata.Metadata metadata;
     private Map<String, EncryptedFile> files;
-    
-    public EncryptedFolderMetadata(DecryptedFolderMetadata.Metadata metadata, Map<String, EncryptedFile> files) {
-        this.metadata = metadata;
-        this.files = files;
-    }
-
-    public DecryptedFolderMetadata.Metadata getMetadata() {
-        return metadata;
-    }
-
-    public void setMetadata(DecryptedFolderMetadata.Metadata metadata) {
-        this.metadata = metadata;
-    }
-
-    public Map<String, EncryptedFile> getFiles() {
-        return files;
-    }
-
-    public void setFiles(Map<String, EncryptedFile> files) {
-        this.files = files;
-    }
 
+    @Getter
+    @Setter
     public static class EncryptedFile {
         private String encrypted;
         private String initializationVector;
         private String authenticationTag;
         private int metadataKey;
-
-        public String getEncrypted() {
-            return encrypted;
-        }
-
-        public void setEncrypted(String encrypted) {
-            this.encrypted = encrypted;
-        }
-
-        public String getInitializationVector() {
-            return initializationVector;
-        }
-
-        public void setInitializationVector(String initializationVector) {
-            this.initializationVector = initializationVector;
-        }
-
-        public String getAuthenticationTag() {
-            return authenticationTag;
-        }
-
-        public void setAuthenticationTag(String authenticationTag) {
-            this.authenticationTag = authenticationTag;
-        }
-
-        public int getMetadataKey() {
-            return metadataKey;
-        }
-
-        public void setMetadataKey(int metadataKey) {
-            this.metadataKey = metadataKey;
-        }
     }
 }

+ 60 - 76
src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -61,51 +61,36 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 
-public class FileDataStorageManager {
+import lombok.Getter;
+import lombok.Setter;
 
-    public static final int ROOT_PARENT_ID = 0;
+@Getter
+public class FileDataStorageManager {
+    private static final String TAG = FileDataStorageManager.class.getSimpleName();
 
-    private ContentResolver mContentResolver;
-    private ContentProviderClient mContentProviderClient;
-    private Account mAccount;
     private static final String AND = "=? AND ";
     private static final String FAILED_TO_INSERT_MSG = "Fail to insert insert file to database ";
     private static final String SENDING_TO_FILECONTENTPROVIDER_MSG = "Sending %d operations to FileContentProvider";
     private static final String EXCEPTION_MSG = "Exception in batch of operations ";
 
-    private static final String TAG = FileDataStorageManager.class.getSimpleName();
+    public static final int ROOT_PARENT_ID = 0;
 
+    private ContentResolver contentResolver;
+    private ContentProviderClient contentProviderClient;
+    @Setter private Account account;
 
     public FileDataStorageManager(Account account, ContentResolver cr) {
-        mContentProviderClient = null;
-        mContentResolver = cr;
-        mAccount = account;
+        contentProviderClient = null;
+        contentResolver = cr;
+        this.account = account;
     }
 
     public FileDataStorageManager(Account account, ContentProviderClient cp) {
-        mContentProviderClient = cp;
-        mContentResolver = null;
-        mAccount = account;
-    }
-
-
-    public void setAccount(Account account) {
-        mAccount = account;
+        contentProviderClient = cp;
+        contentResolver = null;
+        this.account = account;
     }
 
-    public Account getAccount() {
-        return mAccount;
-    }
-
-    public ContentResolver getContentResolver() {
-        return mContentResolver;
-    }
-
-    public ContentProviderClient getContentProviderClient() {
-        return mContentProviderClient;
-    }
-
-
     public OCFile getFileByPath(String path) {
         Cursor c = getFileCursorForValue(ProviderTableMeta.FILE_PATH, path);
         OCFile file = null;
@@ -119,7 +104,6 @@ public class FileDataStorageManager {
         return file;
     }
 
-
     public @Nullable
     OCFile getFileById(long id) {
         Cursor c = getFileCursorForValue(ProviderTableMeta._ID, String.valueOf(id));
@@ -205,7 +189,7 @@ public class FileDataStorageManager {
             cv.put(ProviderTableMeta.FILE_IS_ENCRYPTED, file.isEncrypted());
             cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
         }
-        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
+        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
         cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
         cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
         cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
@@ -362,13 +346,13 @@ public class FileDataStorageManager {
         String[] whereArgs;
         for (OCFile file : filesToRemove) {
             if (file.getParentId() == folder.getFileId()) {
-                whereArgs = new String[]{mAccount.name, file.getRemotePath()};
+                whereArgs = new String[]{account.name, file.getRemotePath()};
                 if (file.isFolder()) {
                     operations.add(ContentProviderOperation.newDelete(
                             ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_DIR, file.getFileId()))
                             .withSelection(where, whereArgs).build());
 
-                    File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
+                    File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(account.name, file));
                     if (localFolder.exists()) {
                         removeLocalFolder(localFolder);
                     }
@@ -445,7 +429,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.FILE_NAME, folder.getFileName());
         cv.put(ProviderTableMeta.FILE_PARENT, folder.getParentId());
         cv.put(ProviderTableMeta.FILE_PATH, folder.getRemotePath());
-        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
+        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
         cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, folder.getLastSyncDateForProperties());
         cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, folder.getLastSyncDateForData());
         cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, folder.isAvailableOffline() ? 1 : 0);
@@ -474,7 +458,7 @@ public class FileDataStorageManager {
         if (!file.isFolder()) {
             cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
         }
-        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
+        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
         cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
         cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
         cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
@@ -506,7 +490,7 @@ public class FileDataStorageManager {
                     // ""+file.getFileId());
                     Uri file_uri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE, file.getFileId());
                     String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
-                    String[] whereArgs = new String[]{mAccount.name, file.getRemotePath()};
+                    String[] whereArgs = new String[]{account.name, file.getRemotePath()};
                     int deleted = 0;
                     if (getContentProviderClient() != null) {
                         try {
@@ -561,7 +545,7 @@ public class FileDataStorageManager {
         Uri folder_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, String.valueOf(folder.getFileId())); // URI
         // for recursive deletion
         String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
-        String[] whereArgs = new String[]{mAccount.name, folder.getRemotePath()};
+        String[] whereArgs = new String[]{account.name, folder.getRemotePath()};
         int deleted = 0;
         if (getContentProviderClient() != null) {
             try {
@@ -577,7 +561,7 @@ public class FileDataStorageManager {
 
     private boolean removeLocalFolder(OCFile folder) {
         boolean success = true;
-        String localFolderPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder);
+        String localFolderPath = FileStorageUtils.getDefaultSavePathFor(account.name, folder);
         File localFolder = new File(localFolderPath);
         if (localFolder.exists()) {
             // stage 1: remove the local files already registered in the files database
@@ -647,7 +631,7 @@ public class FileDataStorageManager {
                             ProviderTableMeta.CONTENT_URI,
                             null,
                             ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " LIKE ? ",
-                            new String[]{mAccount.name, file.getRemotePath() + "%"},
+                            new String[]{account.name, file.getRemotePath() + "%"},
                             ProviderTableMeta.FILE_PATH + " ASC "
                     );
                 } catch (RemoteException e) {
@@ -659,14 +643,14 @@ public class FileDataStorageManager {
                         ProviderTableMeta.CONTENT_URI,
                         null,
                         ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " LIKE ? ",
-                        new String[]{mAccount.name, file.getRemotePath() + "%"},
+                        new String[]{account.name, file.getRemotePath() + "%"},
                         ProviderTableMeta.FILE_PATH + " ASC "
                 );
             }
 
             /// 2. prepare a batch of update operations to change all the descendants
             ArrayList<ContentProviderOperation> operations = new ArrayList<>(c.getCount());
-            String defaultSavePath = FileStorageUtils.getSavePath(mAccount.name);
+            String defaultSavePath = FileStorageUtils.getSavePath(account.name);
             List<String> originalPathsToTriggerMediaScan = new ArrayList<String>();
             List<String> newPathsToTriggerMediaScan = new ArrayList<String>();
             if (c.moveToFirst()) {
@@ -719,7 +703,7 @@ public class FileDataStorageManager {
             }
 
             /// 4. move in local file system
-            String originalLocalPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
+            String originalLocalPath = FileStorageUtils.getDefaultSavePathFor(account.name, file);
             String targetLocalPath = defaultSavePath + targetPath;
             File localFile = new File(originalLocalPath);
             boolean renamed = false;
@@ -751,10 +735,10 @@ public class FileDataStorageManager {
     public void copyLocalFile(OCFile file, String targetPath) {
 
         if (file != null && file.fileExists() && !OCFile.ROOT_PATH.equals(file.getFileName())) {
-            String localPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
+            String localPath = FileStorageUtils.getDefaultSavePathFor(account.name, file);
             File localFile = new File(localPath);
             boolean copied = false;
-            String defaultSavePath = FileStorageUtils.getSavePath(mAccount.name);
+            String defaultSavePath = FileStorageUtils.getSavePath(account.name);
             if (localFile.exists()) {
                 File targetFile = new File(defaultSavePath + targetPath);
                 File targetFolder = targetFile.getParentFile();
@@ -885,7 +869,7 @@ public class FileDataStorageManager {
                             cmp_key + AND
                                     + ProviderTableMeta.FILE_ACCOUNT_OWNER
                                     + "=?",
-                            new String[]{value, mAccount.name}, null);
+                            new String[]{value, account.name}, null);
         } else {
             try {
                 c = getContentProviderClient().query(
@@ -893,7 +877,7 @@ public class FileDataStorageManager {
                         null,
                         cmp_key + AND
                                 + ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
-                        new String[]{value, mAccount.name}, null);
+                        new String[]{value, account.name}, null);
             } catch (RemoteException e) {
                 Log_OC.e(TAG, "Couldn't determine file existance, assuming non existance: " + e.getMessage(), e);
                 return false;
@@ -913,14 +897,14 @@ public class FileDataStorageManager {
                             key + AND
                                     + ProviderTableMeta.FILE_ACCOUNT_OWNER
                                     + "=?",
-                            new String[]{value, mAccount.name}, null);
+                            new String[]{value, account.name}, null);
         } else {
             try {
                 c = getContentProviderClient().query(
                         ProviderTableMeta.CONTENT_URI,
                         null,
                         key + AND + ProviderTableMeta.FILE_ACCOUNT_OWNER
-                                + "=?", new String[]{value, mAccount.name},
+                                + "=?", new String[]{value, account.name},
                         null);
             } catch (RemoteException e) {
                 Log_OC.e(TAG, "Could not get file details: " + e.getMessage(), e);
@@ -954,7 +938,7 @@ public class FileDataStorageManager {
                 // try to find existing file and bind it with current account;
                 // with the current update of SynchronizeFolderOperation, this won't be
                 // necessary anymore after a full synchronization of the account
-                File f = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
+                File f = new File(FileStorageUtils.getDefaultSavePathFor(account.name, file));
                 if (f.exists()) {
                     file.setStoragePath(f.getAbsolutePath());
                     file.setLastSyncDateForData(f.lastModified());
@@ -1006,7 +990,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
         cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
         cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
-        cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
+        cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, account.name);
         cv.put(ProviderTableMeta.OCSHARES_IS_PASSWORD_PROTECTED, share.isPasswordProtected() ? 1 : 0);
         cv.put(ProviderTableMeta.OCSHARES_NOTE, share.getNote());
 
@@ -1108,7 +1092,7 @@ public class FileDataStorageManager {
                             null,
                             key + AND
                                     + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
-                            new String[]{value, mAccount.name},
+                            new String[]{value, account.name},
                             null
                     );
         } else {
@@ -1117,7 +1101,7 @@ public class FileDataStorageManager {
                         ProviderTableMeta.CONTENT_URI_SHARE,
                         null,
                         key + AND + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
-                        new String[]{value, mAccount.name},
+                        new String[]{value, account.name},
                         null
                 );
             } catch (RemoteException e) {
@@ -1155,13 +1139,13 @@ public class FileDataStorageManager {
             selectionArgs = new String[]{
                     path,
                     Integer.toString(type.getValue()),
-                    mAccount.name
+                    account.name
             };
         } else {
             selectionArgs = new String[]{
                     path,
                     Integer.toString(type.getValue()),
-                    mAccount.name,
+                    account.name,
                     shareWith
             };
         }
@@ -1225,7 +1209,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
         cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
         String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?";
-        String[] whereArgs = new String[]{mAccount.name};
+        String[] whereArgs = new String[]{account.name};
 
         if (getContentResolver() != null) {
             getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
@@ -1245,7 +1229,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
         cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
         String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PARENT + "=?";
-        String[] whereArgs = new String[]{mAccount.name, String.valueOf(folder.getFileId())};
+        String[] whereArgs = new String[]{account.name, String.valueOf(folder.getFileId())};
 
         if (getContentResolver() != null) {
             getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
@@ -1265,7 +1249,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
         cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
         String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
-        String[] whereArgs = new String[]{mAccount.name, filePath};
+        String[] whereArgs = new String[]{account.name, filePath};
 
         if (getContentResolver() != null) {
             getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
@@ -1281,7 +1265,7 @@ public class FileDataStorageManager {
 
     private void cleanShares() {
         String where = ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
-        String[] whereArgs = new String[]{mAccount.name};
+        String[] whereArgs = new String[]{account.name};
 
         if (getContentResolver() != null) {
             getContentResolver().delete(ProviderTableMeta.CONTENT_URI_SHARE, where, whereArgs);
@@ -1317,7 +1301,7 @@ public class FileDataStorageManager {
                 cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
                 cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
                 cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
-                cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
+                cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, account.name);
                 cv.put(ProviderTableMeta.OCSHARES_IS_PASSWORD_PROTECTED, share.isPasswordProtected() ? 1 : 0);
                 cv.put(ProviderTableMeta.OCSHARES_NOTE, share.getNote());
 
@@ -1383,7 +1367,7 @@ public class FileDataStorageManager {
                 if (!file.isFolder()) {
                     cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
                 }
-                cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
+                cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
                 cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
                 cv.put(
                         ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA,
@@ -1451,7 +1435,7 @@ public class FileDataStorageManager {
         Uri share_uri = ProviderTableMeta.CONTENT_URI_SHARE;
         String where = ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + AND +
                 ProviderTableMeta._ID + "=?";
-        String[] whereArgs = new String[]{mAccount.name, Long.toString(share.getId())};
+        String[] whereArgs = new String[]{account.name, Long.toString(share.getId())};
         if (getContentProviderClient() != null) {
             try {
                 getContentProviderClient().delete(share_uri, where, whereArgs);
@@ -1597,7 +1581,7 @@ public class FileDataStorageManager {
                 cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
                 cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
                 cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
-                cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
+                cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, account.name);
                 cv.put(ProviderTableMeta.OCSHARES_IS_PASSWORD_PROTECTED, share.isPasswordProtected() ? 1 : 0);
                 cv.put(ProviderTableMeta.OCSHARES_NOTE, share.getNote());
 
@@ -1614,7 +1598,7 @@ public class FileDataStorageManager {
         if (folder != null) {
             String where = ProviderTableMeta.OCSHARES_PATH + AND
                     + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
-            String[] whereArgs = new String[]{"", mAccount.name};
+            String[] whereArgs = new String[]{"", account.name};
 
             List<OCFile> files = getFolderContent(folder, false);
 
@@ -1636,7 +1620,7 @@ public class FileDataStorageManager {
 
         String where = ProviderTableMeta.OCSHARES_PATH + AND
                 + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
-        String[] whereArgs = new String[]{filePath, mAccount.name};
+        String[] whereArgs = new String[]{filePath, account.name};
 
         preparedOperations.add(
                 ContentProviderOperation.newDelete(ProviderTableMeta.CONTENT_URI_SHARE).
@@ -1834,7 +1818,7 @@ public class FileDataStorageManager {
                                 ProviderTableMeta.CONTENT_URI_FILE,
                                 new String[]{ProviderTableMeta._ID},
                                 whereForDescencentsInConflict,
-                                new String[]{mAccount.name, parentPath + "%"},
+                                new String[]{account.name, parentPath + "%"},
                                 null
                         );
                     } else {
@@ -1843,7 +1827,7 @@ public class FileDataStorageManager {
                                     ProviderTableMeta.CONTENT_URI_FILE,
                                     new String[]{ProviderTableMeta._ID},
                                     whereForDescencentsInConflict,
-                                    new String[]{mAccount.name, parentPath + "%"},
+                                    new String[]{account.name, parentPath + "%"},
                                     null
                             );
                         } catch (RemoteException e) {
@@ -1858,7 +1842,7 @@ public class FileDataStorageManager {
                                     cv,
                                     ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
                                             ProviderTableMeta.FILE_PATH + "=?",
-                                    new String[]{mAccount.name, parentPath}
+                                    new String[]{account.name, parentPath}
                             );
                         } else {
                             try {
@@ -1867,7 +1851,7 @@ public class FileDataStorageManager {
                                         cv,
                                         ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
                                                 ProviderTableMeta.FILE_PATH + "=?"
-                                        , new String[]{mAccount.name, parentPath}
+                                        , new String[]{account.name, parentPath}
                                 );
                             } catch (RemoteException e) {
                                 Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage(), e);
@@ -1895,7 +1879,7 @@ public class FileDataStorageManager {
 
         // Prepare capabilities data
         ContentValues cv = new ContentValues();
-        cv.put(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME, mAccount.name);
+        cv.put(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME, account.name);
         cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MAYOR, capability.getVersionMayor());
         cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MINOR, capability.getVersionMinor());
         cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MICRO, capability.getVersionMicro());
@@ -1942,16 +1926,16 @@ public class FileDataStorageManager {
                 .getValue());
         cv.put(ProviderTableMeta.CAPABILITIES_ACTIVITY, capability.isActivityEnabled().getValue());
 
-        if (capabilityExists(mAccount.name)) {
+        if (capabilityExists(account.name)) {
             if (getContentResolver() != null) {
                 getContentResolver().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv,
                         ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
-                        new String[]{mAccount.name});
+                        new String[]{account.name});
             } else {
                 try {
                     getContentProviderClient().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES,
                             cv, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
-                            new String[]{mAccount.name});
+                            new String[]{account.name});
                 } catch (RemoteException e) {
                     Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
                 }
@@ -1973,7 +1957,7 @@ public class FileDataStorageManager {
                 long new_id = Long.parseLong(result_uri.getPathSegments()
                         .get(1));
                 capability.setId(new_id);
-                capability.setAccountName(mAccount.name);
+                capability.setAccountName(account.name);
             }
         }
 
@@ -2204,7 +2188,7 @@ public class FileDataStorageManager {
 
     public void deleteAllFiles() {
         String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?";
-        String[] whereArgs = new String[]{mAccount.name};
+        String[] whereArgs = new String[]{account.name};
 
         if (getContentResolver() != null) {
             getContentResolver().delete(ProviderTableMeta.CONTENT_URI_FILE, where, whereArgs);
@@ -2213,7 +2197,7 @@ public class FileDataStorageManager {
             try {
                 getContentProviderClient().delete(ProviderTableMeta.CONTENT_URI_FILE, where, whereArgs);
             } catch (RemoteException e) {
-                Log_OC.e(TAG, "Exception in deleteAllFiles for account " + mAccount.name + ": " + e.getMessage(), e);
+                Log_OC.e(TAG, "Exception in deleteAllFiles for account " + account.name + ": " + e.getMessage(), e);
             }
         }
     }

+ 11 - 80
src/main/java/com/owncloud/android/datamodel/FileSystemDataSet.java

@@ -2,8 +2,10 @@
  * Nextcloud Android client application
  *
  * @author Mario Danic
+ * @author Andy Scherzinger
  * Copyright (C) 2017 Mario Danic
  * Copyright (C) 2017 Nextcloud
+ * Copyright (C) 2018 Andy Scherzinger
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -22,11 +24,19 @@ package com.owncloud.android.datamodel;
 
 import android.support.annotation.Nullable;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
 /**
  * Model for filesystem data from the database.
  */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
 public class FileSystemDataSet {
-
     private int id;
     private String localPath;
     private long modifiedAt;
@@ -35,83 +45,4 @@ public class FileSystemDataSet {
     private long foundAt;
     private long syncedFolderId;
     @Nullable private String crc32;
-
-    public FileSystemDataSet() {
-    }
-
-    public FileSystemDataSet(int id, String localPath, long modifiedAt, boolean folder,
-                             boolean sentForUpload, long foundAt, long syncedFolderId, @Nullable String crc32) {
-        this.id = id;
-        this.localPath = localPath;
-        this.modifiedAt = modifiedAt;
-        this.folder = folder;
-        this.sentForUpload = sentForUpload;
-        this.foundAt = foundAt;
-        this.syncedFolderId = syncedFolderId;
-        this.crc32 = crc32;
-    }
-
-    public String getCrc32() {
-        return crc32;
-    }
-
-    public void setCrc32(String crc32) {
-        this.crc32 = crc32;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getLocalPath() {
-        return localPath;
-    }
-
-    public void setLocalPath(String localPath) {
-        this.localPath = localPath;
-    }
-
-    public long getModifiedAt() {
-        return modifiedAt;
-    }
-
-    public void setModifiedAt(long modifiedAt) {
-        this.modifiedAt = modifiedAt;
-    }
-
-    public boolean isFolder() {
-        return folder;
-    }
-
-    public void setFolder(boolean folder) {
-        this.folder = folder;
-    }
-
-    public long getFoundAt() {
-        return foundAt;
-    }
-
-    public void setFoundAt(long foundAt) {
-        this.foundAt = foundAt;
-    }
-
-    public boolean isSentForUpload() {
-        return sentForUpload;
-    }
-
-    public void setSentForUpload(boolean sentForUpload) {
-        this.sentForUpload = sentForUpload;
-    }
-
-    public long getSyncedFolderId() {
-        return syncedFolderId;
-    }
-
-    public void setSyncedFolderId(long syncedFolderId) {
-        this.syncedFolderId = syncedFolderId;
-    }
 }

+ 12 - 53
src/main/java/com/owncloud/android/datamodel/PushConfigurationState.java

@@ -1,8 +1,10 @@
-/**
+/*
  * Nextcloud Android client application
  *
  * @author Mario Danic
+ * @author Andy Scherzinger
  * Copyright (C) 2017 Mario Danic
+ * Copyright (C) 2018 Andy Scherzinger
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -20,62 +22,19 @@
 
 package com.owncloud.android.datamodel;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
 public class PushConfigurationState {
     public String pushToken;
     public String deviceIdentifier;
     public String deviceIdentifierSignature;
     public String userPublicKey;
     public boolean shouldBeDeleted;
-
-    public PushConfigurationState() {
-    }
-
-    public PushConfigurationState(String pushToken, String deviceIdentifier, String deviceIdentifierSignature,
-                             String userPublicKey, boolean shouldBeDeleted) {
-        this.pushToken = pushToken;
-        this.deviceIdentifier = deviceIdentifier;
-        this.deviceIdentifierSignature = deviceIdentifierSignature;
-        this.userPublicKey = userPublicKey;
-        this.shouldBeDeleted = shouldBeDeleted;
-    }
-
-    public String getPushToken() {
-        return pushToken;
-    }
-
-    public void setPushToken(String pushToken) {
-        this.pushToken = pushToken;
-    }
-
-    public String getDeviceIdentifier() {
-        return deviceIdentifier;
-    }
-
-    public void setDeviceIdentifier(String deviceIdentifier) {
-        this.deviceIdentifier = deviceIdentifier;
-    }
-
-    public String getDeviceIdentifierSignature() {
-        return deviceIdentifierSignature;
-    }
-
-    public void setDeviceIdentifierSignature(String deviceIdentifierSignature) {
-        this.deviceIdentifierSignature = deviceIdentifierSignature;
-    }
-
-    public String getUserPublicKey() {
-        return userPublicKey;
-    }
-
-    public void setUserPublicKey(String userPublicKey) {
-        this.userPublicKey = userPublicKey;
-    }
-
-    public boolean isShouldBeDeleted() {
-        return shouldBeDeleted;
-    }
-
-    public void setShouldBeDeleted(boolean shouldBeDeleted) {
-        this.shouldBeDeleted = shouldBeDeleted;
-    }
 }

+ 9 - 24
src/main/java/com/owncloud/android/datamodel/SignatureVerification.java

@@ -23,32 +23,17 @@ import android.accounts.Account;
 
 import org.parceler.Parcel;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
 @Parcel
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
 public class SignatureVerification {
     public boolean signatureValid;
     public Account account;
-
-    public SignatureVerification() {
-    }
-
-    public SignatureVerification(boolean signatureValid, Account account) {
-        this.signatureValid = signatureValid;
-        this.account = account;
-    }
-
-    public boolean isSignatureValid() {
-        return signatureValid;
-    }
-
-    public void setSignatureValid(boolean signatureValid) {
-        this.signatureValid = signatureValid;
-    }
-
-    public Account getAccount() {
-        return account;
-    }
-
-    public void setAccount(Account account) {
-        this.account = account;
-    }
 }

+ 4 - 5
src/main/java/com/owncloud/android/datamodel/VirtualFolderType.java

@@ -1,20 +1,20 @@
-/**
+/*
  * Nextcloud Android client application
  *
  * @author Tobias Kaminsky
  * Copyright (C) 2017 Tobias Kaminsky
  * Copyright (C) 2017 Nextcloud GmbH.
- * <p>
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * at your option) any later version.
- * <p>
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Affero General Public License for more details.
- * <p>
+ *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,7 +24,6 @@ package com.owncloud.android.datamodel;
 /**
  * Type for virtual folders
  */
-
 public enum VirtualFolderType {
     FAVORITE, PHOTOS, NONE
 }