25 #include "../MongoDBRef.h"
26 #include "../GridFileManager.h"
41 return entity ? entity->getId() :
"";
46 return entity ? entity->getName() :
"";
56 this->entity = entity;
66 if (!oldAttr || !newAttr)
71 int size = oldAttr->size();
72 int newSize = newAttr->size();
74 for (
int i = 0; i < size; ++i)
76 armarx::VariantPtr oldMongoRef = armarx::VariantPtr::dynamicCast(oldAttr->getValueAt(i));
82 oldDocId = oldMongoRef->getClass<
MongoDBRef>()->docId;
89 armarx::VariantPtr newMongoRef = armarx::VariantPtr::dynamicCast(newAttr->getValueAt(i));
90 newDocId = newMongoRef->get<
MongoDBRef>()->docId;
93 if (i >= newSize || (!oldDocId.empty() && newDocId != oldDocId))
95 ARMARX_INFO_S <<
"Removing old file: " << oldAttr->getName() ;
109 int size = attr->size();
110 for (
int i = 0; i < size; ++i)
112 armarx::VariantPtr oldMongoRef = armarx::VariantPtr::dynamicCast(attr->getValueAt(i));
114 std::string oldDocId;
118 oldDocId = oldMongoRef->getClass<
MongoDBRef>()->docId;
119 if (!oldDocId.empty())
131 std::string result =
"";
135 fileManager->ensureFileInCache(
getEntity()->getAttribute(attrName), result, preserveOriginalFName);
143 fileManager(fileManager)