From 70c52b1e282e5e8d7fea86579f0809a1c5c2ad2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 25 Jan 2024 08:35:51 +0100 Subject: [PATCH 1/4] FIX refactor to simplific logic --- src/lib/ngsi/ContextAttributeVector.cpp | 6 ++---- src/lib/ngsi/ContextAttributeVector.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/ngsi/ContextAttributeVector.cpp b/src/lib/ngsi/ContextAttributeVector.cpp index 81608abe78..7c24d6064f 100644 --- a/src/lib/ngsi/ContextAttributeVector.cpp +++ b/src/lib/ngsi/ContextAttributeVector.cpp @@ -309,9 +309,7 @@ void ContextAttributeVector::fill ( const orion::BSONObj& attrs, const StringList& attrL, - bool includeEmpty, - const std::string& locAttr, - ApiVersion apiVersion + bool includeEmpty ) { std::set attrNames; @@ -440,7 +438,7 @@ void ContextAttributeVector::fill void ContextAttributeVector::fill(const orion::BSONObj& attrs) { StringList emptyList; - return fill(attrs, emptyList, true, "", V2); + return fill(attrs, emptyList, true); } diff --git a/src/lib/ngsi/ContextAttributeVector.h b/src/lib/ngsi/ContextAttributeVector.h index 05cc96c260..559db1ab3b 100644 --- a/src/lib/ngsi/ContextAttributeVector.h +++ b/src/lib/ngsi/ContextAttributeVector.h @@ -52,7 +52,7 @@ typedef struct ContextAttributeVector unsigned int size(void) const; void release(void); void fill(const ContextAttributeVector& caV, bool useDefaultType = false, bool cloneCompounds = false); - void fill(const orion::BSONObj& attrs, const StringList& attrL, bool includeEmpty, const std::string& locAttr, ApiVersion apiVersion); + void fill(const orion::BSONObj& attrs, const StringList& attrL, bool includeEmpty); void fill(const orion::BSONObj& attrs); int get(const std::string& attributeName) const; From c67d7ad72482cd66036debddb7b60d194ad16546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 25 Jan 2024 09:56:09 +0100 Subject: [PATCH 2/4] FIX simplification --- src/lib/mongoBackend/MongoCommonUpdate.cpp | 4 ++-- src/lib/mongoBackend/MongoGlobal.cpp | 4 ++-- src/lib/mongoBackend/MongoGlobal.h | 2 +- src/lib/mongoBackend/mongoQueryContext.cpp | 2 +- src/lib/ngsi/ContextAttributeVector.cpp | 8 ++++---- src/lib/ngsi/ContextAttributeVector.h | 2 +- src/lib/ngsi/ContextElementResponse.cpp | 20 ++++++++++---------- src/lib/ngsi/ContextElementResponse.h | 5 ++--- 8 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/lib/mongoBackend/MongoCommonUpdate.cpp b/src/lib/mongoBackend/MongoCommonUpdate.cpp index 8593d6e084..bdaa38140c 100644 --- a/src/lib/mongoBackend/MongoCommonUpdate.cpp +++ b/src/lib/mongoBackend/MongoCommonUpdate.cpp @@ -3504,7 +3504,7 @@ static unsigned int updateEntity /* Build CER used for notifying (if needed) */ StringList emptyAttrL; - ContextElementResponse* notifyCerP = new ContextElementResponse(r, emptyAttrL, true, apiVersion); + ContextElementResponse* notifyCerP = new ContextElementResponse(r, emptyAttrL/*, true*/); // The hasField() check is needed as the entity could have been created with very old Orion version not // supporting modification/creation dates @@ -3921,7 +3921,7 @@ static unsigned int updateEntity notifyCerP->release(); delete notifyCerP; - notifyCerP = new ContextElementResponse(getObjectFieldF(reply, "value"), emptyAttrL, true, apiVersion); + notifyCerP = new ContextElementResponse(getObjectFieldF(reply, "value"), emptyAttrL/*, true*/); } } else diff --git a/src/lib/mongoBackend/MongoGlobal.cpp b/src/lib/mongoBackend/MongoGlobal.cpp index 9b0cca0054..01d3fcabb6 100644 --- a/src/lib/mongoBackend/MongoGlobal.cpp +++ b/src/lib/mongoBackend/MongoGlobal.cpp @@ -1398,7 +1398,7 @@ bool entitiesQuery const Restriction& res, ContextElementResponseVector* cerV, std::string* err, - bool includeEmpty, + //bool includeEmpty, const std::string& tenant, const std::vector& servicePath, int offset, @@ -1636,7 +1636,7 @@ bool entitiesQuery // Build CER from BSON retrieved from DB docs++; LM_T(LmtMongo, ("retrieved document [%d]: '%s'", docs, r.toString().c_str())); - ContextElementResponse* cer = new ContextElementResponse(r, attrL, includeEmpty, apiVersion); + ContextElementResponse* cer = new ContextElementResponse(r, attrL/*, includeEmpty*/); // Add builtin attributes and metadata (only in NGSIv2) if (apiVersion == V2) diff --git a/src/lib/mongoBackend/MongoGlobal.h b/src/lib/mongoBackend/MongoGlobal.h index 9b750e01b5..921d86aa44 100644 --- a/src/lib/mongoBackend/MongoGlobal.h +++ b/src/lib/mongoBackend/MongoGlobal.h @@ -230,7 +230,7 @@ extern bool entitiesQuery const Restriction& res, ContextElementResponseVector* cerV, std::string* err, - bool includeEmpty, + //bool includeEmpty, const std::string& tenant, const std::vector& servicePath, int offset = DEFAULT_PAGINATION_OFFSET_INT, diff --git a/src/lib/mongoBackend/mongoQueryContext.cpp b/src/lib/mongoBackend/mongoQueryContext.cpp index fd8f1799b5..4cfb8c1331 100644 --- a/src/lib/mongoBackend/mongoQueryContext.cpp +++ b/src/lib/mongoBackend/mongoQueryContext.cpp @@ -362,7 +362,7 @@ HttpStatusCode mongoQueryContext requestP->restriction, &rawCerV, &err, - true, + //true, tenant, servicePathV, offset, diff --git a/src/lib/ngsi/ContextAttributeVector.cpp b/src/lib/ngsi/ContextAttributeVector.cpp index 7c24d6064f..e47db81393 100644 --- a/src/lib/ngsi/ContextAttributeVector.cpp +++ b/src/lib/ngsi/ContextAttributeVector.cpp @@ -308,8 +308,8 @@ void ContextAttributeVector::fill(const ContextAttributeVector& caV, bool useDef void ContextAttributeVector::fill ( const orion::BSONObj& attrs, - const StringList& attrL, - bool includeEmpty + const StringList& attrL/*, + bool includeEmpty*/ ) { std::set attrNames; @@ -344,7 +344,7 @@ void ContextAttributeVector::fill { case orion::String: ca.stringValue = getStringFieldF(attr, ENT_ATTRS_VALUE); - if (!includeEmpty && ca.stringValue.empty()) + if (!true && ca.stringValue.empty()) { continue; } @@ -438,7 +438,7 @@ void ContextAttributeVector::fill void ContextAttributeVector::fill(const orion::BSONObj& attrs) { StringList emptyList; - return fill(attrs, emptyList, true); + return fill(attrs, emptyList/*, true*/); } diff --git a/src/lib/ngsi/ContextAttributeVector.h b/src/lib/ngsi/ContextAttributeVector.h index 559db1ab3b..338d7be427 100644 --- a/src/lib/ngsi/ContextAttributeVector.h +++ b/src/lib/ngsi/ContextAttributeVector.h @@ -52,7 +52,7 @@ typedef struct ContextAttributeVector unsigned int size(void) const; void release(void); void fill(const ContextAttributeVector& caV, bool useDefaultType = false, bool cloneCompounds = false); - void fill(const orion::BSONObj& attrs, const StringList& attrL, bool includeEmpty); + void fill(const orion::BSONObj& attrs, const StringList& attrL/*, bool includeEmpty*/); void fill(const orion::BSONObj& attrs); int get(const std::string& attributeName) const; diff --git a/src/lib/ngsi/ContextElementResponse.cpp b/src/lib/ngsi/ContextElementResponse.cpp index 9d57aa0867..ecffd2b76c 100644 --- a/src/lib/ngsi/ContextElementResponse.cpp +++ b/src/lib/ngsi/ContextElementResponse.cpp @@ -98,9 +98,8 @@ ContextElementResponse::ContextElementResponse(ContextElementResponse* cerP, boo ContextElementResponse::ContextElementResponse ( const orion::BSONObj& entityDoc, - const StringList& attrL, - bool includeEmpty, - ApiVersion apiVersion + const StringList& attrL/*, + bool includeEmpty*/ ) { prune = false; @@ -125,7 +124,8 @@ ContextElementResponse::ContextElementResponse // // Attribute vector // - orion::BSONObj attrs = getObjectFieldF(entityDoc, ENT_ATTRS); + entity.attributeVector.fill(getObjectFieldF(entityDoc, ENT_ATTRS), attrL/*, includeEmpty*/); + /*orion::BSONObj attrs = getObjectFieldF(entityDoc, ENT_ATTRS); std::set attrNames; attrs.getFieldNames(&attrNames); @@ -146,8 +146,8 @@ ContextElementResponse::ContextElementResponse continue; } - /* It could happen (although very rarely) that the value field is missing in the - * DB for the attribute. The following is a safety check measure to protect against that */ + // It could happen (although very rarely) that the value field is missing in the + // DB for the attribute. The following is a safety check measure to protect against that if (!attr.hasField(ENT_ATTRS_VALUE)) { caP = new ContextAttribute(ca.name, ca.type, ""); @@ -204,13 +204,13 @@ ContextElementResponse::ContextElementResponse } } - /* dateExpires is managed like a regular attribute in DB, but it is a builtin and it is shadowed */ + // dateExpires is managed like a regular attribute in DB, but it is a builtin and it is shadowed if (caP->name == DATE_EXPIRES) { caP->shadowed = true; } - /* Setting custom metadata (if any) */ + // Setting custom metadata (if any) if (attr.hasField(ENT_ATTRS_MD)) { orion::BSONObj mds = getObjectFieldF(attr, ENT_ATTRS_MD); @@ -225,7 +225,7 @@ ContextElementResponse::ContextElementResponse } } - /* Set creDate and modDate at attribute level */ + // Set creDate and modDate at attribute level if (attr.hasField(ENT_ATTRS_CREATION_DATE)) { caP->creDate = getNumberFieldF(attr, ENT_ATTRS_CREATION_DATE); @@ -237,7 +237,7 @@ ContextElementResponse::ContextElementResponse } entity.attributeVector.push_back(caP); - } + }*/ /* Set creDate and modDate at entity level */ if (entityDoc.hasField(ENT_CREATION_DATE)) diff --git a/src/lib/ngsi/ContextElementResponse.h b/src/lib/ngsi/ContextElementResponse.h index 999dd50a48..b86fe53e92 100644 --- a/src/lib/ngsi/ContextElementResponse.h +++ b/src/lib/ngsi/ContextElementResponse.h @@ -61,9 +61,8 @@ typedef struct ContextElementResponse ContextElementResponse(EntityId* eP, ContextAttribute* aP); ContextElementResponse(ContextElementResponse* cerP, bool cloneCompound = false); ContextElementResponse(const orion::BSONObj& entityDoc, - const StringList& attrL, - bool includeEmpty = true, - ApiVersion apiVersion = V1); + const StringList& attrL/*, + bool includeEmpty = true*/); ContextElementResponse(Entity* eP, bool useDefaultType = false); std::string toJsonV1(bool asJsonObject, From 670495a1eeac27044c98ad74af43fc7b57738896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 25 Jan 2024 10:26:25 +0100 Subject: [PATCH 3/4] FIX cleanup --- src/lib/mongoBackend/MongoCommonUpdate.cpp | 4 ++-- src/lib/mongoBackend/MongoGlobal.cpp | 8 +------- src/lib/mongoBackend/MongoGlobal.h | 1 - src/lib/ngsi/ContextAttributeVector.cpp | 7 +------ src/lib/ngsi/ContextAttributeVector.h | 2 +- src/lib/ngsi/ContextElementResponse.cpp | 5 ++--- src/lib/ngsi/ContextElementResponse.h | 3 +-- 7 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/lib/mongoBackend/MongoCommonUpdate.cpp b/src/lib/mongoBackend/MongoCommonUpdate.cpp index bdaa38140c..03617d9d50 100644 --- a/src/lib/mongoBackend/MongoCommonUpdate.cpp +++ b/src/lib/mongoBackend/MongoCommonUpdate.cpp @@ -3504,7 +3504,7 @@ static unsigned int updateEntity /* Build CER used for notifying (if needed) */ StringList emptyAttrL; - ContextElementResponse* notifyCerP = new ContextElementResponse(r, emptyAttrL/*, true*/); + ContextElementResponse* notifyCerP = new ContextElementResponse(r, emptyAttrL); // The hasField() check is needed as the entity could have been created with very old Orion version not // supporting modification/creation dates @@ -3921,7 +3921,7 @@ static unsigned int updateEntity notifyCerP->release(); delete notifyCerP; - notifyCerP = new ContextElementResponse(getObjectFieldF(reply, "value"), emptyAttrL/*, true*/); + notifyCerP = new ContextElementResponse(getObjectFieldF(reply, "value"), emptyAttrL); } } else diff --git a/src/lib/mongoBackend/MongoGlobal.cpp b/src/lib/mongoBackend/MongoGlobal.cpp index 01d3fcabb6..85308f228b 100644 --- a/src/lib/mongoBackend/MongoGlobal.cpp +++ b/src/lib/mongoBackend/MongoGlobal.cpp @@ -1385,11 +1385,6 @@ static bool isCustomAttr(std::string attrName) * This method is used by queryContext. It takes a vector with entities and a vector * with attributes as input and returns the corresponding ContextElementResponseVector or error. * -* Note the includeEmpty argument. This is used if we don't want the result to include empty -* attributes, i.e. the ones that cause ''. This is aimed at -* subscribeContext case, as empty values can cause problems in the case of federating Context -* Brokers (the notifyContext is processed as an updateContext and in the latter case, an -* empty value causes an error) */ bool entitiesQuery ( @@ -1398,7 +1393,6 @@ bool entitiesQuery const Restriction& res, ContextElementResponseVector* cerV, std::string* err, - //bool includeEmpty, const std::string& tenant, const std::vector& servicePath, int offset, @@ -1636,7 +1630,7 @@ bool entitiesQuery // Build CER from BSON retrieved from DB docs++; LM_T(LmtMongo, ("retrieved document [%d]: '%s'", docs, r.toString().c_str())); - ContextElementResponse* cer = new ContextElementResponse(r, attrL/*, includeEmpty*/); + ContextElementResponse* cer = new ContextElementResponse(r, attrL); // Add builtin attributes and metadata (only in NGSIv2) if (apiVersion == V2) diff --git a/src/lib/mongoBackend/MongoGlobal.h b/src/lib/mongoBackend/MongoGlobal.h index 921d86aa44..caa6058e8f 100644 --- a/src/lib/mongoBackend/MongoGlobal.h +++ b/src/lib/mongoBackend/MongoGlobal.h @@ -230,7 +230,6 @@ extern bool entitiesQuery const Restriction& res, ContextElementResponseVector* cerV, std::string* err, - //bool includeEmpty, const std::string& tenant, const std::vector& servicePath, int offset = DEFAULT_PAGINATION_OFFSET_INT, diff --git a/src/lib/ngsi/ContextAttributeVector.cpp b/src/lib/ngsi/ContextAttributeVector.cpp index e47db81393..e1214bb8a1 100644 --- a/src/lib/ngsi/ContextAttributeVector.cpp +++ b/src/lib/ngsi/ContextAttributeVector.cpp @@ -308,8 +308,7 @@ void ContextAttributeVector::fill(const ContextAttributeVector& caV, bool useDef void ContextAttributeVector::fill ( const orion::BSONObj& attrs, - const StringList& attrL/*, - bool includeEmpty*/ + const StringList& attrL ) { std::set attrNames; @@ -344,10 +343,6 @@ void ContextAttributeVector::fill { case orion::String: ca.stringValue = getStringFieldF(attr, ENT_ATTRS_VALUE); - if (!true && ca.stringValue.empty()) - { - continue; - } caP = new ContextAttribute(ca.name, ca.type, ca.stringValue); break; diff --git a/src/lib/ngsi/ContextAttributeVector.h b/src/lib/ngsi/ContextAttributeVector.h index 338d7be427..6c32b17a4f 100644 --- a/src/lib/ngsi/ContextAttributeVector.h +++ b/src/lib/ngsi/ContextAttributeVector.h @@ -52,7 +52,7 @@ typedef struct ContextAttributeVector unsigned int size(void) const; void release(void); void fill(const ContextAttributeVector& caV, bool useDefaultType = false, bool cloneCompounds = false); - void fill(const orion::BSONObj& attrs, const StringList& attrL/*, bool includeEmpty*/); + void fill(const orion::BSONObj& attrs, const StringList& attrL); void fill(const orion::BSONObj& attrs); int get(const std::string& attributeName) const; diff --git a/src/lib/ngsi/ContextElementResponse.cpp b/src/lib/ngsi/ContextElementResponse.cpp index ecffd2b76c..8da3c10aa0 100644 --- a/src/lib/ngsi/ContextElementResponse.cpp +++ b/src/lib/ngsi/ContextElementResponse.cpp @@ -98,8 +98,7 @@ ContextElementResponse::ContextElementResponse(ContextElementResponse* cerP, boo ContextElementResponse::ContextElementResponse ( const orion::BSONObj& entityDoc, - const StringList& attrL/*, - bool includeEmpty*/ + const StringList& attrL ) { prune = false; @@ -124,7 +123,7 @@ ContextElementResponse::ContextElementResponse // // Attribute vector // - entity.attributeVector.fill(getObjectFieldF(entityDoc, ENT_ATTRS), attrL/*, includeEmpty*/); + entity.attributeVector.fill(getObjectFieldF(entityDoc, ENT_ATTRS), attrL); /*orion::BSONObj attrs = getObjectFieldF(entityDoc, ENT_ATTRS); std::set attrNames; diff --git a/src/lib/ngsi/ContextElementResponse.h b/src/lib/ngsi/ContextElementResponse.h index b86fe53e92..87b3bc17b1 100644 --- a/src/lib/ngsi/ContextElementResponse.h +++ b/src/lib/ngsi/ContextElementResponse.h @@ -61,8 +61,7 @@ typedef struct ContextElementResponse ContextElementResponse(EntityId* eP, ContextAttribute* aP); ContextElementResponse(ContextElementResponse* cerP, bool cloneCompound = false); ContextElementResponse(const orion::BSONObj& entityDoc, - const StringList& attrL/*, - bool includeEmpty = true*/); + const StringList& attrL); ContextElementResponse(Entity* eP, bool useDefaultType = false); std::string toJsonV1(bool asJsonObject, From e64bcdbe53e8e2e8d380183951c9084bb0ce0018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 25 Jan 2024 11:10:16 +0100 Subject: [PATCH 4/4] FIX simplification and cleanup --- src/lib/mongoBackend/mongoQueryContext.cpp | 1 - src/lib/ngsi/ContextAttributeVector.cpp | 2 +- src/lib/ngsi/ContextElementResponse.cpp | 113 --------------------- 3 files changed, 1 insertion(+), 115 deletions(-) diff --git a/src/lib/mongoBackend/mongoQueryContext.cpp b/src/lib/mongoBackend/mongoQueryContext.cpp index 4cfb8c1331..32b51170f2 100644 --- a/src/lib/mongoBackend/mongoQueryContext.cpp +++ b/src/lib/mongoBackend/mongoQueryContext.cpp @@ -362,7 +362,6 @@ HttpStatusCode mongoQueryContext requestP->restriction, &rawCerV, &err, - //true, tenant, servicePathV, offset, diff --git a/src/lib/ngsi/ContextAttributeVector.cpp b/src/lib/ngsi/ContextAttributeVector.cpp index e1214bb8a1..5a11b4d89e 100644 --- a/src/lib/ngsi/ContextAttributeVector.cpp +++ b/src/lib/ngsi/ContextAttributeVector.cpp @@ -433,7 +433,7 @@ void ContextAttributeVector::fill void ContextAttributeVector::fill(const orion::BSONObj& attrs) { StringList emptyList; - return fill(attrs, emptyList/*, true*/); + return fill(attrs, emptyList); } diff --git a/src/lib/ngsi/ContextElementResponse.cpp b/src/lib/ngsi/ContextElementResponse.cpp index 8da3c10aa0..ba9d3ae0b2 100644 --- a/src/lib/ngsi/ContextElementResponse.cpp +++ b/src/lib/ngsi/ContextElementResponse.cpp @@ -124,119 +124,6 @@ ContextElementResponse::ContextElementResponse // Attribute vector // entity.attributeVector.fill(getObjectFieldF(entityDoc, ENT_ATTRS), attrL); - /*orion::BSONObj attrs = getObjectFieldF(entityDoc, ENT_ATTRS); - std::set attrNames; - - attrs.getFieldNames(&attrNames); - for (std::set::iterator i = attrNames.begin(); i != attrNames.end(); ++i) - { - std::string attrName = *i; - orion::BSONObj attr = getObjectFieldF(attrs, attrName); - ContextAttribute* caP = NULL; - ContextAttribute ca; - - // Name and type - ca.name = dbDecode(attrName); - ca.type = getStringFieldF(attr, ENT_ATTRS_TYPE); - - // Skip attribute if the attribute is in the list (or attrL is empty or includes "*") - if (!includedAttribute(ca.name, attrL)) - { - continue; - } - - // It could happen (although very rarely) that the value field is missing in the - // DB for the attribute. The following is a safety check measure to protect against that - if (!attr.hasField(ENT_ATTRS_VALUE)) - { - caP = new ContextAttribute(ca.name, ca.type, ""); - } - else - { - switch(getFieldF(attr, ENT_ATTRS_VALUE).type()) - { - case orion::String: - ca.stringValue = getStringFieldF(attr, ENT_ATTRS_VALUE); - if (!includeEmpty && ca.stringValue.empty()) - { - continue; - } - caP = new ContextAttribute(ca.name, ca.type, ca.stringValue); - break; - - case orion::NumberDouble: - ca.numberValue = getNumberFieldF(attr, ENT_ATTRS_VALUE); - caP = new ContextAttribute(ca.name, ca.type, ca.numberValue); - break; - - case orion::NumberInt: - ca.numberValue = (double) getIntFieldF(attr, ENT_ATTRS_VALUE); - caP = new ContextAttribute(ca.name, ca.type, ca.numberValue); - break; - - case orion::Bool: - ca.boolValue = getBoolFieldF(attr, ENT_ATTRS_VALUE); - caP = new ContextAttribute(ca.name, ca.type, ca.boolValue); - break; - - case orion::jstNULL: - caP = new ContextAttribute(ca.name, ca.type, ""); - caP->valueType = orion::ValueTypeNull; - break; - - case orion::Object: - caP = new ContextAttribute(ca.name, ca.type, ""); - caP->compoundValueP = new orion::CompoundValueNode(orion::ValueTypeObject); - caP->valueType = orion::ValueTypeObject; - compoundObjectResponse(caP->compoundValueP, getFieldF(attr, ENT_ATTRS_VALUE)); - break; - - case orion::Array: - caP = new ContextAttribute(ca.name, ca.type, ""); - caP->compoundValueP = new orion::CompoundValueNode(orion::ValueTypeVector); - caP->valueType = orion::ValueTypeVector; - compoundVectorResponse(caP->compoundValueP, getFieldF(attr, ENT_ATTRS_VALUE)); - break; - - default: - LM_E(("Runtime Error (unknown attribute value type in DB: %d)", getFieldF(attr, ENT_ATTRS_VALUE).type())); - } - } - - // dateExpires is managed like a regular attribute in DB, but it is a builtin and it is shadowed - if (caP->name == DATE_EXPIRES) - { - caP->shadowed = true; - } - - // Setting custom metadata (if any) - if (attr.hasField(ENT_ATTRS_MD)) - { - orion::BSONObj mds = getObjectFieldF(attr, ENT_ATTRS_MD); - std::set mdsSet; - - mds.getFieldNames(&mdsSet); - for (std::set::iterator i = mdsSet.begin(); i != mdsSet.end(); ++i) - { - std::string currentMd = *i; - Metadata* md = new Metadata(dbDecode(currentMd), getObjectFieldF(mds, currentMd)); - caP->metadataVector.push_back(md); - } - } - - // Set creDate and modDate at attribute level - if (attr.hasField(ENT_ATTRS_CREATION_DATE)) - { - caP->creDate = getNumberFieldF(attr, ENT_ATTRS_CREATION_DATE); - } - - if (attr.hasField(ENT_ATTRS_MODIFICATION_DATE)) - { - caP->modDate = getNumberFieldF(attr, ENT_ATTRS_MODIFICATION_DATE); - } - - entity.attributeVector.push_back(caP); - }*/ /* Set creDate and modDate at entity level */ if (entityDoc.hasField(ENT_CREATION_DATE))