Hi,

In fact, I already look at persistence/spi package, made a patch for myself 
that seems to work well in my case! (I double check and I really have "profile" 
in itemType field).

I wanted to create a pull-request on your Github with my patch, but it ask fro 
a UNOMI-XXXX tag and recommend to ask on dev mailing list! That's what I do!!!

I attach my patch to this email. As you can see, it seems that 
CustomObjectMapper register many kind of item types, except Profile.

But if you recommend to look at PropertyTypedObjectDeserializer to find a 
"cleaner" solution, I can try to figure it out.

Regards.
________________________________
De : Serge Huber <[email protected]>
Envoyé : mardi 3 mai 2022 11:55
À : [email protected] <[email protected]>
Objet : Re: Allow deserialization of profile in CustomObjectMapper

Hello Adrien,

I just checked and the deserialization is setup for the profile item type,
for "top level" item types, but maybe it is missing a mapping for the event
source and target properties. This is something that needs checking.

If you want to contribute that would be fantastic. I think it would be good
to look at the
https://github.com/apache/unomi/blob/64281306c770c710ec737f64ece7332f54e91cd5/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PropertyTypedObjectDeserializer.java#L53
object to see if it can work with sub-objects and if it can to see how we
could do a generic mapping system for event objects.

Regards,
  Serge Huber.
Serge Huber
CTO & Co-Founder
T +41 22 361 3424
9 route des Jeunes | 1227 Acacias | Switzerland
jahia.com <http://www.jahia.com/>
SKYPE | LINKEDIN <https://www.linkedin.com/in/sergehuber> | TWITTER
<https://twitter.com/sergehuber> | VCARD
<http://www.jahia.com/vcard/HuberSerge.vcf>


> JOIN OUR COMMUNITY <http://www.jahia.com/> to evaluate, get trained and
to discover why Jahia is a leading User Experience Platform (UXP) for
Digital Transformation.


On Thu, Apr 28, 2022 at 4:25 PM OLIVA Adrien <[email protected]> wrote:

> Hi,
>
> I found a "bug" in Unomi while doing some test.
> When a profile object is stored as event's target or source, Jackson
> failed to deserialize item while getting such events (through POST
> /cxs/events/search for instance).
>
> It appears that Profile deserializer is missing in CustomObjectMapper used
> in Unomi.
>
> How can I contribute to fix this issue.
>
> Regards.
>
>
>
> Adrien Oliva
> Ingénieur Logiciel
>
>                 ≡
>      S E F A S
> UNE MARQUE DE DOCAPOSTE
>
> 6 rue de l’étang - 90000 Belfort
> E-mail : [email protected]
> www.sefasinnovation.fr<http://www.sefasinnovation.fr> - 
> www.docaposte.com<http://www.docaposte.com>
>
>
> Sefas est une marque de Docaposte, filiale du Groupe La Poste.
> Adoptez l’éco-attitude : n’imprimez que si cela vous semble
> nécessaire.
> Si vous recevez ce mail en dehors de vos heures de travail ou
> pendant vos congés, vous n’avez pas à y répondre immédiatement,
> sauf en cas d'urgence exceptionnelle.
>
>
From 362f0cc32783e6729abac191ec2bd5cdd9aaa218 Mon Sep 17 00:00:00 2001
From: Adrien Oliva <[email protected]>
Date: Thu, 28 Apr 2022 14:51:22 +0200
Subject: [PATCH] Allow deserialization of profile in event

---
 .../org/apache/unomi/persistence/spi/CustomObjectMapper.java     | 1 +
 1 file changed, 1 insertion(+)

diff --git a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java
index 3e33f13e..2936ee5b 100644
--- a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java
+++ b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/CustomObjectMapper.java
@@ -76,6 +76,7 @@ public class CustomObjectMapper extends ObjectMapper {
         classes.put(Session.ITEM_TYPE, Session.class);
         classes.put(ConditionType.ITEM_TYPE, ConditionType.class);
         classes.put(ActionType.ITEM_TYPE, ActionType.class);
+        classes.put(Profile.ITEM_TYPE, Profile.class);
         for (Map.Entry<String, Class<? extends Item>> entry : classes.entrySet()) {
             propertyTypedObjectDeserializer.registerMapping("itemType=" + entry.getKey(), entry.getValue());
             itemDeserializer.registerMapping(entry.getKey(), entry.getValue());
-- 
2.36.0

Reply via email to