fw4spl
patch/fwMDSemanticPatch/src/fwMDSemanticPatch/V1/V2/fwData/Study.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include <fwTools/UUID.hpp>
8 
9 #include <fwAtoms/Object.hpp>
10 #include <fwAtoms/Object.hxx>
11 #include <fwAtoms/String.hpp>
12 
13 #include <fwAtomsPatch/helper/functions.hpp>
14 
15 #include "fwMDSemanticPatch/V1/V2/fwData/Study.hpp"
16 
17 namespace fwMDSemanticPatch
18 {
19 namespace V1
20 {
21 namespace V2
22 {
23 namespace fwData
24 {
25 
26 Study::Study() : ::fwAtomsPatch::ISemanticPatch()
27 {
28  m_originClassname = "::fwData::Study";
29  m_originVersion = "1";
30  this->addContext("MedicalData", "V1", "V2");
31 }
32 
33 // ----------------------------------------------------------------------------
34 
36 {
37 }
38 
39 // ----------------------------------------------------------------------------
40 
42 {
43 }
44 
45 // ----------------------------------------------------------------------------
46 
48  const ::fwAtoms::Object::sptr& previous,
49  const ::fwAtoms::Object::sptr& current,
50  ::fwAtomsPatch::IPatch::NewVersionsType& newVersions)
51 {
52  ISemanticPatch::apply(previous, current, newVersions);
53  ::fwAtomsPatch::helper::cleanFields( current );
54  ::fwAtomsPatch::helper::Object helper( current );
55 
56  ::fwAtoms::String::sptr uid = current->getAttribute< ::fwAtoms::String >("instance_uid");
57  if( uid->getValue().empty() )
58  {
60  }
61 }
62 
63 // ----------------------------------------------------------------------------
64 
65 } // namespace fwData
66 } // namespace V2
67 } // namespace V1
68 } // namespace fwMDSemanticPatch
69 
Contains the semantic patches within the context "MedicalData".
static FWATOMS_API String::sptr New(std::string value)
Construct a new Object represented a string.
Contains base functionalities used to transform objects from a version to another.
Definition: Abstract.hpp:16
std::string m_originClassname
Origin classname of the object.
Definition: IPatch.hpp:64
virtual FWMDSEMANTICPATCH_API void apply(const ::fwAtoms::Object::sptr &previous, const ::fwAtoms::Object::sptr &current,::fwAtomsPatch::IPatch::NewVersionsType &newVersions) override
Applies patch.
virtual FWATOMSPATCH_API void addContext(const std::string &context, const std::string &originVersion, const std::string &targetVersion)
Add a context where the patch can be applied.
Patch a study from version V&#39;1&#39; to &#39;V2&#39; within &#39;MedicalData&#39; context.
FWATOMSPATCH_API void replaceAttribute(const std::string &name,::fwAtoms::Base::sptr newValue, conditions::Abstract::sptr condition=conditions::Abstract::New())
Replaces an attribute.
std::string m_originVersion
Origin version of the object.
Definition: IPatch.hpp:67
FWATOMSPATCH_API ISemanticPatch()
Constructor.
Contains the representation of the data objects used in the framework.
Class represented a String.
static FWTOOLS_API UUIDType generateUUID()
Return a new extended UUID;.
Definition: UUID.cpp:114