Пример #1
0
 /**
  * Change all oldDataObjectIDs to newDataObjectIDs in table "dataobjectinstance".
  *
  * @param oldDataObjectID dataobject_id that gets updated by newDataObjectID
  * @param newDataObjectID new dataobject_id that overwrites oldDataObjectID
  */
 public void migrateDataObjectInstance(int oldDataObjectID, int newDataObjectID) {
   DbDataObject dbDataObject = new DbDataObject();
   String update =
       "UPDATE dataobjectinstance "
           + "SET dataobject_id = "
           + newDataObjectID
           + " WHERE dataobject_id = "
           + oldDataObjectID;
   dbDataObject.executeUpdateStatement(update);
   String sql =
       "SELECT state_id FROM dataobjectinstance " + "WHERE dataobject_id = " + newDataObjectID;
   List<Integer> stateIds = dbDataObject.executeStatementReturnsListInt(sql, "state_id");
   for (int stateId : stateIds) {
     update =
         "UPDATE dataobjectinstance SET state_id = "
             + "(SELECT state.id FROM state WHERE olc_id = "
             + "(SELECT `dataclass_id` FROM `dataobject` "
             + "WHERE `id` = "
             + newDataObjectID
             + ") "
             + "AND name = (SELECT state.name FROM state "
             + "WHERE state.id = "
             + stateId
             + ")) "
             + "WHERE dataobject_id = "
             + newDataObjectID
             + " AND state_id = "
             + stateId;
     dbDataObject.executeUpdateStatement(update);
   }
 }
Пример #2
0
 /**
  * Change all oldDataAttributeIDs to newDataAttributeID for all specified dataattributeinstances.
  *
  * @param oldDataAttributeID DataAttributeID that gets updated by newDataAttributeID
  * @param newDataAttributeID new dataAttributeID that overwrites oldDataAttributeID
  */
 public void migrateDataAttributeInstance(Integer oldDataAttributeID, Integer newDataAttributeID) {
   DbDataObject dbDataObject = new DbDataObject();
   String update =
       "UPDATE dataattributeinstance "
           + "SET dataattribute_id = "
           + newDataAttributeID
           + " WHERE dataattribute_id = "
           + oldDataAttributeID;
   dbDataObject.executeUpdateStatement(update);
 }
Пример #3
0
 /**
  * Change all oldControlNodeIDs to newControlNodeIDs in table "controlnodeinstance".
  *
  * @param oldControlNodeID controlNodeID that gets updated by newControlNodeID
  * @param newControlNodeID new controlNodeID that overwrites oldControlNodeID
  */
 public void migrateControlNodeInstance(int oldControlNodeID, int newControlNodeID) {
   DbDataObject dbDataObject = new DbDataObject();
   String update =
       "UPDATE controlnodeinstance "
           + "SET controlnode_id = "
           + newControlNodeID
           + " WHERE controlnode_id = "
           + oldControlNodeID;
   dbDataObject.executeUpdateStatement(update);
 }
Пример #4
0
 /**
  * Change all oldFragmentIDs to newFragmentIDs of all running instances with oldFragmentID in
  * table "fragmentinstance".
  *
  * @param oldFragmentID fragmentID that gets updated by newFragmentId
  * @param newFragmentID new fragmentID that overwrites oldFragmentId
  */
 public void migrateFragmentInstance(int oldFragmentID, int newFragmentID) {
   DbDataObject dbDataObject = new DbDataObject();
   String update =
       "UPDATE fragmentinstance "
           + "SET fragment_id = "
           + newFragmentID
           + " WHERE fragment_id = "
           + oldFragmentID;
   dbDataObject.executeUpdateStatement(update);
 }
Пример #5
0
 /**
  * Insert a running instance of a fragment in table "fragmentinstance".
  *
  * @param fragmentID specifies a fragment the instance is running on
  * @param instanceID specifies a scenarioinstance the fragmentinstance belongs to
  */
 public void insertFragmentInstance(int fragmentID, int instanceID) {
   DbDataObject dbDataObject = new DbDataObject();
   String insert =
       "INSERT INTO fragmentinstance "
           + "(fragmentinstance.terminated, "
           + "fragment_id, scenarioinstance_id) "
           + "VALUES ("
           + 0
           + ", "
           + fragmentID
           + ", "
           + instanceID
           + ")";
   dbDataObject.executeUpdateStatement(insert);
 }
Пример #6
0
 /**
  * Change all oldScenarioIDs to newScenarioIDs of all running instances with oldScenarioID in
  * table "scenarioinstance".
  *
  * @param oldScenarioID scenarioID that gets updated by newScenarioId
  * @param newScenarioID new scenarioID that overwrites oldScenarioId
  * @return List of all IDs that running scenarioinstances of oldScenarioID hold
  */
 public List<Integer> migrateScenarioInstance(int oldScenarioID, int newScenarioID) {
   DbDataObject dbDataObject = new DbDataObject();
   String select =
       "SELECT id "
           + "FROM scenarioinstance "
           + "WHERE scenarioinstance.terminated = 0 "
           + "AND scenario_id = "
           + oldScenarioID;
   List<Integer> runningInstances = dbDataObject.executeStatementReturnsListInt(select, "id");
   String update =
       "UPDATE scenarioinstance "
           + "SET scenario_id = "
           + newScenarioID
           + " WHERE scenarioinstance.terminated = 0 "
           + "AND scenario_id = "
           + oldScenarioID;
   dbDataObject.executeUpdateStatement(update);
   return runningInstances;
 }