/** * Get the databaseId for specified controlnode in table "controlnode". * * @param fragmentID the databaseID of the fragment the controlNode belongs to * @param modelID the modelId of the controlnode * @return the databaseID of the selected controlnode */ public int getControlNodeID(int fragmentID, String modelID) { DbDataObject dbDataObject = new DbDataObject(); String select = "SELECT id " + "FROM controlnode " + "WHERE fragment_id = " + fragmentID + " AND modelid = " + modelID; return dbDataObject.executeStatementReturnsInt(select, "id"); }
/** * Get the databaseId for the specified fragment in table "fragment". * * @param scenarioID the shbaseID for which the fragment is selected * @param modelID the modelId of the fragment * @return the databaseID of the selected fragment */ public int getFragmentID(int scenarioID, long modelID) { DbDataObject dbDataObject = new DbDataObject(); String select = "SELECT id " + "FROM fragment " + "WHERE scenario_id = " + scenarioID + " AND modelid = " + modelID; return dbDataObject.executeStatementReturnsInt(select, "id"); }
/** * Get the dataobjectID of the specified dataObject in table "dataobject". * * @param scenarioID the scenarioDatabaseID for which the dataobjectID is selected * @param dataObjectName the name of the dataObject (we assume that a scenario can't hold * dataObjects with the same name) * @return the dataobject_id of the selected dataObject */ public int getDataObjectID(int scenarioID, String dataObjectName) { DbDataObject dbDataObject = new DbDataObject(); String select = "SELECT id " + "FROM dataobject " + "WHERE scenario_id = " + scenarioID + " AND name = '" + dataObjectName + "'"; return dbDataObject.executeStatementReturnsInt(select, "id"); }
/** * Find out if the scenario in the database is marked a s deleted. * * @param scenarioID DatabaseID of the scenario * @return The value of the deleted flag (1 if scenario is deleted; 0 otherwise) */ public int isScenarioDeleted(int scenarioID) { DbDataObject dbDataObject = new DbDataObject(); String select = "SELECT deleted " + "FROM scenario " + "WHERE id = " + scenarioID; return dbDataObject.executeStatementReturnsInt(select, "deleted"); }
/** * Get the version of the domainModel that belongs to the specified scenario. * * @param scenarioID DatabaseID of the scenario * @return The version of the domainModel */ public int getDataModelVersion(int scenarioID) { DbDataObject dbDataObject = new DbDataObject(); String select = "SELECT datamodelversion " + "FROM scenario " + "WHERE id = " + scenarioID; return dbDataObject.executeStatementReturnsInt(select, "datamodelversion"); }