void ImageFromPDBSelectorUpdaterSrv::updating( ::fwServices::ObjectMsg::csptr _msg ) throw ( ::fwTools::Failed ) { ::fwData::Composite::sptr composite = this->getObject< ::fwData::Composite >(); for ( ManagedEvents::iterator it = m_managedEvents.begin(); it != m_managedEvents.end(); ++it ) { // First element of tuple ( it->get<0>() ) is the event, test if message correspond to a defined event if( _msg->hasEvent( it->get<0>() ) ) { ::fwData::Object::sptr obj = ::fwData::Object::dynamicCast( _msg->getSubject().lock() ); SLM_ASSERT(obj,"Sorry, the subject of message is not a ::fwData::Object"); // Test if we manage this event from this object message uid ( it->get<1>() ) if( obj->getID() == it->get<1>() ) { ::fwData::PatientDB::sptr patientDB = ::fwData::PatientDB::dynamicCast(obj); SLM_ASSERT("Sorry, the subject of message is not a ::fwData::PatientDB", patientDB); ::fwData::Image::sptr img; if( it->get<3>() != REMOVE ) { img = ::fwComEd::fieldHelper::BackupHelper::getSelectedImage(patientDB); } // Udapte the composite object referenced by the composite key ( it->get<2>() ) this->updateComposite(composite, img, it->get<2>(), it->get<3>() ); } } } }
void DataInfoFromMsgUpdaterSrv::receiving( ::fwServices::ObjectMsg::csptr _msg ) throw ( ::fwTools::Failed ) { ::fwData::Composite::sptr composite = this->getObject< ::fwData::Composite >(); for ( ManagedEvents::iterator it = m_managedEvents.begin(); it != m_managedEvents.end(); ++it ) { std::string event = it->get<0>(); std::string uuid = it->get<1>(); std::string compositeKey = it->get<2>(); ctrlSelection::IUpdaterSrv::ActionType action = it->get<3>(); // test if message correspond to a defined event if( _msg->hasEvent( event ) ) { ::fwData::Object::sptr obj = ::fwData::Object::dynamicCast( _msg->getSubject().lock() ); SLM_ASSERT("Sorry, the subject of message is not a ::fwData::Object", obj); // Test if we manage this event from this object message uid if( obj->getID() == uuid || uuid == "*") { ::fwData::Object::sptr dataInfo = ::boost::const_pointer_cast< ::fwData::Object >(_msg->getDataInfo( event )); SLM_ASSERT("no dataInfo set!!!" , dataInfo || action== ctrlSelection::IUpdaterSrv::REMOVE || action== ctrlSelection::IUpdaterSrv::REMOVE_IF_PRESENT ); // Udpate the composite object referenced by the composite key this->updateComposite(composite, dataInfo , compositeKey , action ); } } } }
void PSAFromPDBSelectorUpdaterSrv::updating( ::fwServices::ObjectMsg::csptr _msg ) throw ( ::fwTools::Failed ) { ::fwData::Composite::sptr composite = this->getObject< ::fwData::Composite >(); for ( PSAManagedEvents::iterator it = m_psaManagedEvents.begin(); it != m_psaManagedEvents.end(); ++it ) { // First element of tuple ( it->get<0>() ) is the event, test if message correspond to a defined event if( _msg->hasEvent( it->get<0>() ) ) { ::fwData::Object::sptr obj = ::fwData::Object::dynamicCast( _msg->getSubject().lock() ); SLM_ASSERT(obj,"Sorry, the subject of message is not a ::fwData::Object"); // Test if we manage this event from this object message uid ( it->get<1>() ) if( obj->getID() == it->get<1>() ) { ::fwData::PatientDB::sptr patientDB = ::fwData::PatientDB::dynamicCast(obj); SLM_ASSERT("Sorry, the subject of message is not a ::fwData::PatientDB", patientDB); ::fwData::Patient::sptr pat; ::fwData::String::sptr patientName; ::fwData::String::sptr patientInfo; ::fwData::Study::sptr stu; ::fwData::Acquisition::sptr acq; if( it->get<7>() != REMOVE ) { // Get selection pat = ::fwComEd::fieldHelper::BackupHelper::getSelectedPatient(patientDB); stu = ::fwComEd::fieldHelper::BackupHelper::getSelectedStudy(patientDB); acq = ::fwComEd::fieldHelper::BackupHelper::getSelectedAcquisition(patientDB); patientName = ::fwData::String::NewSptr( pat->getCRefName() ); std::string acqDate = ::boost::posix_time::to_iso_extended_string( acq->getCreationDate() ); acqDate = acqDate.substr(0,10) + " " + acqDate.substr(11,5); std::stringstream info; info << pat->getCRefName() << "\n" << acqDate; patientInfo = ::fwData::String::NewSptr( info.str() ); } // Udapte the composite object referenced by the composite key ( it->get<2>() ) this->updateComposite(composite, pat, it->get<2>(), it->get<7>() ); this->updateComposite(composite, stu, it->get<3>(), it->get<7>() ); this->updateComposite(composite, acq, it->get<4>(), it->get<7>() ); this->updateComposite(composite, patientName, it->get<5>(), it->get<7>() ); this->updateComposite(composite, patientInfo, it->get<6>(), it->get<7>() ); } } } }