Skip to content

Commit

Permalink
MOBILEAPPS-2042 (#55)
Browse files Browse the repository at this point in the history
* added allowable operation for favorite api
  • Loading branch information
aman-alfresco authored Aug 18, 2023
1 parent 90ca037 commit 59caa95
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion content/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
}
namespace 'com.alfresco.content'
defaultConfig {
versionName "0.3.2"
versionName "0.3.3"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>? = 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<String, Any?>? = null
Expand Down
25 changes: 25 additions & 0 deletions sample/src/main/java/com/alfresco/sample/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 59caa95

Please sign in to comment.