diff options
author | jmisinco | 2013-12-04 20:01:21 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2013-12-05 21:55:28 +0000 |
commit | 39e025164fe358dc8748763da5e32beb8d5fee94 (patch) | |
tree | 01f647bb21a6329164ce23943a76ce1a0ca2dae1 | |
parent | 8cfd134f2a80b57302fdc14b478fdca1a0774f0a (diff) | |
download | org.eclipse.osee-39e025164fe358dc8748763da5e32beb8d5fee94.tar.gz org.eclipse.osee-39e025164fe358dc8748763da5e32beb8d5fee94.tar.xz org.eclipse.osee-39e025164fe358dc8748763da5e32beb8d5fee94.zip |
feature[ats_G7ZNG]: Finish removal of remaining HRID code
Change-Id: I2f60b83ea846d67b6231f3444639ed98640bdb0f
10 files changed, 12 insertions, 178 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/artifact/AtsArtifactFactory.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/artifact/AtsArtifactFactory.java index a5e4f2d5ce1..3264fbb9a11 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/artifact/AtsArtifactFactory.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/artifact/AtsArtifactFactory.java @@ -26,7 +26,6 @@ import org.eclipse.osee.ats.core.client.team.TeamWorkFlowManager; import org.eclipse.osee.ats.core.util.AtsIdProvider; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.database.core.OseeInfo; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; @@ -71,12 +70,7 @@ public class AtsArtifactFactory extends ArtifactFactory { } if (!inDataStore) { - String atsId = HumanReadableId.generate(); - if (OseeInfo.isBooleanUsingCache("new.ats.ids")) { - atsId = AtsIdProvider.get().getNextId(); - } else { - toReturn.setHrid(atsId); - } + String atsId = AtsIdProvider.get().getNextId(); toReturn.setSoleAttributeFromString(AtsAttributeTypes.AtsId, atsId); } diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/artifact/HumanReadableId.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/artifact/HumanReadableId.java deleted file mode 100644 index b84fa52fba0..00000000000 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/artifact/HumanReadableId.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.core.client.artifact; - -import java.util.Arrays; -import java.util.Random; -import java.util.regex.Pattern; - -/** - * @author Ryan D. Brooks - */ -public final class HumanReadableId { - /** - * 5 character human readable identifier where the first and last characters are in the range [A-Z0-9] except 'I' and - * 'O' and the middle three characters have the same range as above with the additional restrictions of 'A', 'E', 'U' - * thus the total number of unique values is: 34 * 31 * 31 *31 * 34 = 34,438,396 - */ - private static final char[][] chars = new char[][] { - { - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'A', - 'B', - 'C', - 'D', - 'E', - 'F', - 'G', - 'H', - 'J', - 'K', - 'L', - 'M', - 'N', - 'P', - 'Q', - 'R', - 'S', - 'T', - 'U', - 'V', - 'W', - 'X', - 'Y', - 'Z'}, - { - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'B', - 'C', - 'D', - 'F', - 'G', - 'H', - 'J', - 'K', - 'L', - 'M', - 'N', - 'P', - 'Q', - 'R', - 'S', - 'T', - 'V', - 'W', - 'X', - 'Y', - 'Z'}}; - private static final int[] charsIndexLookup = new int[] {0, 1, 1, 1, 0}; - private static final int SEARCH_SPACE_SIZE = 34 * 31 * 31 * 31 * 34; - private static final Pattern HRID_PATTERN = Pattern.compile(constructHridPattern()); - private static int rawHrid; - - public static String generate() { - StringBuffer textHrid = new StringBuffer(); - - rawHrid = new Random().nextInt(SEARCH_SPACE_SIZE); - for (int i = 0; i < getHridLength(); i++) { - textHrid.append(generateCharForPos(i)); - } - return textHrid.toString(); - } - - private static int getHridLength() { - return charsIndexLookup.length; - } - - private static char generateCharForPos(int pos) { - char[] possibleChars = getCharsValidForPos(pos); - int radix = possibleChars.length; - - char returnChar = possibleChars[rawHrid % radix]; - rawHrid = rawHrid / radix; - - return returnChar; - } - - private static char[] getCharsValidForPos(int pos) { - return chars[charsIndexLookup[pos]]; - } - - public static boolean isValid(String hrid) { - return hrid != null && HRID_PATTERN.matcher(hrid).matches(); - } - - private static String constructHridPattern() { - StringBuilder pattern = new StringBuilder(); - for (int i = 0; i < getHridLength(); i++) { - pattern.append(getRegexForPosition(i)); - } - return pattern.toString(); - } - - private static String getRegexForPosition(int pos) { - return "[" + Arrays.toString(getCharsValidForPos(pos)) + "]"; - } -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsIds.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsIds.java index fa556fcc553..48ffb1b0f59 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsIds.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsIds.java @@ -16,11 +16,13 @@ import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; +import org.eclipse.osee.ats.core.util.AtsIdProvider; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; +import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; @@ -105,13 +107,12 @@ public class ValidateAtsIds extends AbstractBlam { try { artifactListFromIds = ArtifactQuery.getArtifactListFromIds(subList, CoreBranches.COMMON); for (Artifact art : artifactListFromIds) { - String artHrid = art.getHrid(); String atsId = art.getSoleAttributeValueAsString(AtsAttributeTypes.AtsId, ""); - if (!atsId.equals(artHrid)) { - if (persist) { - art.setSoleAttributeFromString(AtsAttributeTypes.AtsId, artHrid); - art.persist(tx); - } + if (!Strings.isValid(atsId) && persist) { + log("Not set: " + art.getName() + " artType: " + art.getArtifactTypeName()); + atsId = AtsIdProvider.get().getNextId(); + art.setSoleAttributeFromString(AtsAttributeTypes.AtsId, atsId); + art.persist(tx); } } } catch (Exception ex) { diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/OseeSql.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/OseeSql.java index 6fecedf553e..4119e360aeb 100644 --- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/OseeSql.java +++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/core/OseeSql.java @@ -37,7 +37,7 @@ public enum OseeSql { CONFLICT_GET_ATTRIBUTES("SELECT%s atr1.art_id, txs1.mod_type, atr1.attr_type_id, atr1.attr_id, atr1.gamma_id AS source_gamma, atr1.value AS source_value, atr2.gamma_id AS dest_gamma, atr2.value as dest_value, txs2.mod_type AS dest_mod_type FROM osee_txs txs1, osee_attribute atr1, osee_attribute atr2, osee_txs txs2 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = atr1.gamma_id AND atr1.attr_id = atr2.attr_id AND atr2.gamma_id = txs2.gamma_id AND txs2.branch_id = ? AND txs2.tx_current in (1,2) AND NOT EXISTS (SELECT 1 FROM osee_txs txs WHERE txs.branch_id = ? AND txs.transaction_id = ? AND (txs1.gamma_id = txs.gamma_id OR txs2.gamma_id = txs.gamma_id)) ORDER BY attr_id", Strings.HINTS__ORDERED__INDEX__ATTRIBUTE_CONFLICT), CONFLICT_GET_HISTORICAL_ATTRIBUTES("SELECT%s atr.attr_id, atr.art_id, source_gamma_id, dest_gamma_id, attr_type_id, mer.merge_branch_id, mer.dest_branch_id, value as source_value, status FROM osee_merge mer, osee_conflict con, osee_attribute atr Where mer.commit_transaction_id = ? AND mer.merge_branch_id = con.merge_branch_id And con.source_gamma_id = atr.gamma_id AND con.status in (" + ConflictStatus.COMMITTED.getValue() + ", " + ConflictStatus.INFORMATIONAL.getValue() + " ) order by attr_id", getHintsOrderedFirstRows()), - LOAD_HISTORICAL_ARTIFACTS("SELECT%s aj.art_id, txs.branch_id, txs.gamma_id, txs.mod_type, art_type_id, guid, human_readable_id, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.transaction_id <= aj.transaction_id AND txs.branch_id = aj.branch_id order by aj.branch_id, art.art_id, txs.transaction_id desc", Strings.HINTS__THE_INDEX), + LOAD_HISTORICAL_ARTIFACTS("SELECT%s aj.art_id, txs.branch_id, txs.gamma_id, txs.mod_type, art_type_id, guid, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.transaction_id <= aj.transaction_id AND txs.branch_id = aj.branch_id order by aj.branch_id, art.art_id, txs.transaction_id desc", Strings.HINTS__THE_INDEX), LOAD_HISTORICAL_ATTRIBUTES("SELECT att.art_id, att.attr_id, att.value, att.gamma_id, att.attr_type_id, att.uri, aj.branch_id, txs.mod_type, txs.transaction_id, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_attribute att, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = att.art_id AND att.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.transaction_id <= aj.transaction_id order by txs.branch_id, att.art_id, att.attr_id, txs.transaction_id desc"), LOAD_CURRENT_ATTRIBUTES(Strings.SELECT_CURRENT_ATTRIBUTES_PREFIX + "= 1 order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", getHintsOrderedFirstRows()), LOAD_CURRENT_ATTRIBUTES_WITH_DELETED(Strings.SELECT_CURRENT_ATTRIBUTES_PREFIX + "IN (1, 3) order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", getHintsOrderedFirstRows()), @@ -113,6 +113,6 @@ public enum OseeSql { "SELECT%s att1.art_id, att1.attr_id, att1.value, att1.gamma_id, att1.attr_type_id, att1.uri, al1.branch_id, txs.mod_type, txs.transaction_id FROM osee_join_artifact al1, osee_attribute att1, osee_txs txs WHERE al1.query_id = ? AND al1.art_id = att1.art_id AND att1.gamma_id = txs.gamma_id AND txs.branch_id = al1.branch_id AND txs.tx_current "; private static final String SELECT_CURRENT_ARTIFACTS_PREFIX = - "SELECT%s aj.art_id, txs.gamma_id, mod_type, art_type_id, guid, human_readable_id, txs.branch_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.tx_current "; + "SELECT%s aj.art_id, txs.gamma_id, mod_type, art_type_id, guid, txs.branch_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.tx_current "; } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java index 146b1ce04cf..896c95c5b54 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java @@ -121,19 +121,6 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, I this.artifactType = ArtifactTypeManager.getType(artifactType); } - // begin temp code - private String hrid = ""; - - public String getHrid() { - return hrid; - } - - public void setHrid(String hrid) { - this.hrid = hrid; - } - - // end temp code - public final boolean isInDb() { return transactionId != TRANSACTION_SENTINEL; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java index 32906245890..0e80396d7f1 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java @@ -378,8 +378,6 @@ public final class ArtifactLoader { factory.loadExisitingArtifact(artifactId, chStmt.getString("guid"), artifactType, chStmt.getInt("gamma_id"), branch, transactionId, ModificationType.getMod(chStmt.getInt("mod_type")), historical); - // temp code - artifact.setHrid(chStmt.getString("human_readable_id")); } if (reload == LoadType.RELOAD_CACHE) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java index 53faa16b0dd..d81c4c5a999 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java @@ -13,9 +13,7 @@ package org.eclipse.osee.framework.skynet.core.artifact; import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.database.core.ConnectionHandler; import org.eclipse.osee.framework.database.core.OseeSql; -import org.eclipse.osee.framework.database.core.SQL3DataType; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventModType; @@ -26,7 +24,7 @@ import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData; */ public class ArtifactTransactionData extends BaseTransactionData { private static final String INSERT_ARTIFACT = - "INSERT INTO osee_artifact (gamma_id, art_id, art_type_id, guid, human_readable_id) VALUES (?,?,?,?,?)"; + "INSERT INTO osee_artifact (gamma_id, art_id, art_type_id, guid) VALUES (?,?,?,?)"; private final Artifact artifact; @@ -44,9 +42,8 @@ public class ArtifactTransactionData extends BaseTransactionData { protected void addInsertToBatch(InsertDataCollector collector) throws OseeCoreException { super.addInsertToBatch(collector); if (!artifact.isUseBackingdata()) { - Object hrid = Strings.isValid(artifact.getHrid()) ? artifact.getHrid() : SQL3DataType.VARCHAR; internalAddInsertToBatch(collector, 1, INSERT_ARTIFACT, getGammaId(), artifact.getArtId(), - artifact.getArtTypeId(), artifact.getGuid(), hrid); + artifact.getArtTypeId(), artifact.getGuid()); } } 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 61e6ceaae86..0077865cec7 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 @@ -32,7 +32,6 @@ <Column id="ART_ID" defaultValue="not null" type="INTEGER" /> <Column id="ART_TYPE_ID" defaultValue="not null" type="BIGINT" /> <Column id="GUID" defaultValue="not null" limits="22" type="VARCHAR" /> - <Column id="HUMAN_READABLE_ID" limits="5" type="VARCHAR" /> <Constraint schema="OSEE" id="OSEE_ART__G_A_PK" type="PRIMARY KEY" appliesTo="ART_ID, GAMMA_ID" /> <Constraint schema="OSEE" id="OSEE_ART__ART_TYPE_ID_FK" type="FOREIGN KEY" appliesTo="ART_TYPE_ID" deferrable="true"> <References schema="OSEE" table="OSEE_TYPE_ID_MAP" column="LOCAL_ID" /> diff --git a/plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zip b/plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zip Binary files differindex 32b385b4012..8484790c5e7 100644 --- a/plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zip +++ b/plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zip diff --git a/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip b/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip Binary files differindex d313ecafba8..7680d22dc2e 100644 --- a/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip +++ b/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip |