osaf/services/saf/immsv/immnd/ImmModel.cc |  27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)


This patch modifies the content of incoming IMMND_EVT_A2ND_OBJ_MODIFY messages.
If the modType is SA_IMM_ATTR_VALUES_ADD or SA_IMM_ATTR_VALUES_DELETE,
it will be converted to SA_IMM_ATTR_VALUES_REPLACE and the values of the 
attr-mod will be the values in the after image.

diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc 
b/osaf/services/saf/immsv/immnd/ImmModel.cc
--- a/osaf/services/saf/immsv/immnd/ImmModel.cc
+++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
@@ -8705,6 +8705,33 @@ ImmModel::ccbObjectModify(const ImmsvOmC
         if(err != SA_AIS_OK) {
             break; //out of for-loop
         }
+
+        if (p->attrModType != SA_IMM_ATTR_VALUES_REPLACE) {
+            osafassert(p->attrValue.attrValuesNumber);
+            /* Free attribute values of the attr-mod */
+            immsv_evt_free_att_val_raw(&(p->attrValue.attrValue),
+                                       p->attrValue.attrValueType);
+            if (p->attrValue.attrValuesNumber > 1) {
+                immsv_free_attr_list_raw(p->attrValue.attrMoreValues,
+                                         p->attrValue.attrValueType);
+                p->attrValue.attrMoreValues = NULL;
+            }
+            p->attrValue.attrValuesNumber = 0;
+
+            TRACE("Canonicalizing attr-mod for attribute '%s'", 
attrName.c_str());
+            p->attrModType = SA_IMM_ATTR_VALUES_REPLACE;
+            if (!attrValue->empty()) {
+                attrValue->copyValueToEdu(&(p->attrValue.attrValue),
+                                          (SaImmValueTypeT) 
p->attrValue.attrValueType);
+                if (attrValue->extraValues()) {
+                    osafassert(attrValue->isMultiValued());
+                    ImmAttrMultiValue* multiVal = (ImmAttrMultiValue *) 
attrValue;
+                    
multiVal->copyExtraValuesToEdu(&(p->attrValue.attrMoreValues),
+                                                   (SaImmValueTypeT) 
p->attrValue.attrValueType);
+                }
+                p->attrValue.attrValuesNumber = 1 + attrValue->extraValues();
+            } /* else, attrValuesNumber is already set to 0 */
+        }
     }//for (p = ....)
 
     // Prepare for call on PersistentBackEnd

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to