Salome HOME
add method NameChanged to update title name
[modules/kernel.git] / src / SALOMESDS / SALOMESDS_Transaction.cxx
index 964303cfed5ef2ad774ba0a7da1fec48b3f1f2e7..6d85116f9fee64520fb26b862f522f7738202668 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,7 @@
 #include "SALOMESDS_PickelizedPyObjServer.hxx"
 #include "SALOMESDS_PickelizedPyObjRdWrServer.hxx"
 #include "SALOMESDS_PickelizedPyObjRdExtServer.hxx"
+#include "SALOMESDS_TrustTransaction.hxx"
 
 #include <sstream>
 
@@ -86,6 +87,13 @@ void TransactionRdExtVarCreate::perform()
   _dsct->createRdExtVarInternal(_var_name,data2);
 }
 
+void TransactionRdExtInitVarCreate::perform()
+{
+  SALOME::ByteVec data2;
+  FromVBToByteSeq(_data,data2);
+  _dsct->createRdExtInitVarInternal(_var_name,data2);
+}
+
 void TransactionRdWrVarCreate::perform()
 {
   SALOME::ByteVec data2;
@@ -93,6 +101,39 @@ void TransactionRdWrVarCreate::perform()
   _dsct->createRdWrVarInternal(_var_name,data2);
 }
 
+TransactionKillVar::TransactionKillVar(DataScopeServerTransaction *dsct, const std::string& varName):Transaction(dsct,varName)
+{
+}
+
+/*!
+ * TODO
+ */
+void TransactionKillVar::prepareRollBackInCaseOfFailure()
+{
+  checkVarExisting();
+  //BasicDataServer *bds(_dsct->retrieveVarInternal2(_var_name);
+  //bds->clone();
+}
+
+void TransactionKillVar::perform()
+{
+  _dsct->deleteVar(_var_name.c_str());
+}
+
+/*!
+ * TODO
+ */
+void TransactionKillVar::rollBack()
+{
+}
+
+/*!
+ * no implementation it is not a bug ! killVar is not an event.
+ */
+void TransactionKillVar::notify()
+{
+}
+
 TransactionDictModify::TransactionDictModify(DataScopeServerTransaction *dsct, const std::string& varName):Transaction(dsct,varName),_varc(0)
 {
   _varc=checkVarExistingAndDict();
@@ -224,3 +265,49 @@ void TransactionMorphRdWrIntoRdOnly::rollBack()
 void TransactionMorphRdWrIntoRdOnly::notify()
 {
 }
+
+TransactionMultiKeyAddSession::TransactionMultiKeyAddSession(DataScopeServerTransaction *dsct, const std::string& varName):Transaction(dsct,varName)
+{
+  _dsct->moveStatusOfVarFromRdExtOrRdExtInitToRdExtInit(_var_name);
+}
+
+void TransactionMultiKeyAddSession::addKeyValueInVarErrorIfAlreadyExistingNow(const SALOME::ByteVec& key, const SALOME::ByteVec& value)
+{
+  _dsct->checkVarExistingAndDict(_var_name);
+  TransactionAddKeyValueErrorIfAlreadyExisting ret(_dsct,_var_name,key,value);
+  {
+    bool mustRollback(true);
+    TrustTransaction t;
+    t.setTransaction(&ret,&mustRollback);
+    t.operate();
+    mustRollback=false;//important let this line to notify t that everything was OK
+  }
+  ret.notify();
+}
+
+/*!
+ * no implementation it is not a bug !
+ */
+void TransactionMultiKeyAddSession::prepareRollBackInCaseOfFailure()
+{
+}
+
+void TransactionMultiKeyAddSession::perform()
+{
+  _dsct->moveStatusOfVarFromRdExtOrRdExtInitToRdExt(_var_name);
+}
+
+/*!
+ * no implementation it is not a bug !
+ */
+void TransactionMultiKeyAddSession::rollBack()
+{
+}
+
+/*!
+ * no implementation it is not a bug !
+ */
+void TransactionMultiKeyAddSession::notify()
+{
+}
+