{
String itemType = qualifier.getItemType();
if (itemType == null)
{
Model model;
switch (mode)
{
case ModelNotificationService.ADDED:
// Read the model and repair hiearchy, establish links and instantiate the model
model = readModelFromStore(qualifier);
if (model != null)
{
model.maintainReferences(ModelObject.RESOLVE_GLOBAL_REFS | ModelObject.RESOLVE_LOCAL_REFS | ModelObject.INSTANTIATE_ITEM);
}
break;
case ModelNotificationService.UPDATED:
model = getOptionalModelByQualifier(qualifier);
if (model != null)
{
reloadModelAfterModelUpdate(model);
}
break;
case ModelNotificationService.REMOVED:
model = getOptionalModelByQualifier(qualifier);
if (model != null)
{
unregisterModel(model);
}
break;
}
}
else
{
Item item;
Model model;
switch (mode)
{
case ModelNotificationService.ADDED:
item = readItemFromStore(qualifier);
if (item != null)
{
model = item.getModel();
model.addItem(item);
}
break;
case ModelNotificationService.UPDATED:
item = getItemByQualifier(qualifier, false);
if (item != null)
{
reloadItemAfterModelUpdate(item);
}
break;
case ModelNotificationService.REMOVED:
item = getItemByQualifier(qualifier, false);
if (item != null)
{
model = item.getModel();
model.removeItem(item);
}
break;
}
}
}