From 59caa953f808627f679701464f3cc6ce929cf201 Mon Sep 17 00:00:00 2001 From: Amanpal Singh <87360222+aman-alfresco@users.noreply.github.com> Date: Thu, 17 Aug 2023 22:59:01 -0700 Subject: [PATCH] MOBILEAPPS-2042 (#55) * added allowable operation for favorite api --- content/build.gradle | 2 +- .../com/alfresco/content/models/Favorite.kt | 2 ++ .../java/com/alfresco/sample/MainViewModel.kt | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/content/build.gradle b/content/build.gradle index f39a773..1585539 100644 --- a/content/build.gradle +++ b/content/build.gradle @@ -11,7 +11,7 @@ android { } namespace 'com.alfresco.content' defaultConfig { - versionName "0.3.2" + versionName "0.3.3" } } diff --git a/content/src/main/kotlin/com/alfresco/content/models/Favorite.kt b/content/src/main/kotlin/com/alfresco/content/models/Favorite.kt index 8d019ac..2a5d969 100644 --- a/content/src/main/kotlin/com/alfresco/content/models/Favorite.kt +++ b/content/src/main/kotlin/com/alfresco/content/models/Favorite.kt @@ -15,11 +15,13 @@ import java.time.ZonedDateTime * @property targetGuid The guid of the object that is a favorite. * @property createdAt The time the object was made a favorite. * @property target + * @property allowableOperations * @property properties A subset of the target favorite properties, system properties and properties already available in the target are excluded. */ @JsonClass(generateAdapter = true) data class Favorite( @Json(name = "targetGuid") @field:Json(name = "targetGuid") var targetGuid: String, + @Json(name = "allowableOperations") @field:Json(name = "allowableOperations") var allowableOperations: List? = null, @Json(name = "target") @field:Json(name = "target") var target: FavoriteTarget, @Json(name = "createdAt") @field:Json(name = "createdAt") var createdAt: ZonedDateTime? = null, @Json(name = "properties") @field:Json(name = "properties") var properties: Map? = null diff --git a/sample/src/main/java/com/alfresco/sample/MainViewModel.kt b/sample/src/main/java/com/alfresco/sample/MainViewModel.kt index de5f173..c1ccd52 100644 --- a/sample/src/main/java/com/alfresco/sample/MainViewModel.kt +++ b/sample/src/main/java/com/alfresco/sample/MainViewModel.kt @@ -9,7 +9,9 @@ import com.alfresco.auth.AuthConfig import com.alfresco.auth.AuthInterceptor import com.alfresco.auth.data.MutableLiveEvent import com.alfresco.content.apis.AdvanceSearchInclude +import com.alfresco.content.apis.AlfrescoApi import com.alfresco.content.apis.FacetSearchInclude +import com.alfresco.content.apis.FavoritesApi import com.alfresco.content.apis.NodesApi import com.alfresco.content.apis.SearchApi import com.alfresco.content.apis.TrashcanApi @@ -104,6 +106,7 @@ class MainViewModel(private val context: Context) : ViewModel() { fun loadRecents() { val service = retrofit.create(SearchApi::class.java) val trashApi = retrofit.create(TrashcanApi::class.java) + val favoritesApi = retrofit.create(FavoritesApi::class.java) val serviceApi1 = retrofit.create(NodesApi::class.java) val serviceAPS = retrofitAPS.create(TaskAPI::class.java) val serviceAPS1 = retrofitAPS.create(ProcessAPI::class.java) @@ -210,12 +213,34 @@ class MainViewModel(private val context: Context) : ViewModel() { facetFormat = "V2" ) + /* + * val where = "(EXISTS(target/file) OR EXISTS(target/folder))" + val include = AlfrescoApi.csvQueryParam("path", "allowableOperations") + val orderBy = listOf("title ASC") + * + */ + + val where = "(EXISTS(target/file) OR EXISTS(target/folder))" + val include = AlfrescoApi.csvQueryParam("path", "allowableOperations") + val orderBy = listOf("title ASC") + + val responseFavorite = favoritesApi.listFavorites( + AlfrescoApi.CURRENT_USER, + 0, + 25, + orderBy, + where, + include, + null, + ) + // val taskList = serviceAPS1.startForm("singlereviewer7-2-23:1:36") // println("data task 11 ==> ${taskList.fields?.first()?.getFieldMapAsList()}") val list = searchCall.list?.entries?.map { it.entry } ?: emptyList() results.value = list + println("Response favorite $responseFavorite") /*val response = serviceApi1.deleteNode("ea7ccff4-3b8c-48f7-ae75-3b5fbba1e00d")