Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zipbin63700 -> 57638 bytes
-rw-r--r--plugins/org.eclipse.osee.orcs.db/schema/SKYNET.VERSIONING.SCHEMA.xml3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java1
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchDatabaseCallable.java58
-rw-r--r--plugins/org.eclipse.osee.x.server.p2/demo/hsql.zipbin128886 -> 115717 bytes
5 files changed, 42 insertions, 20 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip b/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
index aed0a3fa5f0..a98ecdf4fd1 100644
--- a/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
+++ b/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
Binary files differ
diff --git a/plugins/org.eclipse.osee.orcs.db/schema/SKYNET.VERSIONING.SCHEMA.xml b/plugins/org.eclipse.osee.orcs.db/schema/SKYNET.VERSIONING.SCHEMA.xml
index d62d0978782..4791bd3a6aa 100644
--- a/plugins/org.eclipse.osee.orcs.db/schema/SKYNET.VERSIONING.SCHEMA.xml
+++ b/plugins/org.eclipse.osee.orcs.db/schema/SKYNET.VERSIONING.SCHEMA.xml
@@ -113,7 +113,6 @@
<Table name="OSEE_BRANCH" schema="OSEE" tablespace="osee_data">
- <Column id="BRANCH_GUID" defaultValue="not null" limits="28" type="VARCHAR" />
<Column id="BRANCH_ID" defaultValue="not null" type="BIGINT" />
<Column id="BRANCH_NAME" defaultValue="not null" limits="200" type="VARCHAR" />
<Column id="PARENT_BRANCH_ID" defaultValue="not null" type="BIGINT" />
@@ -126,7 +125,6 @@
<Column id="INHERIT_ACCESS_CONTROL" defaultValue="not null" type="smallint" />
<Constraint schema="OSEE" id="OSEE_BRANCH_B_PK" type="PRIMARY KEY" appliesTo="BRANCH_ID" />
- <Constraint schema="OSEE" id="OSEE_BRANCH_G_IDX" type="UNIQUE" appliesTo="BRANCH_GUID" />
<Index id="OSEE_BRANCH_A_IDX" tablespace="osee_index">
<AppliesTo id="ARCHIVED" />
</Index>
@@ -134,7 +132,6 @@
<TableDescription referenceTable="OSEE_BRANCH">
<Note purpose="Core table describing instances of OSEE Branches."/>
- <Column id="BRANCH_GUID" description="self-explanatory" />
<Column id="BRANCH_ID" description="self-explanatory" />
<Column id="BRANCH_NAME" description="Simple string name" />
<Column id="PARENT_BRANCH_ID" description="self-explanatory" />
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java
index 01bb58bf60b..c941e330d5d 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java
@@ -75,7 +75,6 @@ public class InitializeDatastoreCallable extends AbstractDatastoreCallable<DataS
Lib.deleteDir(new File(attributeDataPath));
preferences.putValue(DataStoreConstants.DATASTORE_ID_KEY, GUID.create());
- preferences.putValue("osee.using.legacy.branch.guid.for.events", "true");
addDefaultPermissions();
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchDatabaseCallable.java
index 2af15667e7d..0cbc019e969 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchDatabaseCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchDatabaseCallable.java
@@ -36,9 +36,12 @@ import org.eclipse.osee.orcs.OrcsSession;
public class StoreBranchDatabaseCallable extends AbstractDatastoreTxCallable<IStatus> {
protected static final int NULL_PARENT_BRANCH_ID = -1;
- private static final String INSERT_BRANCH =
+ private static final String INSERT_BRANCH_WITH_GUID =
"INSERT INTO osee_branch (branch_id, branch_guid, branch_name, parent_branch_id, parent_transaction_id, archived, associated_art_id, branch_type, branch_state, baseline_transaction_id, inherit_access_control) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+ private static final String INSERT_BRANCH =
+ "INSERT INTO osee_branch (branch_id, branch_name, parent_branch_id, parent_transaction_id, archived, associated_art_id, branch_type, branch_state, baseline_transaction_id, inherit_access_control) VALUES (?,?,?,?,?,?,?,?,?,?)";
+
private static final String UPDATE_BRANCH =
"UPDATE osee_branch SET branch_name = ?, parent_branch_id = ?, parent_transaction_id = ?, archived = ?, associated_art_id = ?, branch_type = ?, branch_state = ?, baseline_transaction_id = ?, inherit_access_control = ? WHERE branch_id = ?";
@@ -69,11 +72,14 @@ public class StoreBranchDatabaseCallable extends AbstractDatastoreTxCallable<ISt
List<Object[]> updateData = new ArrayList<Object[]>();
List<Object[]> deleteData = new ArrayList<Object[]>();
+ boolean insertBranchGuid = false;
+
for (Branch branch : branches) {
if (isDataDirty(branch)) {
switch (branch.getStorageState()) {
case CREATED:
- insertData.add(toInsertValues(branch));
+ insertBranchGuid = isBranchGuidNeeded(connection);
+ insertData.add(toInsertValues(branch, insertBranchGuid));
break;
case MODIFIED:
updateData.add(toUpdateValues(branch));
@@ -96,32 +102,52 @@ public class StoreBranchDatabaseCallable extends AbstractDatastoreTxCallable<ISt
}
}
}
- getDatabaseService().runBatchUpdate(connection, INSERT_BRANCH, insertData);
+ String insertBranch = insertBranchGuid ? INSERT_BRANCH_WITH_GUID : INSERT_BRANCH;
+ getDatabaseService().runBatchUpdate(connection, insertBranch, insertData);
getDatabaseService().runBatchUpdate(connection, UPDATE_BRANCH, updateData);
getDatabaseService().runBatchUpdate(connection, DELETE_BRANCH, deleteData);
return Status.OK_STATUS;
}
- private Object[] toInsertValues(Branch branch) throws OseeCoreException {
+ private boolean isBranchGuidNeeded(OseeConnection connection) {
+ return getDatabaseService().runPreparedQueryFetchObject(connection, false,
+ "select osee_value from osee_info where osee_key = ?", "osee.insert.branch.guid.on.create");
+ }
+
+ private Object[] toInsertValues(Branch branch, boolean insertBranchGuid) throws OseeCoreException {
Branch parentBranch = branch.getParentBranch();
TransactionRecord baseTxRecord = branch.getBaseTransaction();
long parentBranchId = parentBranch != null ? parentBranch.getUuid() : NULL_PARENT_BRANCH_ID;
int baselineTransaction = baseTxRecord != null ? baseTxRecord.getId() : NULL_PARENT_BRANCH_ID;
int inheritAccessControl = branch.isInheritAccessControl() ? 1 : 0;
- return new Object[] {
- branch.getUuid(),
- GUID.create(),
- branch.getName(),
- parentBranchId,
- branch.getSourceTransaction().getId(),
- branch.getArchiveState().getValue(),
- branch.getAssociatedArtifactId(),
- branch.getBranchType().getValue(),
- branch.getBranchState().getValue(),
- baselineTransaction,
- inheritAccessControl};
+ if (insertBranchGuid) {
+ return new Object[] {
+ branch.getUuid(),
+ GUID.create(),
+ branch.getName(),
+ parentBranchId,
+ branch.getSourceTransaction().getId(),
+ branch.getArchiveState().getValue(),
+ branch.getAssociatedArtifactId(),
+ branch.getBranchType().getValue(),
+ branch.getBranchState().getValue(),
+ baselineTransaction,
+ inheritAccessControl};
+ } else {
+ return new Object[] {
+ branch.getUuid(),
+ branch.getName(),
+ parentBranchId,
+ branch.getSourceTransaction().getId(),
+ branch.getArchiveState().getValue(),
+ branch.getAssociatedArtifactId(),
+ branch.getBranchType().getValue(),
+ branch.getBranchState().getValue(),
+ baselineTransaction,
+ inheritAccessControl};
+ }
}
private Object[] toUpdateValues(Branch branch) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip b/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
index d9ba12520df..c678c4aa841 100644
--- a/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
+++ b/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
Binary files differ

Back to the top