]> SALOME platform Git repositories - modules/shaper.git/blob - src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp
Salome HOME
Fix for the issue #2968 : Field - names of steps are different after Export to GEOM
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportFeature.cpp
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include <ExchangePlugin_ExportFeature.h>
21
22 #include <algorithm>
23 #include <iterator>
24 #include <string>
25 #ifdef _DEBUG
26 #include <iostream>
27 #include <ostream>
28 #endif
29
30 #include <Config_Common.h>
31 #include <Config_PropManager.h>
32
33 #include <GeomAlgoAPI_BREPExport.h>
34 #include <GeomAlgoAPI_CompoundBuilder.h>
35 #include <GeomAlgoAPI_IGESExport.h>
36 #include <GeomAlgoAPI_STEPExport.h>
37 #include <GeomAlgoAPI_Tools.h>
38 #include <GeomAlgoAPI_XAOExport.h>
39
40 #include <GeomAPI_Shape.h>
41
42 #include <ModelAPI_AttributeSelectionList.h>
43 #include <ModelAPI_AttributeString.h>
44 #include <ModelAPI_AttributeStringArray.h>
45 #include <ModelAPI_AttributeIntArray.h>
46 #include <ModelAPI_AttributeTables.h>
47 #include <ModelAPI_Data.h>
48 #include <ModelAPI_Document.h>
49 #include <ModelAPI_Object.h>
50 #include <ModelAPI_ResultBody.h>
51 #include <ModelAPI_ResultPart.h>
52 #include <ModelAPI_ResultGroup.h>
53 #include <ModelAPI_ResultField.h>
54 #include <ModelAPI_Session.h>
55 #include <ModelAPI_Validator.h>
56 #include <ModelAPI_Tools.h>
57
58 #include <Events_InfoMessage.h>
59
60 #include <XAO_Group.hxx>
61 #include <XAO_Field.hxx>
62 #include <XAO_Xao.hxx>
63 #include <XAO_Geometry.hxx>
64
65 #include <ExchangePlugin_Tools.h>
66
67 ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature()
68 {
69 }
70
71 ExchangePlugin_ExportFeature::~ExchangePlugin_ExportFeature()
72 {
73   // TODO Auto-generated destructor stub
74 }
75
76 /*
77  * Request for initialization of data model of the feature: adding all attributes
78  */
79 void ExchangePlugin_ExportFeature::initAttributes()
80 {
81   data()->addAttribute(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(),
82     ModelAPI_AttributeString::typeId());
83   data()->addAttribute(ExchangePlugin_ExportFeature::FILE_PATH_ID(),
84     ModelAPI_AttributeString::typeId());
85   data()->addAttribute(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(),
86     ModelAPI_AttributeString::typeId());
87   data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(),
88     ModelAPI_AttributeString::typeId());
89   data()->addAttribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID(),
90     ModelAPI_AttributeSelectionList::typeId());
91   data()->addAttribute(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(),
92     ModelAPI_AttributeString::typeId());
93   data()->addAttribute(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
94     ModelAPI_AttributeString::typeId());
95
96   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
97     ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID());
98   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
99     ExchangePlugin_ExportFeature::XAO_AUTHOR_ID());
100   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
101     ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID());
102 }
103
104 void ExchangePlugin_ExportFeature::attributeChanged(const std::string& theID)
105 {
106   if (theID == XAO_FILE_PATH_ID()) {
107     string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue(
108       string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value());
109   }
110 }
111
112 /*
113  * Computes or recomputes the results
114  */
115 void ExchangePlugin_ExportFeature::execute()
116 {
117   AttributeStringPtr aFormatAttr =
118       this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID());
119   std::string aFormat = aFormatAttr->value();
120
121   AttributeStringPtr aFilePathAttr =
122       this->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
123   std::string aFilePath = aFilePathAttr->value();
124   if (aFilePath.empty())
125     return;
126
127   exportFile(aFilePath, aFormat);
128 }
129
130 void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName,
131                                               const std::string& theFormat)
132 {
133   std::string aFormatName = theFormat;
134
135   if (aFormatName.empty()) { // get default format for the extension
136     // ".brep" -> "BREP"
137     std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFileName);
138     if (anExtension == "BREP" || anExtension == "BRP") {
139       aFormatName = "BREP";
140     } else if (anExtension == "STEP" || anExtension == "STP") {
141       aFormatName = "STEP";
142     } else if (anExtension == "IGES" || anExtension == "IGS") {
143       aFormatName = "IGES-5.1";
144     } else {
145       aFormatName = anExtension;
146     }
147   }
148
149   if (aFormatName == "XAO") {
150     exportXAO(theFileName);
151     return;
152   }
153
154   // make shape for export from selected shapes
155   AttributeSelectionListPtr aSelectionListAttr =
156       this->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID());
157   std::list<GeomShapePtr> aShapes;
158   for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; ++i) {
159     AttributeSelectionPtr anAttrSelection = aSelectionListAttr->value(i);
160     std::shared_ptr<GeomAPI_Shape> aCurShape = anAttrSelection->value();
161     if (aCurShape.get() == NULL)
162       aCurShape = anAttrSelection->context()->shape();
163     if (aCurShape.get() != NULL)
164       aShapes.push_back(aCurShape);
165   }
166
167   // Store compound if we have more than one shape.
168   std::shared_ptr<GeomAPI_Shape> aShape =
169     aShapes.size() == 1 ? aShapes.front() : GeomAlgoAPI_CompoundBuilder::compound(aShapes);
170
171   // Perform the export
172   std::string anError;
173   bool aResult = false;
174   if (aFormatName == "BREP") {
175     aResult = BREPExport(theFileName, aFormatName, aShape, anError);
176   } else if (aFormatName == "STEP") {
177     aResult = STEPExport(theFileName, aFormatName, aShape, anError);
178   } else if (aFormatName.substr(0, 4) == "IGES") {
179     aResult = IGESExport(theFileName, aFormatName, aShape, anError);
180   } else {
181     anError = "Unsupported format: " + aFormatName;
182   }
183
184   if (!anError.empty()) {
185     setError("An error occurred while exporting " + theFileName + ": " + anError);
186     return;
187   }
188 }
189
190 /// Returns XAO string by the value from the table
191 static std::string valToString(const ModelAPI_AttributeTables::Value& theVal,
192   const ModelAPI_AttributeTables::ValueType& theType) {
193   std::ostringstream aStr; // the resulting string value
194   switch(theType) {
195   case ModelAPI_AttributeTables::BOOLEAN:
196     aStr<<(theVal.myBool ? "true" : "false");
197     break;
198   case ModelAPI_AttributeTables::INTEGER:
199     aStr<<theVal.myInt;
200     break;
201   case ModelAPI_AttributeTables::DOUBLE:
202     aStr<<theVal.myDouble;
203     break;
204   case ModelAPI_AttributeTables::STRING:
205     aStr<<theVal.myStr;
206     break;
207   }
208   return aStr.str();
209 }
210
211 /// Returns true if something in selection is presented in the results list
212 static bool isInResults(AttributeSelectionListPtr theSelection,
213                         const std::list<ResultPtr>& theResults,
214                         std::set<ResultPtr>& theCashedResults)
215 {
216   // collect all results into a cashed set
217   if (theCashedResults.empty()) {
218     std::list<ResultPtr> aResults;
219     std::list<ResultPtr>::const_iterator aRes = theResults.cbegin();
220     for(; aRes != theResults.cend(); aRes++) {
221       if (theCashedResults.count(*aRes))
222         continue;
223       else
224         theCashedResults.insert(*aRes);
225       if ((*aRes)->groupName() == ModelAPI_ResultBody::group()) {
226         ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
227         std::list<ResultPtr> aResults;
228         ModelAPI_Tools::allSubs(aResBody, aResults, false);
229         for(std::list<ResultPtr>::iterator aR = aResults.begin(); aR != aResults.end(); aR++) {
230           theCashedResults.insert(std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aR));
231         }
232       } else if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) { // all results of the part
233         ResultPartPtr aResPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes);
234         DocumentPtr aPartDoc = aResPart->partDoc();
235         if (!aPartDoc.get() || !aPartDoc->isOpened()) { // document is not accessible
236           return false;
237         }
238         int aBodyCount = aPartDoc->size(ModelAPI_ResultBody::group());
239         for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) {
240           ResultBodyPtr aResBody =
241             std::dynamic_pointer_cast<ModelAPI_ResultBody>(
242               aPartDoc->object(ModelAPI_ResultBody::group(), aBodyIndex));
243           if (aResBody.get()) {
244             theCashedResults.insert(aResBody);
245             std::list<ResultPtr> aResults;
246             ModelAPI_Tools::allSubs(aResBody, aResults, false);
247             for(std::list<ResultPtr>::iterator aR = aResults.begin(); aR != aResults.end(); aR++) {
248               theCashedResults.insert(std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aR));
249             }
250           }
251         }
252       }
253     }
254   }
255   // if context is in results, return true
256   for(int a = 0; a < theSelection->size(); a++) {
257     AttributeSelectionPtr anAttr = theSelection->value(a);
258     ResultBodyPtr aSelected= std::dynamic_pointer_cast<ModelAPI_ResultBody>(anAttr->context());
259     if (aSelected.get() && theCashedResults.count(aSelected))
260       return true;
261   }
262   return false;
263 }
264
265 void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
266 {
267   try {
268
269   std::string anError;
270   XAO::Xao aXao;
271
272   // author
273
274   std::string anAuthor = string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value();
275   aXao.setAuthor(anAuthor);
276
277   // make shape for export from all results
278   std::list<GeomShapePtr> aShapes;
279   std::list<ResultPtr> aResults;
280   std::list<DocumentPtr> aDocuments; /// documents of Parts selected and used in export
281
282   AttributeSelectionListPtr aSelection = selectionList(SELECTION_LIST_ID());
283   bool aIsSelection = aSelection->isInitialized() && aSelection->size() > 0;
284   if (aIsSelection) { // a mode for export to geom result by result
285     for(int a = 0; a < aSelection->size(); a++) {
286       AttributeSelectionPtr anAttr = aSelection->value(a);
287       ResultPtr aBodyContext =
288         std::dynamic_pointer_cast<ModelAPI_Result>(anAttr->context());
289       if (aBodyContext.get() && !aBodyContext->isDisabled() && aBodyContext->shape().get()) {
290         aResults.push_back(aBodyContext);
291         GeomShapePtr aShape = anAttr->value();
292         if (!aShape.get())
293           aShape = aBodyContext->shape();
294         aShapes.push_back(aShape);
295         if (aBodyContext->groupName() == ModelAPI_ResultPart::group()) {
296           ResultPartPtr aResPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aBodyContext);
297           DocumentPtr aPartDoc = aResPart->partDoc();
298           if (!aPartDoc.get() || !aPartDoc->isOpened()) { // document is not accessible
299             std::string msg = "Can not export XAO for not loaded part";
300             Events_InfoMessage("ExportFeature", msg, this).send();
301             return;
302           } else {
303             aDocuments.push_back(aPartDoc);
304           }
305         }
306       }
307     }
308   } else {
309     int aBodyCount = document()->size(ModelAPI_ResultBody::group());
310     for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) {
311       ResultBodyPtr aResultBody =
312           std::dynamic_pointer_cast<ModelAPI_ResultBody>(
313               document()->object(ModelAPI_ResultBody::group(), aBodyIndex));
314       if (!aResultBody.get())
315         continue;
316       aShapes.push_back(aResultBody->shape());
317       aResults.push_back(aResultBody);
318     }
319   }
320   if (aShapes.empty()) {
321     setError("No shapes to export");
322     return;
323   }
324
325
326   GeomShapePtr aShape = (aShapes.size() == 1)
327       ? *aShapes.begin()
328       : GeomAlgoAPI_CompoundBuilder::compound(aShapes);
329
330   SetShapeToXAO(aShape, &aXao, anError);
331
332   if (!anError.empty()) {
333     setError("An error occurred while exporting " + theFileName + ": " + anError);
334     return;
335   }
336
337   // geometry name
338   std::string aGeometryName = string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value();
339   if (aGeometryName.empty() && aResults.size() == 1) {
340     // get the name from the first result
341     ResultPtr aResultBody = *aResults.begin();
342     aGeometryName = aResultBody->data()->name();
343   }
344
345   aXao.getGeometry()->setName(aGeometryName);
346
347   std::set<ResultPtr> allResultsCashed; // cash to speed up searching in all results selected
348
349   // iterate all documents used
350   if (aDocuments.empty())
351     aDocuments.push_back(document());
352   std::list<DocumentPtr>::iterator aDoc = aDocuments.begin();
353   for(; aDoc != aDocuments.end(); aDoc++) {
354     // groups
355     int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group());
356     for (int aGroupIndex = 0; aGroupIndex < aGroupCount; ++aGroupIndex) {
357       ResultGroupPtr aResultGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(
358           (*aDoc)->object(ModelAPI_ResultGroup::group(), aGroupIndex));
359
360       FeaturePtr aGroupFeature = (*aDoc)->feature(aResultGroup);
361
362       AttributeSelectionListPtr aSelectionList =
363           aGroupFeature->selectionList("group_list");
364       if (!isInResults(aSelectionList, aResults, allResultsCashed))// skip group not used in result
365         continue;
366
367       // conversion of dimension
368       std::string aSelectionType = aSelectionList->selectionType();
369       std::string aDimensionString =
370         ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
371       XAO::Dimension aGroupDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
372
373       XAO::Group* aXaoGroup = aXao.addGroup(aGroupDimension,
374                                             aResultGroup->data()->name());
375
376       try {
377         for (int aSelectionIndex = 0; aSelectionIndex < aSelectionList->size(); ++aSelectionIndex){
378           AttributeSelectionPtr aSelection = aSelectionList->value(aSelectionIndex);
379
380           // complex conversion of reference id to element index
381           // gives bad id in case the selection is done from python script
382           // => using GeomAlgoAPI_CompoundBuilder::id instead
383           // int aReferenceID_old = aSelection->Id();
384
385           int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aSelection->value());
386
387           if (aReferenceID == 0) // selected value does not found in the exported shape
388             continue;
389
390           std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
391           int anElementID =
392             aXao.getGeometry()->getElementIndexByReference(aGroupDimension, aReferenceString);
393
394           aXaoGroup->add(anElementID);
395         }
396       } catch (XAO::XAO_Exception& e) {
397         // LCOV_EXCL_START
398         std::string msg = "An error occurred while exporting group " +
399           aResultGroup->data()->name();
400         msg += ".\n";
401         msg += e.what();
402         msg += "\n";
403         msg += "=> skipping this group from XAO export.";
404         Events_InfoMessage("ExportFeature", msg, this).send();
405         aXao.removeGroup(aXaoGroup);
406         // LCOV_EXCL_STOP
407       }
408     }
409
410     // fields
411     int aFieldCount = (*aDoc)->size(ModelAPI_ResultField::group());
412     for (int aFieldIndex = 0; aFieldIndex < aFieldCount; ++aFieldIndex) {
413       ResultFieldPtr aResultField = std::dynamic_pointer_cast<ModelAPI_ResultField>(
414         (*aDoc)->object(ModelAPI_ResultField::group(), aFieldIndex));
415
416       FeaturePtr aFieldFeature = (*aDoc)->feature(aResultField);
417
418       AttributeSelectionListPtr aSelectionList =
419           aFieldFeature->selectionList("selected");
420       std::string aSelectionType = aSelectionList->selectionType();
421       bool isWholePart = aSelectionType == "part";
422       // skip field not used in results
423       if (!isWholePart && !isInResults(aSelectionList, aResults, allResultsCashed))
424         continue;
425
426       // conversion of dimension
427       std::string aDimensionString =
428         ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
429       XAO::Dimension aFieldDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
430       // get tables and their type
431       std::shared_ptr<ModelAPI_AttributeTables> aTables = aFieldFeature->tables("values");
432       std::string aTypeString = ExchangePlugin_Tools::valuesType2xaoType(aTables->type());
433       XAO::Type aFieldType = XAO::XaoUtils::stringToFieldType(aTypeString);
434
435       XAO::Field* aXaoField = aXao.addField(aFieldType, aFieldDimension, aTables->columns(),
436                                             aResultField->data()->name());
437
438
439       try {
440         // set components names
441         AttributeStringArrayPtr aComponents = aFieldFeature->stringArray("components_names");
442         for(int aComp = 0; aComp < aComponents->size(); aComp++) {
443           std::string aName = aComponents->value(aComp);
444           aXaoField->setComponentName(aComp, aName);
445         }
446
447         AttributeIntArrayPtr aStamps = aFieldFeature->intArray("stamps");
448         for (int aStepIndex = 0; aStepIndex < aTables->tables(); aStepIndex++) {
449           XAO::Step* aStep = aXaoField->addNewStep(aStepIndex + 1);
450           aStep->setStep(aStepIndex + 1);
451           int aStampIndex = aStamps->value(aStepIndex);
452           aStep->setStamp(aStampIndex);
453           int aNumElements = isWholePart ? aXaoField->countElements() : aTables->rows();
454           int aNumComps = aTables->columns();
455           std::set<int> aFilledIDs; // to fill the rest by defaults
456           // omit default values first row
457           for(int aRow = isWholePart ? 0 : 1; aRow < aNumElements; aRow++) {
458             for(int aCol = 0; aCol < aNumComps; aCol++) {
459               int anElementID = 0;
460               if (!isWholePart) {
461                 // element index actually is the ID of the selection
462                 AttributeSelectionPtr aSelection = aSelectionList->value(aRow - 1);
463                 int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aSelection->value());
464                 if (aReferenceID == 0) // selected value does not found in the exported shape
465                   continue;
466
467                 std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
468                 anElementID = aXao.getGeometry()->
469                   getElementIndexByReference(aFieldDimension, aReferenceString);
470               }
471
472               ModelAPI_AttributeTables::Value aVal = aTables->value(
473                 isWholePart ? 0 : aRow, aCol, aStepIndex);
474               std::string aStrVal = valToString(aVal, aTables->type());
475               aStep->setStringValue(isWholePart ? aRow : anElementID, aCol, aStrVal);
476               aFilledIDs.insert(anElementID);
477             }
478           }
479           if (!isWholePart) { // fill the rest values by default ones
480             XAO::GeometricElementList::iterator allElem =
481               aXao.getGeometry()->begin(aFieldDimension);
482             for(; allElem != aXao.getGeometry()->end(aFieldDimension); allElem++) {
483               if (aFilledIDs.find(allElem->first) != aFilledIDs.end())
484                 continue;
485               for(int aCol = 0; aCol < aNumComps; aCol++) {
486                 // default value
487                 ModelAPI_AttributeTables::Value aVal = aTables->value(0, aCol, aStepIndex);
488                 std::string aStrVal = valToString(aVal, aTables->type());
489                 aStep->setStringValue(allElem->first, aCol, aStrVal);
490               }
491             }
492           }
493         }
494       } catch (XAO::XAO_Exception& e) {
495         // LCOV_EXCL_START
496         std::string msg = "An error occurred while exporting field " +
497           aResultField->data()->name();
498         msg += ".\n";
499         msg += e.what();
500         msg += "\n";
501         msg += "=> skipping this field from XAO export.";
502         Events_InfoMessage("ExportFeature", msg, this).send();
503         aXao.removeField(aXaoField);
504         // LCOV_EXCL_STOP
505       }
506     }
507   }
508
509   // exporting
510   XAOExport(theFileName, &aXao, anError);
511
512   if (!anError.empty()) {
513     setError("An error occurred while exporting " + theFileName + ": " + anError);
514     return;
515   }
516
517 // LCOV_EXCL_START
518   } catch (XAO::XAO_Exception& e) {
519     std::string anError = e.what();
520     setError("An error occurred while exporting " + theFileName + ": " + anError);
521     return;
522   }
523 // LCOV_EXCL_STOP
524 }
525
526 bool ExchangePlugin_ExportFeature::isMacro() const
527 {
528   if (!data().get() || !data()->isValid())
529     return false;
530   ExchangePlugin_ExportFeature* aThis = ((ExchangePlugin_ExportFeature*)(this));
531   AttributeStringPtr aFormatAttr = aThis->string(FILE_FORMAT_ID());
532   std::string aFormat(aFormatAttr.get() ? aFormatAttr->value() : "");
533
534   if (aFormat.empty()) { // get default format for the extension
535     AttributeStringPtr aFilePathAttr = aThis->string(FILE_PATH_ID());
536     std::string aFilePath = aFilePathAttr->value();
537     if (!aFilePath.empty()) {
538       std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(aFilePath);
539       aFormat = anExtension;
540     }
541   }
542
543   if (aFormat == "XAO") { // on export to GEOm the selection attribute is filled - this is
544                           // an exceptional case where export to XAO feature must be kept
545     AttributeSelectionListPtr aList = aThis->selectionList(SELECTION_LIST_ID());
546     return !aList->isInitialized() || aList->size() == 0;
547   }
548   return true;
549 }