diff options
author | jphillips | 2012-03-26 14:58:54 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2012-03-26 14:58:54 +0000 |
commit | a4bca34358dcada89d786f5b7736aad92f4c96e0 (patch) | |
tree | 64fe5b8351e07cf4d3e50f28860100bde336d0ae | |
parent | b8791ad9d09a7f65b0d1a30ae4e87007c259d468 (diff) | |
download | org.eclipse.osee-a4bca34358dcada89d786f5b7736aad92f4c96e0.tar.gz org.eclipse.osee-a4bca34358dcada89d786f5b7736aad92f4c96e0.tar.xz org.eclipse.osee-a4bca34358dcada89d786f5b7736aad92f4c96e0.zip |
refinement: Cleaned up code base by removing unneeded validate change report
12 files changed, 0 insertions, 1137 deletions
diff --git a/plugins/org.eclipse.osee.ats/plugin.xml b/plugins/org.eclipse.osee.ats/plugin.xml index 85461bdf31e..5f6ecfbd892 100644 --- a/plugins/org.eclipse.osee.ats/plugin.xml +++ b/plugins/org.eclipse.osee.ats/plugin.xml @@ -230,14 +230,6 @@ </XWidgetProvider> </extension> <extension - id="TranslateImportedValidateChangeReports" - name="TranslateImportedValidateChangeReports" - point="org.eclipse.osee.framework.ui.skynet.BlamOperation"> - <Operation - className="org.eclipse.osee.ats.health.TxImportedValidateChangeReports"> - </Operation> - </extension> - <extension point="org.eclipse.ui.commands"> <command id="org.eclipse.osee.framework.ui.skynet.atseditor.command" diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ChangeReportComparer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ChangeReportComparer.java deleted file mode 100644 index 56c38012ae1..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ChangeReportComparer.java +++ /dev/null @@ -1,59 +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.health; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import org.eclipse.osee.ats.health.change.DataChangeReportComparer; -import org.eclipse.osee.ats.health.change.ValidateChangeReportParser; -import org.eclipse.osee.ats.internal.Activator; -import org.eclipse.osee.framework.logging.OseeLog; - -/** - * Compares two change reports to see if they match. - * - * @author Jeff C. Phillips - */ -public class ChangeReportComparer { - - /** - * Compares two change report strings by parsing them and comparing each artifact change, attribute change and - * relation change. - * - * @return Returns true if the change reports matches else false. - */ - public boolean compare(String currentData, String storedData) { - boolean success = true; - ValidateChangeReportParser parser = new ValidateChangeReportParser(); - List<ArrayList<DataChangeReportComparer>> currentList = parser.parse(currentData); - List<ArrayList<DataChangeReportComparer>> storedList = parser.parse(storedData); - - if (currentList.size() != storedList.size() || currentList.get(0).size() != storedList.get(0).size() || currentList.get( - 1).size() != storedList.get(1).size() || currentList.get(2).size() != storedList.get(2).size()) { - OseeLog.log(Activator.class, Level.SEVERE, "The change reports must have the same number of items"); - return false; - } - for (int i = 0; i < currentList.size(); i++) { - for (int j = 0; j < currentList.get(i).size(); j++) { - if (!currentList.get(i).get(j).getContent().equals(storedList.get(i).get(j).getContent())) { - success = false; - StringBuffer sb = new StringBuffer(); - sb.append(currentList.get(i).get(j).getContent()); - sb.append(storedList.get(i).get(j).getContent()); - sb.append("---------------------------------------------------"); - OseeLog.log(Activator.class, Level.SEVERE, sb.toString()); - } - } - } - return success; - } -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/TxImportedValidateChangeReports.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/TxImportedValidateChangeReports.java deleted file mode 100644 index af68a80d94c..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/TxImportedValidateChangeReports.java +++ /dev/null @@ -1,292 +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.health; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.osee.ats.util.AtsUtil; -import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; -import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; -import org.eclipse.osee.framework.core.exception.OseeArgumentException; -import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.exception.OseeStateException; -import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.database.core.ConnectionHandler; -import org.eclipse.osee.framework.database.core.IOseeSequence; -import org.eclipse.osee.framework.database.core.IOseeStatement; -import org.eclipse.osee.framework.database.core.OseeInfo; -import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet; -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.search.ArtifactQuery; -import org.eclipse.osee.framework.skynet.core.utility.Artifacts; -import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; -import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; - -/** - * @author Roberto E. Escobar - */ -public class TxImportedValidateChangeReports extends AbstractBlam { - - private static final String[] ARTIFACT_ID_ALIASES = new String[] {"artId", "bArtId", "aOrdr", "bOrdr"}; - public static final String BRANCH_ID_ALIASES = "brGuid"; - private static final String GAMMA_ID_ALIASES = "gamma"; - private static final String[] TRANSACTION_ID_ALIASES = new String[] {"tTranId", "fTranId"}; - private static final String ARTIFACT_TYPE_ID = "artTId"; - private static final String ATTRIBUTE_TYPE_ID = "attrTId"; - private static final String RELATION_TYPE_ID = "relTId"; - private static final String ATTRIBUTE_ID = "attrId"; - private static final String RELATION_ID = "relId"; - private static final String EMPTY_STRING = ""; - - private static final String VCR_ROOT_ELEMENT_TAG = ValidateChangeReports.VCR_ROOT_ELEMENT_TAG; - private static final String VCR_DB_GUID = ValidateChangeReports.VCR_DB_GUID; - - private static final Matcher NUMERICAL_MATCH = Pattern.compile("\\d+").matcher(EMPTY_STRING); - private static final Matcher SOURCE_DB_GUID_MATCHER = Pattern.compile( - "\\s*<" + VCR_ROOT_ELEMENT_TAG + "\\s*" + VCR_DB_GUID + "=\"(.*?)\"\\s*>").matcher(EMPTY_STRING); - private static final Matcher XML_TAGGED_IDS_MATCHER = Pattern.compile("<(.*?)>(\\d+)</(.*?)>").matcher(EMPTY_STRING); - - private Map<String, ImportedId> translatorMap; - private String currentDbGuid; - - @Override - public String getName() { - return "Tx Imported Validate Change Reports"; - } - - private void setup(String databaseTargetId) throws OseeCoreException { - List<ImportedId> importtedIds = getImportedIds(); - for (ImportedId importedId : importtedIds) { - logf(importedId.getSequence()); - importedId.load(databaseTargetId); - } - - this.translatorMap = new HashMap<String, ImportedId>(); - for (ImportedId translator : importtedIds) { - for (String alias : translator.getAliases()) { - translatorMap.put(alias, translator); - } - } - - this.currentDbGuid = OseeInfo.getDatabaseGuid(); - } - - private void cleanUp() { - if (translatorMap != null && !translatorMap.isEmpty()) { - for (String key : translatorMap.keySet()) { - translatorMap.get(key).clear(); - } - translatorMap.clear(); - } - this.currentDbGuid = null; - } - - private List<ImportedId> getImportedIds() { - List<ImportedId> translators = new ArrayList<ImportedId>(); - translators.add(new ImportedId(IOseeSequence.GAMMA_ID_SEQ, GAMMA_ID_ALIASES)); - translators.add(new ImportedId(IOseeSequence.TRANSACTION_ID_SEQ, TRANSACTION_ID_ALIASES)); - translators.add(new ImportedId(IOseeSequence.BRANCH_ID_SEQ, BRANCH_ID_ALIASES)); - translators.add(new ImportedId(IOseeSequence.ART_TYPE_ID_SEQ, ARTIFACT_TYPE_ID)); - translators.add(new ImportedId(IOseeSequence.ATTR_TYPE_ID_SEQ, ATTRIBUTE_TYPE_ID)); - translators.add(new ImportedId(IOseeSequence.REL_LINK_TYPE_ID_SEQ, RELATION_TYPE_ID)); - translators.add(new ImportedId(IOseeSequence.ART_ID_SEQ, ARTIFACT_ID_ALIASES)); - translators.add(new ImportedId(IOseeSequence.ATTR_ID_SEQ, ATTRIBUTE_ID)); - translators.add(new ImportedId(IOseeSequence.REL_LINK_ID_SEQ, RELATION_ID)); - return translators; - } - - private long translate(String tag, long original) { - long toReturn = original; - if (Strings.isValid(tag)) { - ImportedId importedId = translatorMap.get(tag); - if (importedId != null) { - toReturn = importedId.getFromCache(original); - } - } - return toReturn; - } - - private String getDataDbGuid(String data) { - String toReturn = null; - SOURCE_DB_GUID_MATCHER.reset(data); - if (SOURCE_DB_GUID_MATCHER.find()) { - toReturn = SOURCE_DB_GUID_MATCHER.group(1); - } - return toReturn != null ? toReturn : EMPTY_STRING; - } - - @Override - public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { - try { - Branch branch = AtsUtil.getAtsBranch(); - String databaseTargetId = variableMap.getString("Import Db Id"); - boolean shouldIncludeItemsWithoutDbId = variableMap.getBoolean("Include items without database id"); - if (!Strings.isValid(databaseTargetId)) { - throw new OseeArgumentException("Invalid database target id"); - } - - databaseTargetId = databaseTargetId.trim(); - setup(databaseTargetId); - - List<Artifact> artifacts = - ArtifactQuery.getArtifactListFromTypeAndName(CoreArtifactTypes.GeneralData, "VCR_%", branch); - for (Artifact artifact : artifacts) { - String data = artifact.getSoleAttributeValue(CoreAttributeTypes.GeneralStringData); - String name = artifact.getName(); - try { - String dataDbGuid = getDataDbGuid(data); - if (Strings.isValid(dataDbGuid) || shouldIncludeItemsWithoutDbId && databaseTargetId.equals(dataDbGuid) || shouldIncludeItemsWithoutDbId && !currentDbGuid.equals(dataDbGuid)) { - String modified = translateImportedData(data); - modified = updateSourceGuid(currentDbGuid, modified); - artifact.setSoleAttributeValue(CoreAttributeTypes.GeneralStringData, modified); - } - } catch (Exception ex) { - throw new OseeCoreException(String.format("Error processing [%s]", name), ex); - } - } - Artifacts.persistInTransaction("Import Validate Change Reports", artifacts); - } finally { - cleanUp(); - } - } - - @Override - public String getXWidgetsXml() { - StringBuilder builder = new StringBuilder(); - builder.append("<xWidgets>"); - builder.append("<XWidget xwidgetType=\"XText\" displayName=\"Import Db Id\" defaultValue=\"AAABHL_5XvkAFHT8QsrrPQ\"/>"); - builder.append("<XWidget xwidgetType=\"XCheckBox\" displayName=\"Include items without database id\" labelAfter=\"true\" horizontalLabel=\"true\"/>"); - builder.append("</xWidgets>"); - return builder.toString(); - } - - private static boolean isNumerical(String value) { - boolean result = false; - if (Strings.isValid(value)) { - NUMERICAL_MATCH.reset(value); - result = NUMERICAL_MATCH.matches(); - } - return result; - } - - private String translateImportedData(String data) { - ChangeSet changeSet = new ChangeSet(data); - XML_TAGGED_IDS_MATCHER.reset(data); - while (XML_TAGGED_IDS_MATCHER.find()) { - String tag = XML_TAGGED_IDS_MATCHER.group(3); - tag = tag.toLowerCase().trim(); - String value = XML_TAGGED_IDS_MATCHER.group(2); - if (isNumerical(value)) { - long original = Long.parseLong(value); - long newValue = translate(tag, original); - if (original != newValue) { - changeSet.replace(XML_TAGGED_IDS_MATCHER.start(2), XML_TAGGED_IDS_MATCHER.end(2), - Long.toString(newValue)); - } - } - } - return changeSet.applyChangesToSelf().toString(); - } - - private String updateSourceGuid(String currentDbGuid, String data) throws OseeStateException { - String toReturn = null; - ChangeSet changeSet = new ChangeSet(data); - SOURCE_DB_GUID_MATCHER.reset(data); - if (SOURCE_DB_GUID_MATCHER.find()) { - String id = SOURCE_DB_GUID_MATCHER.group(1); - if (!currentDbGuid.equals(id)) { - changeSet.replace(SOURCE_DB_GUID_MATCHER.start(1), SOURCE_DB_GUID_MATCHER.end(1), currentDbGuid); - toReturn = changeSet.applyChangesToSelf().toString(); - } else { - toReturn = data; - } - } else { - if (!data.contains(VCR_ROOT_ELEMENT_TAG)) { - toReturn = - String.format("<%s dbGuid=\"%s\">%s</%s>", VCR_ROOT_ELEMENT_TAG, currentDbGuid, data, - VCR_ROOT_ELEMENT_TAG); - } else { - throw new OseeStateException("Error updating dbId"); - } - } - return toReturn; - } - private static final class ImportedId { - private static final String SELECT_IDS_BY_DB_SOURCE_AND_SEQ_NAME = - "SELECT original_id, mapped_id FROM osee_import_source ois, osee_import_map oim, osee_import_index_map oiim WHERE ois.import_id = oim.import_id AND oim.sequence_id = oiim.sequence_id AND oiim.sequence_id = oiim.sequence_id AND ois.db_source_guid = ? AND oim.sequence_name = ?"; - - private final String sequenceName; - private final Map<Long, Long> originalToMapped; - private final Set<String> aliases; - - ImportedId(String sequenceName, String... aliases) { - this.sequenceName = sequenceName; - this.originalToMapped = new HashMap<Long, Long>(); - this.aliases = new HashSet<String>(); - if (aliases != null && aliases.length > 0) { - for (String alias : aliases) { - this.aliases.add(alias.toLowerCase()); - } - } - } - - public void clear() { - this.originalToMapped.clear(); - this.aliases.clear(); - } - - public Set<String> getAliases() { - return this.aliases; - } - - public String getSequence() { - return this.sequenceName; - } - - public Long getFromCache(Long original) { - Long newVersion = null; - if (original <= 0L) { - newVersion = original; - } else { - newVersion = this.originalToMapped.get(original); - } - return newVersion; - } - - public void load(String sourceDatabaseId) throws OseeCoreException { - IOseeStatement chStmt = ConnectionHandler.getStatement(); - try { - originalToMapped.clear(); - chStmt.runPreparedQuery(10000, SELECT_IDS_BY_DB_SOURCE_AND_SEQ_NAME, sourceDatabaseId, getSequence()); - while (chStmt.next()) { - originalToMapped.put(chStmt.getLong("original_id"), chStmt.getLong("mapped_id")); - } - } finally { - chStmt.close(); - } - } - } - - @Override - public Collection<String> getCategories() { - return Arrays.asList("ATS.Admin"); - } -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateChangeReportByHrid.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateChangeReportByHrid.java deleted file mode 100644 index e20d94898f3..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateChangeReportByHrid.java +++ /dev/null @@ -1,87 +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.health; - -import java.util.logging.Level; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.osee.ats.core.team.TeamWorkFlowArtifact; -import org.eclipse.osee.ats.internal.Activator; -import org.eclipse.osee.ats.util.AtsUtil; -import org.eclipse.osee.framework.core.util.XResultData; -import org.eclipse.osee.framework.database.core.OseeInfo; -import org.eclipse.osee.framework.jdk.core.util.Strings; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.plugin.core.util.Jobs; -import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; -import org.eclipse.osee.framework.ui.plugin.PluginUiImage; -import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption; -import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem; -import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction; -import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; -import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryCheckDialog; - -/** - * @author Donald G. Dunne - */ -public class ValidateChangeReportByHrid extends XNavigateItemAction { - - public ValidateChangeReportByHrid(XNavigateItem parent) { - super(parent, "Validate Change Reports by HRID", PluginUiImage.ADMIN); - } - - @Override - public void run(TableLoadOption... tableLoadOptions) { - EntryCheckDialog ed = new EntryCheckDialog(getName(), "Enter HRID", "Display Was/Is data in Results View."); - if (ed.open() == 0) { - String hrid = ed.getEntry(); - if (Strings.isValid(hrid)) { - Jobs.startJob(new Report(getName(), hrid, ed.isChecked()), true); - } - } - } - - public static class Report extends Job { - - private final String hrid; - private final boolean exportWasIs; - - public Report(String name, String hrid, boolean exportWasIs) { - super(name); - this.hrid = hrid; - this.exportWasIs = exportWasIs; - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - try { - final XResultData rd = new XResultData(); - try { - TeamWorkFlowArtifact teamArt = - (TeamWorkFlowArtifact) ArtifactQuery.getArtifactFromId(hrid, AtsUtil.getAtsBranch()); - String currentDbGuid = OseeInfo.getDatabaseGuid(); - ValidateChangeReports.changeReportValidated(currentDbGuid, teamArt, rd, exportWasIs); - } catch (Exception ex) { - rd.logError(ex.getLocalizedMessage()); - } - XResultDataUI.report(rd,getName()); - } catch (Exception ex) { - OseeLog.log(Activator.class, Level.SEVERE, ex); - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getMessage(), ex); - } - monitor.done(); - return Status.OK_STATUS; - } - } - -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateChangeReports.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateChangeReports.java deleted file mode 100644 index 3b366d44a92..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateChangeReports.java +++ /dev/null @@ -1,411 +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.health; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.logging.Level; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.osee.ats.core.branch.AtsBranchManagerCore; -import org.eclipse.osee.ats.core.team.TeamWorkFlowArtifact; -import org.eclipse.osee.ats.core.team.TeamWorkFlowManager; -import org.eclipse.osee.ats.core.type.AtsArtifactTypes; -import org.eclipse.osee.ats.core.type.AtsAttributeTypes; -import org.eclipse.osee.ats.health.change.DataChangeReportComparer; -import org.eclipse.osee.ats.health.change.ValidateChangeReportParser; -import org.eclipse.osee.ats.internal.Activator; -import org.eclipse.osee.ats.util.AtsBranchManager; -import org.eclipse.osee.ats.util.AtsUtil; -import org.eclipse.osee.framework.core.data.IArtifactType; -import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; -import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; -import org.eclipse.osee.framework.core.enums.ModificationType; -import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.exception.OseeStateException; -import org.eclipse.osee.framework.core.util.Result; -import org.eclipse.osee.framework.core.util.XResultData; -import org.eclipse.osee.framework.database.core.OseeInfo; -import org.eclipse.osee.framework.jdk.core.util.AHTML; -import org.eclipse.osee.framework.jdk.core.util.AXml; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.logging.IHealthStatus; -import org.eclipse.osee.framework.logging.OseeLevel; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.logging.SevereLoggingMonitor; -import org.eclipse.osee.framework.plugin.core.util.Jobs; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; -import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; -import org.eclipse.osee.framework.skynet.core.change.ArtifactChange; -import org.eclipse.osee.framework.skynet.core.change.AttributeChange; -import org.eclipse.osee.framework.skynet.core.change.Change; -import org.eclipse.osee.framework.skynet.core.change.RelationChange; -import org.eclipse.osee.framework.skynet.core.revision.ChangeData; -import org.eclipse.osee.framework.skynet.core.revision.ChangeData.KindType; -import org.eclipse.osee.framework.ui.plugin.PluginUiImage; -import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption; -import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem; -import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction; -import org.eclipse.osee.framework.ui.skynet.compare.CompareHandler; -import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; -import org.eclipse.osee.framework.ui.swt.Displays; - -/** - * This test will validate the change report data that is returned for the ATS configured actions with committed - * branches. Upon first time run against a newly committed branch, it will generate a "General Data" artifact with the - * change report data stored to xml in a "General String Data" attribute. <br> - * <br> - * Every additional time this validation is run against an already stored change report, the current xml and stored xml - * change report will be compared. <br> - * <br> - * If errors are found, the developer will need to put a breakpoint below to see the was-is values of the change report - * data.<br> - * <br> - * This test also ensures that all change reports can return their historical artifacts by loading and accessing the - * descriptive name for each artifact. - * - * @author Donald G. Dunne - */ -public class ValidateChangeReports extends XNavigateItemAction { - - static final String VCR_ROOT_ELEMENT_TAG = "ValidateChangeReport"; - static final String VCR_DB_GUID = "dbGuid"; - boolean debug = false; - - public ValidateChangeReports(XNavigateItem parent) { - super(parent, "Validate Change Reports", PluginUiImage.ADMIN); - } - - @Override - public void run(TableLoadOption... tableLoadOptions) { - if (!MessageDialog.openConfirm(Displays.getActiveShell(), getName(), getName())) { - return; - } - Jobs.startJob(new Report(getName()), true); - } - - public class Report extends Job { - - public Report(String name) { - super(name); - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - try { - final XResultData rd = new XResultData(); - runIt(monitor, rd); - XResultDataUI.report(rd, getName()); - } catch (Exception ex) { - OseeLog.log(Activator.class, Level.SEVERE, ex); - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getMessage(), ex); - } - monitor.done(); - return Status.OK_STATUS; - } - } - - private void runIt(IProgressMonitor monitor, XResultData xResultData) throws OseeCoreException { - String currentDbGuid = OseeInfo.getDatabaseGuid(); - if (debug) { - validateSome(xResultData, currentDbGuid); - } else { - SevereLoggingMonitor monitorLog = new SevereLoggingMonitor(); - OseeLog.registerLoggerListener(monitorLog); - StringBuffer sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1)); - String[] columnHeaders = new String[] {"HRID", "PCR", "Results"}; - sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders)); - for (IArtifactType artifactType : TeamWorkFlowManager.getTeamWorkflowArtifactTypes()) { - sbFull.append(AHTML.addRowSpanMultiColumnTable(artifactType.getName(), columnHeaders.length)); - - try { - int x = 1; - Collection<Artifact> artifacts = - ArtifactQuery.getArtifactListFromType(artifactType, AtsUtil.getAtsBranch()); - for (Artifact artifact : artifacts) { - String resultStr = "PASS"; - TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) artifact; - - try { - String str = String.format("Processing %s/%s - %s", x++, artifacts.size(), artifact); - OseeLog.log(Activator.class, Level.INFO, str); - if (monitor != null) { - monitor.subTask(str); - } - - // Only validate committed branches cause working branches change too much - if (!AtsBranchManagerCore.isCommittedBranchExists(teamArt)) { - continue; - } - Result valid = changeReportValidated(currentDbGuid, teamArt, xResultData, false); - if (valid.isFalse()) { - resultStr = "Error: " + valid.getText(); - } - } catch (Exception ex) { - resultStr = "Error: Exception Validating: " + ex.getLocalizedMessage(); - OseeLog.log(Activator.class, Level.SEVERE, ex); - } - sbFull.append(AHTML.addRowMultiColumnTable(teamArt.getHumanReadableId(), - teamArt.getSoleAttributeValue(AtsAttributeTypes.LegacyPcrId, ""), resultStr)); - } - } catch (Exception ex) { - sbFull.append(AHTML.addRowSpanMultiColumnTable("Exception: " + ex.getLocalizedMessage(), - columnHeaders.length)); - } - } - sbFull.append(AHTML.endMultiColumnTable()); - xResultData.addRaw(sbFull.toString().replaceAll("\n", "")); - List<IHealthStatus> stats = new ArrayList<IHealthStatus>(monitorLog.getAllLogs()); - for (IHealthStatus stat : stats) { - Throwable tr = stat.getException(); - if (tr != null) { - xResultData.logError("Exception: " + Lib.exceptionToString(stat.getException())); - } - } - } - } - - private void validateSome(XResultData rd, String currentDbGuid) throws OseeCoreException { - Collection<Artifact> artifacts = - ArtifactQuery.getArtifactListFromIds(analyzeForMergeDifferences, AtsUtil.getAtsBranch()); - int x = 0; - for (Artifact artifact : artifacts) { - if (!artifact.isOfType(AtsArtifactTypes.TeamWorkflow)) { - rd.logError("Unexpected type for " + artifact.toStringWithId()); - } - TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) artifact; - - String str = String.format("Processing %s/%s - %s", x++, artifacts.size(), artifact); - OseeLog.log(Activator.class, Level.INFO, str); - - // Only validate committed branches cause working branches change too much - if (!AtsBranchManagerCore.isCommittedBranchExists(teamArt)) { - continue; - } - Result valid = changeReportValidated(currentDbGuid, teamArt, rd, false); - if (valid.isFalse()) { - rd.logError(valid.getText()); - } - } - } - private final List<String> analyzeForMergeDifferences = Arrays.asList("D11QS", "15TT6", "9BJ55", "KJSXG", "W7C6Q", - "QJN6U", "ABKL6", "57C55", "C7JVC", "FJ8QG", "PD2L9", "R544L", "H2ZWZ", "XZDFL", "ZQYNV", "2M3R1", "H3MPT", - "DQWMJ", "G985U", "SC16V", "6HN4Y", "HMQZ0", "DHBYH", "B7NVG", "DNTLC", "C8C7G", "D96KZ", "L2VQY", "547KS", - "GN5SD", "E02FA", "6H998", "9SRR7", "GBTY3", "C7HGV", "KVFFX", "GB0R4", "417PW", "9JK7Q", "Y84NK", "LRMZT", - "BXH48", "L5554", "XJNLZ", "VNTWE", "5QG8E", "FC7PB", "BLN8W", "D9496", "QQKJS", "X808E", "YN188", "VHM3X", - "2ZSZ7", "YFKYZ", "3Q50H", "646WD", "J6L48", "0P9YU", "89B4J", "ZVS1V", "XXFFH", "Y2NCG", "9K6WL", "8SX10", - "BW2Q0", "B0JXG", "QQ1R9", "FR6SE", "WQZ9V", "JSWYS", "6W54P", "BDN3C", "533VS", "ECMZL", "PQN1T", "6SG3K", - "WCZ3S", "J6G34", "99VFY", "GXWCE", "77BNS", "D5SBA", "AYV56", "ZTQ8U", "A1B4Q", "6K4C5", "6MDYJ", "NZBT2", - "MR1LL", "98ZKQ", "DS6CQ"); - - /** - * Return true if current change report is same as stored change report data - * - * @return Result.TrueResult if same, else Result.FalseResult with comparison in resultData - */ - static Result changeReportValidated(final String currentDbGuid, final TeamWorkFlowArtifact teamArt, XResultData resultData, boolean displayWasIs) throws OseeCoreException { - String name = "VCR_" + teamArt.getHumanReadableId(); - List<Artifact> arts = - ArtifactQuery.getArtifactListFromTypeAndName(CoreArtifactTypes.GeneralData, name, AtsUtil.getAtsBranch()); - String storedChangeReport = null; - Artifact artifactForStore = null; - if (arts.size() > 1) { - throw new OseeStateException("Multiple artifacts found named [%s]", name); - } else if (arts.size() == 1) { - artifactForStore = arts.iterator().next(); - storedChangeReport = artifactForStore.getSoleAttributeValue(CoreAttributeTypes.GeneralStringData, null); - } - // Retrieve current - ChangeData currentChangeData = AtsBranchManager.getChangeDataFromEarliestTransactionId(teamArt); - if (currentChangeData.isEmpty()) { - return new Result(String.format("FAIL: Unexpected empty change report for %s", teamArt.toStringWithId())); - } - // Store - if (storedChangeReport == null) { - // Reuse same artifact if already exists - if (artifactForStore == null) { - artifactForStore = - ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralData, AtsUtil.getAtsBranch(), name); - } - artifactForStore.setSoleAttributeValue(CoreAttributeTypes.GeneralStringData, - getReport(currentDbGuid, currentChangeData)); - artifactForStore.persist(ValidateChangeReports.class.getSimpleName()); - resultData.log("Stored Change Report for " + teamArt.getHumanReadableId()); - return new Result(true, "Stored Change Report for " + teamArt.getHumanReadableId()); - } - // Else, compare the two and report - else { - final String currentChangeReport = getReport(currentDbGuid, currentChangeData); - final String fStoredChangeReport = storedChangeReport.replaceAll("\n", ""); - if (!isXmlChangeDataEqual(currentChangeReport, fStoredChangeReport)) { - resultData.logError("Was/Is Change Report different for " + teamArt.getHumanReadableId()); - if (displayWasIs) { - resultData.log("Was / Is reports displayed in Results View"); - } - if (displayWasIs) { - try { - Displays.ensureInDisplayThread(new Runnable() { - @Override - public void run() { - try { - String storedChangeReportString = GetComparableString(fStoredChangeReport); - String currentChangeReportString = GetComparableString(currentChangeReport); - - CompareHandler compareHandler = - new CompareHandler(storedChangeReportString, currentChangeReportString); - compareHandler.compare(); - - } catch (Exception ex) { - OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); - } - } - }); - - } catch (Exception ex) { - OseeLog.log(Activator.class, Level.SEVERE, ex); - } - } - return new Result("FAIL: Was/Is Change Report different"); - } - } - // As another test, ensure that all artifacts can be retrieved and display their name - try { - for (Artifact art : currentChangeData.getArtifacts(KindType.ArtifactOrRelation, ModificationType.NEW, - ModificationType.DELETED, ModificationType.MERGED)) { - art.getName(); - } - } catch (Exception ex) { - OseeLog.log(Activator.class, Level.SEVERE, ex); - return new Result("FAIL: Exception accessing name of change report artifacts: " + ex.getLocalizedMessage()); - } - // As another test, allow ATS extensions add their own tests - for (IAtsHealthCheck atsHealthCheck : AtsHealthCheck.getAtsHealthCheckItems()) { - Result result = atsHealthCheck.validateChangeReports(currentChangeData, teamArt, resultData); - if (result.isFalse()) { - return result; - } - } - - return new Result(true, "PASS"); - } - - private static String GetComparableString(String changeReportString) { - StringBuffer comparableString = new StringBuffer(); - ValidateChangeReportParser parser = new ValidateChangeReportParser(); - List<ArrayList<DataChangeReportComparer>> changeReport = parser.parse(changeReportString); - - for (int i = 0; i < changeReport.size(); i++) { - for (int j = 0; j < changeReport.get(i).size(); j++) { - comparableString.append(changeReport.get(i).get(j).getContent()); - } - } - return comparableString.toString().replaceAll("><", ">\n<"); - } - - private static String getReport(String dbGuid, ChangeData changeData) { - StringBuffer sb = new StringBuffer(); - sb.append(String.format("<%s %s=\"%s\">", VCR_ROOT_ELEMENT_TAG, VCR_DB_GUID, dbGuid)); - for (Change change : changeData.getChanges()) { - if (change instanceof RelationChange) { - sb.append(toXml((RelationChange) change)); - } else if (change instanceof ArtifactChange) { - sb.append(toXml((ArtifactChange) change)); - } else if (change instanceof AttributeChange) { - sb.append(toXml((AttributeChange) change)); - } - } - sb.append(String.format("</%s>", VCR_ROOT_ELEMENT_TAG)); - String toReturn = sb.toString().replaceAll(">[\\s\\n\\r]+$", ">"); - return toReturn.replaceAll("\n", ""); - } - - private static void toXmlCommon(Change change, StringBuffer sb) { - sb.append(AXml.addTagData(TxImportedValidateChangeReports.BRANCH_ID_ALIASES, change.getBranch().getGuid())); - } - - private static String toXml(RelationChange change) { - StringBuffer sb = new StringBuffer(); - toXmlCommon(change, sb); - sb.append(AXml.addTagData("artTId", String.valueOf(change.getItemTypeId()))); - sb.append(AXml.addTagData("gamma", String.valueOf(change.getGamma()))); - sb.append(AXml.addTagData("artId", String.valueOf(change.getArtId()))); - sb.append(AXml.addTagData("tTranId", String.valueOf(change.getTxDelta().getEndTx().getId()))); - sb.append(AXml.addTagData("fTranId", String.valueOf(change.getTxDelta().getStartTx().getId()))); - sb.append(AXml.addTagData("mType", String.valueOf(change.getModificationType().name()))); - sb.append(AXml.addTagData("bArtId", String.valueOf(change.getBArtId()))); - sb.append(AXml.addTagData("relId", String.valueOf(change.getRelLinkId()))); - sb.append(AXml.addTagData("rat", change.getRationale())); - sb.append(AXml.addTagData("relTId", String.valueOf(change.getRelationType().getId()))); - sb.append(AXml.addTagData("hist", String.valueOf(change.isHistorical()))); - return AXml.addTagData("RelChg", sb.toString()); - } - - private static String toXml(ArtifactChange change) { - StringBuffer sb = new StringBuffer(); - toXmlCommon(change, sb); - sb.append(AXml.addTagData("artTId", String.valueOf(change.getItemTypeId()))); - sb.append(AXml.addTagData("gamma", String.valueOf(change.getGamma()))); - sb.append(AXml.addTagData("artId", String.valueOf(change.getArtId()))); - sb.append(AXml.addTagData("tTranId", String.valueOf(change.getTxDelta().getEndTx().getId()))); - sb.append(AXml.addTagData("fTranId", String.valueOf(change.getTxDelta().getStartTx().getId()))); - sb.append(AXml.addTagData("mType", String.valueOf(change.getModificationType().name()))); - sb.append(AXml.addTagData("hist", String.valueOf(change.isHistorical()))); - return AXml.addTagData("ArtChg", sb.toString()); - } - - private static String toXml(AttributeChange change) { - StringBuffer sb = new StringBuffer(); - toXmlCommon(change, sb); - sb.append(AXml.addTagData("artTId", String.valueOf(change.getItemTypeId()))); - sb.append(AXml.addTagData("gamma", String.valueOf(change.getGamma()))); - sb.append(AXml.addTagData("artId", String.valueOf(change.getArtId()))); - sb.append(AXml.addTagData("tTranId", String.valueOf(change.getTxDelta().getEndTx().getId()))); - sb.append(AXml.addTagData("fTranId", String.valueOf(change.getTxDelta().getStartTx().getId()))); - sb.append(AXml.addTagData("mType", String.valueOf(change.getModificationType().name()))); - sb.append(AXml.addTagData("aModType", String.valueOf(change.getArtModType().name()))); - sb.append(AXml.addTagData("attrId", String.valueOf(change.getAttrId()))); - sb.append(AXml.addTagData("attrTId", String.valueOf(change.getAttributeType().getId()))); - sb.append(AXml.addTagData("hist", String.valueOf(change.isHistorical()))); - return AXml.addTagData("AttrChg", sb.toString()); - } - - private static boolean isXmlChangeDataEqual(String currentData, String storedData) { - int checkSum1 = getCheckSum(currentData); - int checkSum2 = getCheckSum(storedData); - - boolean result = checkSum1 == checkSum2; - if (!result) { - ChangeReportComparer comparer = new ChangeReportComparer(); - comparer.compare(currentData, storedData); - - OseeLog.logf(Activator.class, Level.SEVERE, "Checksums not equal - stored:[%s] current:[%s]", checkSum1, - checkSum2); - } - return result; - } - - private static int getCheckSum(String data) { - int checksum = -1; - for (int index = 0; index < data.length(); index++) { - char character = data.charAt(index); - if (character != '\n' && character != '\t' && character != '\r' && character != ' ') { - checksum += character; - } - } - return checksum; - } -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ArtifactChangeReportComparer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ArtifactChangeReportComparer.java deleted file mode 100644 index d233dd1f897..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ArtifactChangeReportComparer.java +++ /dev/null @@ -1,46 +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.health.change; - -/** - * @author Jeff C. Phillips - */ -public class ArtifactChangeReportComparer extends DataChangeReportComparer { - private int artId; - public final static String ART_START_TAG = "<artId>"; - public final static String ART_END_TAG = "</artId>"; - - public ArtifactChangeReportComparer(String content) { - super(content); - } - - @Override - public void processContent(String content) { - artId = - Integer.parseInt(content.substring(content.indexOf(ART_START_TAG) + ART_START_TAG.length(), - content.indexOf(ART_END_TAG))); - } - - @Override - public int compareTo(Object obj) { - int compareResult = -1; - if (obj instanceof ArtifactChangeReportComparer) { - ArtifactChangeReportComparer comparer = (ArtifactChangeReportComparer) obj; - if (this.artId == comparer.artId) { - compareResult = 0; - } else if (this.artId > comparer.artId) { - compareResult = 1; - } - } - return compareResult; - } - -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/AttributeChangeReportComparer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/AttributeChangeReportComparer.java deleted file mode 100644 index 96740f55633..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/AttributeChangeReportComparer.java +++ /dev/null @@ -1,58 +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.health.change; - -/** - * @author Jeff C. Phillips - */ -public class AttributeChangeReportComparer extends DataChangeReportComparer { - private final static String ATTR_START_TAG = "<attrId>"; - private final static String ATTR_END_TAG = "</attrId>"; - private int artId; - private int attrId; - - public AttributeChangeReportComparer(String content) { - super(content); - } - - @Override - public void processContent(String content) { - artId = - Integer.parseInt(content.substring( - content.indexOf(ArtifactChangeReportComparer.ART_START_TAG) + ArtifactChangeReportComparer.ART_START_TAG.length(), - content.indexOf(ArtifactChangeReportComparer.ART_END_TAG))); - - attrId = - Integer.parseInt(content.substring(content.indexOf(ATTR_START_TAG) + ATTR_START_TAG.length(), - content.indexOf(ATTR_END_TAG))); - } - - @Override - public int compareTo(Object obj) { - int compareResults = -1; - - if (obj instanceof AttributeChangeReportComparer) { - AttributeChangeReportComparer comparer = (AttributeChangeReportComparer) obj; - - if (this.artId == comparer.artId) { - if (this.attrId == comparer.attrId) { - compareResults = 0; - } else if (this.attrId > comparer.attrId) { - compareResults = 1; - } - } else if (this.artId > comparer.artId) { - compareResults = 1; - } - } - return compareResults; - } - -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ChangeComparerTest.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ChangeComparerTest.java deleted file mode 100644 index f340849eccd..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ChangeComparerTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.health.change; - -import java.util.logging.Level; -import org.eclipse.osee.ats.internal.Activator; -import org.eclipse.osee.framework.logging.OseeLog; - -/** - * @author Jeff C. Phillips - */ -public class ChangeComparerTest { - - public static void main(String[] args) { - String content = "<artId>12535</artId>"; - OseeLog.log( - Activator.class, - Level.SEVERE, - Integer.valueOf( - Integer.parseInt(content.substring(content.indexOf("<artId>") + 7, content.indexOf("</artId>")))).toString()); - } - -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/DataChangeReportComparer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/DataChangeReportComparer.java deleted file mode 100644 index ee14c9f1f7e..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/DataChangeReportComparer.java +++ /dev/null @@ -1,29 +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.health.change; - -/** - * @author Jeff C. Phillips - */ -public abstract class DataChangeReportComparer implements Comparable<Object> { - private final String content; - - public DataChangeReportComparer(String content) { - this.content = content; - processContent(content); - } - - public abstract void processContent(String content); - - public String getContent() { - return content; - } -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/RelationChangeReportComparer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/RelationChangeReportComparer.java deleted file mode 100644 index 8432dc96b5c..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/RelationChangeReportComparer.java +++ /dev/null @@ -1,47 +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.health.change; - -/** - * @author Jeff C. Phillips - */ -public class RelationChangeReportComparer extends DataChangeReportComparer { - private final static String REL_TAG_START_ID = "<relId>"; - private final static String REL_TAG_END_ID = "</relId>"; - private int relId; - - public RelationChangeReportComparer(String content) { - super(content); - } - - @Override - public void processContent(String content) { - relId = - Integer.parseInt(content.substring(content.indexOf(REL_TAG_START_ID) + REL_TAG_START_ID.length(), - content.indexOf(REL_TAG_END_ID))); - } - - @Override - public int compareTo(Object obj) { - int compareResults = -1; - if (obj instanceof RelationChangeReportComparer) { - RelationChangeReportComparer comparer = (RelationChangeReportComparer) obj; - - if (this.relId == comparer.relId) { - compareResults = 0; - } else if (this.relId > comparer.relId) { - compareResults = 1; - } - } - return compareResults; - } - -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ValidateChangeReportParser.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ValidateChangeReportParser.java deleted file mode 100644 index edcb4cb9160..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/change/ValidateChangeReportParser.java +++ /dev/null @@ -1,65 +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.health.change; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * @author Jeff C. Phillips - */ -public class ValidateChangeReportParser { - private static final String ART = "(<ArtChg>.*?</ArtChg>)"; - private static final String ATTR = "(<AttrChg>.*?</AttrChg>)"; - private static final String REL = "(<RelChg>.*?</RelChg>)"; - - /** - * @return Returns Three ArrayLists. 0 index for artifact changes, 1 index for attribute changes and 2 index for - * relation changes. - */ - public List<ArrayList<DataChangeReportComparer>> parse(String changeReportString) { - ArrayList<ArrayList<DataChangeReportComparer>> changeLists = - new ArrayList<ArrayList<DataChangeReportComparer>>(3); - ArrayList<DataChangeReportComparer> artifactChanges = new ArrayList<DataChangeReportComparer>(); - ArrayList<DataChangeReportComparer> attrChanges = new ArrayList<DataChangeReportComparer>(); - ArrayList<DataChangeReportComparer> relChanges = new ArrayList<DataChangeReportComparer>(); - - Matcher artChangeMatch = Pattern.compile(ART).matcher(changeReportString); - - while (artChangeMatch.find()) { - artifactChanges.add(new ArtifactChangeReportComparer(artChangeMatch.group(0))); - } - - Matcher attrChangeMatch = Pattern.compile(ATTR).matcher(changeReportString); - - while (attrChangeMatch.find()) { - attrChanges.add(new AttributeChangeReportComparer(attrChangeMatch.group(0))); - } - - Matcher relChangeMatch = Pattern.compile(REL).matcher(changeReportString); - - while (relChangeMatch.find()) { - relChanges.add(new RelationChangeReportComparer(relChangeMatch.group(0))); - } - Collections.sort(artifactChanges); - Collections.sort(attrChanges); - Collections.sort(relChanges); - - changeLists.add(artifactChanges); - changeLists.add(attrChanges); - changeLists.add(relChanges); - - return changeLists; - } -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java index 581570eb642..2c40b7d4728 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java @@ -32,8 +32,6 @@ import org.eclipse.osee.ats.core.util.AtsUtilCore; import org.eclipse.osee.ats.goal.CreateGoalTestArtifacts; import org.eclipse.osee.ats.goal.GoalSearchWorkflowSearchItem; import org.eclipse.osee.ats.health.ValidateAtsDatabase; -import org.eclipse.osee.ats.health.ValidateChangeReportByHrid; -import org.eclipse.osee.ats.health.ValidateChangeReports; import org.eclipse.osee.ats.internal.ATSPerspective; import org.eclipse.osee.ats.internal.Activator; import org.eclipse.osee.ats.navigate.EmailTeamsItem.MemberType; @@ -216,8 +214,6 @@ public final class AtsNavigateViewItems implements XNavigateViewItems, IXNavigat XNavigateItem healthItems = new XNavigateItemFolder(adminItems, "Health"); new ValidateAtsDatabase(healthItems); - new ValidateChangeReports(healthItems); - new ValidateChangeReportByHrid(healthItems); new ValidateWorkspaceToDatabaseWorkDefinitions(healthItems); // new ActionNavigateItem(adminItems, new XViewerViewAction()); |