Skip to content

Conversation

@tomaszmlocek-pega
Copy link
Contributor

…gine. Extended API to support openAssignment action.

…gine. Extended API to support openAssignment action.
@tomaszmlocek-pega tomaszmlocek-pega requested a review from a team as a code owner October 22, 2025 10:55
@tomaszmlocek-pega tomaszmlocek-pega force-pushed the feature/mloct/TASK-1816943 branch from ecce1a9 to e32a89b Compare October 22, 2025 13:24
}


object ConstellationSdkKActionSerializer : KSerializer<ConstellationSdkAction> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most probably this custom serializer is not needed as kotlin should handle serialization of sealed classes out of the box. You just need to add @Serialiable to sealed class and subclasses and use type as a class discriminator instead of actionType.

import kotlinx.serialization.json.Json

@Serializable
data class EngineConfiguration(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be implementation-detail of specific engine. I'd move it to engine-webview > commonMain and make it internal, as it is not something to be used by SDK clients. Btw - commonMain sourceset was recently created here: https://github.com/pegasystems/constellation-mobile-sdk/pull/49/files#diff-2398e22a8cacbeea18a4b5885f734cb50ef9029a687327c36481db76d377e40a


private const val TAG = "JsonHelper"

fun Any.toJsonElement(): JsonElement? = when (this) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be internal

@tomaszmlocek-pega tomaszmlocek-pega force-pushed the feature/mloct/TASK-1816943 branch from eee20c5 to 634eaa9 Compare October 22, 2025 14:25
val jsonElements = this.mapNotNull {
it?.toJsonElement() ?: run {
val type = it?.let { it::class } ?: "null"
Log.w(TAG, "Unsupported type $type, cannot convert to JsonElement.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't it result in duplicated logs for the same type? It seems that the same log will be printed from else branch (as we're calling toJsonElement recursively). I think we could get rid of that run {} block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point - will refactor it

if (config.action.actionType === "CreateCase") {
await createCase(config.action.caseClassName, config.action.startingFields);
} else if (config.action.actionType === "OpenAssignment") {
await openAssignment(config.action.assignmentId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it is okay for now, but in the future we should consider making it possible to "interact" with the application/engine instead of just reinitializing everything each time we want to open or create something.

};

console.log("[OpenAssignment]", "Opening assignment: " + assignmentId);
await PCore.getMashupApi().openAssignment(assignmentId, PCore.getConstants().APP.APP, options);
Copy link
Contributor

@lukaszgajewski-pega lukaszgajewski-pega Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that's so simple 😎

Copy link
Contributor

@lukaszgajewski-pega lukaszgajewski-pega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review completed, please take a look at my comments.

@tomaszmlocek-pega tomaszmlocek-pega merged commit 56bb807 into master Oct 22, 2025
4 checks passed
@lukaszgajewski-pega lukaszgajewski-pega deleted the feature/mloct/TASK-1816943 branch October 22, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants