|
@@ -1,4 +1,4 @@
|
|
-/**
|
|
|
|
|
|
+/*
|
|
* Nextcloud Android client application
|
|
* Nextcloud Android client application
|
|
*
|
|
*
|
|
* Copyright (C) 2017 Tobias Kaminsky
|
|
* Copyright (C) 2017 Tobias Kaminsky
|
|
@@ -9,12 +9,12 @@
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* License as published by the Free Software Foundation; either
|
|
* License as published by the Free Software Foundation; either
|
|
* version 3 of the License, or any later version.
|
|
* version 3 of the License, or any later version.
|
|
- * <p>
|
|
|
|
|
|
+ *
|
|
* This program is distributed in the hope that it will be useful,
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
- * <p>
|
|
|
|
|
|
+ *
|
|
* You should have received a copy of the GNU Affero General Public
|
|
* 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/>.
|
|
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
*/
|
|
@@ -29,8 +29,6 @@ import android.net.Uri;
|
|
import com.owncloud.android.db.ProviderMeta;
|
|
import com.owncloud.android.db.ProviderMeta;
|
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -61,15 +59,6 @@ public class ArbitraryDataProvider {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- public int deleteForKeyWhereAccountNotIn(List<String> accounts, String key) {
|
|
|
|
- return contentResolver.delete(
|
|
|
|
- ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
|
|
|
|
- ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " NOT IN (?) AND " +
|
|
|
|
- ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + "= ?",
|
|
|
|
- new String[]{String.valueOf(accounts), key}
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public void storeOrUpdateKeyValue(String accountName, String key, long newValue) {
|
|
public void storeOrUpdateKeyValue(String accountName, String key, long newValue) {
|
|
storeOrUpdateKeyValue(accountName, key, String.valueOf(newValue));
|
|
storeOrUpdateKeyValue(accountName, key, String.valueOf(newValue));
|
|
}
|
|
}
|
|
@@ -112,11 +101,11 @@ public class ArbitraryDataProvider {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public Long getLongValue(String accountName, String key) {
|
|
|
|
|
|
+ Long getLongValue(String accountName, String key) {
|
|
String value = getValue(accountName, key);
|
|
String value = getValue(accountName, key);
|
|
|
|
|
|
if (value.isEmpty()) {
|
|
if (value.isEmpty()) {
|
|
- return -1l;
|
|
|
|
|
|
+ return -1L;
|
|
} else {
|
|
} else {
|
|
return Long.valueOf(value);
|
|
return Long.valueOf(value);
|
|
}
|
|
}
|
|
@@ -138,9 +127,9 @@ public class ArbitraryDataProvider {
|
|
/**
|
|
/**
|
|
* returns integer if found else -1
|
|
* returns integer if found else -1
|
|
*
|
|
*
|
|
- * @param accountName
|
|
|
|
- * @param key
|
|
|
|
- * @return
|
|
|
|
|
|
+ * @param accountName name of account
|
|
|
|
+ * @param key key to get value for
|
|
|
|
+ * @return Integer specified by account and key
|
|
*/
|
|
*/
|
|
public Integer getIntegerValue(String accountName, String key) {
|
|
public Integer getIntegerValue(String accountName, String key) {
|
|
String value = getValue(accountName, key);
|
|
String value = getValue(accountName, key);
|
|
@@ -152,17 +141,6 @@ public class ArbitraryDataProvider {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * returns integer if found else -1
|
|
|
|
- *
|
|
|
|
- * @param account
|
|
|
|
- * @param key
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public Integer getIntegerValue(Account account, String key) {
|
|
|
|
- return getIntegerValue(account.name, key);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Returns stored value as string or empty string
|
|
* Returns stored value as string or empty string
|
|
* @return string if value found or empty string
|
|
* @return string if value found or empty string
|
|
@@ -238,34 +216,6 @@ public class ArbitraryDataProvider {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public class ArbitraryDataSet {
|
|
|
|
- private int id;
|
|
|
|
- private String cloudId;
|
|
|
|
- private String key;
|
|
|
|
- private String value;
|
|
|
|
-
|
|
|
|
- public ArbitraryDataSet(int id, String cloudId, String key, String value) {
|
|
|
|
- this.id = id;
|
|
|
|
- this.cloudId = cloudId;
|
|
|
|
- this.key = key;
|
|
|
|
- this.value = value;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public int getId() {
|
|
|
|
- return id;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- public String getCloudId() {
|
|
|
|
- return cloudId;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public String getKey() {
|
|
|
|
- return key;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public String getValue() {
|
|
|
|
- return value;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
}
|
|
}
|