From 6b34997337efe04ac671987a374937011c219c02 Mon Sep 17 00:00:00 2001
From: Michael Unterkalmsteiner
Date: Sat, 6 Oct 2018 18:48:37 +0200
Subject: [PATCH 01/10] Store deleted object names in commit comments
This allows us to show the names of deleted objects in the history
---
.../config/specmate-config.properties | 8 +--
.../specmate-model-ecore/model/specmate.ecore | 2 +
.../model/specmate.history | 20 +++++++
.../specmate/model/history/HistoryEntry.java | 17 ++++++
.../model/history/HistoryPackage.java | 34 ++++++++++-
.../model/history/impl/HistoryEntryImpl.java | 22 ++++++++
.../history/impl/HistoryPackageImpl.java | 15 ++++-
.../specmate/persistency/ITransaction.java | 3 +
.../cdo/internal/HistoryProviderImpl.java | 16 ++++--
.../cdo/internal/TransactionImpl.java | 56 ++++++++++++++++---
web/src/app/model/HistoryEntry.ts | 3 +-
.../simple-history-view.component.html | 12 ++++
12 files changed, 187 insertions(+), 21 deletions(-)
diff --git a/bundles/specmate-config/config/specmate-config.properties b/bundles/specmate-config/config/specmate-config.properties
index c7010d1b6..a9c3233cf 100644
--- a/bundles/specmate-config/config/specmate-config.properties
+++ b/bundles/specmate-config/config/specmate-config.properties
@@ -52,18 +52,18 @@ search.maxResults = 100
# Projects
## List of project names, each project listed here needs to be configured below
# test-data needn't be configured
-project.projects =
+project.projects =
## Config for project test-data
project.test-data.library = libfolder1, libfolder2, libfolder3
-project.test-data.library.libfolder1.name = Library folder 1
+project.test-data.library.libfolder1.name = Lib Folder 1
project.test-data.library.libfolder1.description = Templates for type 1 requirements
-project.test-data.library.libfolder2.name = Library folder 2
+project.test-data.library.libfolder2.name = Lib Folder 2
project.test-data.library.libfolder2.description = Templates for type 2 requirements
-project.test-data.library.libfolder3.name = Library folder 3
+project.test-data.library.libfolder3.name = Lib Folder 3
project.test-data.library.libfolder3.description = Templates for type 3 requirements
diff --git a/bundles/specmate-model-ecore/model/specmate.ecore b/bundles/specmate-model-ecore/model/specmate.ecore
index f4ae5bfdc..c80f5479e 100644
--- a/bundles/specmate-model-ecore/model/specmate.ecore
+++ b/bundles/specmate-model-ecore/model/specmate.ecore
@@ -214,6 +214,8 @@
+
diff --git a/bundles/specmate-model-ecore/model/specmate.history b/bundles/specmate-model-ecore/model/specmate.history
index a4da32c0b..16e0a49d4 100644
--- a/bundles/specmate-model-ecore/model/specmate.history
+++ b/bundles/specmate-model-ecore/model/specmate.history
@@ -2222,5 +2222,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryEntry.java b/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryEntry.java
index e78416c98..dbb2ff4f2 100644
--- a/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryEntry.java
+++ b/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryEntry.java
@@ -17,6 +17,7 @@
*
* - {@link com.specmate.model.history.HistoryEntry#getTimestamp Timestamp}
* - {@link com.specmate.model.history.HistoryEntry#getUser User}
+ * - {@link com.specmate.model.history.HistoryEntry#getDeletedObjects Deleted Objects}
* - {@link com.specmate.model.history.HistoryEntry#getComment Comment}
* - {@link com.specmate.model.history.HistoryEntry#getChanges Changes}
*
@@ -79,6 +80,22 @@ public interface HistoryEntry extends CDOObject {
*/
void setUser(String value);
+ /**
+ * Returns the value of the 'Deleted Objects' attribute list.
+ * The list contents are of type {@link java.lang.String}.
+ *
+ *
+ * If the meaning of the 'Deleted Objects' attribute list isn't clear,
+ * there really should be more of a description here...
+ *
+ *
+ * @return the value of the 'Deleted Objects' attribute list.
+ * @see com.specmate.model.history.HistoryPackage#getHistoryEntry_DeletedObjects()
+ * @model
+ * @generated
+ */
+ EList getDeletedObjects();
+
/**
* Returns the value of the 'Comment' attribute.
*
diff --git a/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryPackage.java b/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryPackage.java
index 04c806f41..a63038e5f 100644
--- a/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryPackage.java
+++ b/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryPackage.java
@@ -121,6 +121,15 @@ public interface HistoryPackage extends EPackage {
*/
int HISTORY_ENTRY__USER = 1;
+ /**
+ * The feature id for the 'Deleted Objects' attribute list.
+ *
+ *
+ * @generated
+ * @ordered
+ */
+ int HISTORY_ENTRY__DELETED_OBJECTS = 2;
+
/**
* The feature id for the 'Comment' attribute.
*
@@ -128,7 +137,7 @@ public interface HistoryPackage extends EPackage {
* @generated
* @ordered
*/
- int HISTORY_ENTRY__COMMENT = 2;
+ int HISTORY_ENTRY__COMMENT = 3;
/**
* The feature id for the 'Changes' containment reference list.
@@ -137,7 +146,7 @@ public interface HistoryPackage extends EPackage {
* @generated
* @ordered
*/
- int HISTORY_ENTRY__CHANGES = 3;
+ int HISTORY_ENTRY__CHANGES = 4;
/**
* The number of structural features of the 'Entry' class.
@@ -146,7 +155,7 @@ public interface HistoryPackage extends EPackage {
* @generated
* @ordered
*/
- int HISTORY_ENTRY_FEATURE_COUNT = 4;
+ int HISTORY_ENTRY_FEATURE_COUNT = 5;
/**
* The number of operations of the 'Entry' class.
@@ -275,6 +284,17 @@ public interface HistoryPackage extends EPackage {
*/
EAttribute getHistoryEntry_User();
+ /**
+ * Returns the meta object for the attribute list '{@link com.specmate.model.history.HistoryEntry#getDeletedObjects Deleted Objects}'.
+ *
+ *
+ * @return the meta object for the attribute list 'Deleted Objects'.
+ * @see com.specmate.model.history.HistoryEntry#getDeletedObjects()
+ * @see #getHistoryEntry()
+ * @generated
+ */
+ EAttribute getHistoryEntry_DeletedObjects();
+
/**
* Returns the meta object for the attribute '{@link com.specmate.model.history.HistoryEntry#getComment Comment}'.
*
@@ -418,6 +438,14 @@ interface Literals {
*/
EAttribute HISTORY_ENTRY__USER = eINSTANCE.getHistoryEntry_User();
+ /**
+ * The meta object literal for the 'Deleted Objects' attribute list feature.
+ *
+ *
+ * @generated
+ */
+ EAttribute HISTORY_ENTRY__DELETED_OBJECTS = eINSTANCE.getHistoryEntry_DeletedObjects();
+
/**
* The meta object literal for the 'Comment' attribute feature.
*
diff --git a/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryEntryImpl.java b/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryEntryImpl.java
index 011a58df4..76e9de6e8 100644
--- a/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryEntryImpl.java
+++ b/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryEntryImpl.java
@@ -28,6 +28,7 @@
*
* - {@link com.specmate.model.history.impl.HistoryEntryImpl#getTimestamp Timestamp}
* - {@link com.specmate.model.history.impl.HistoryEntryImpl#getUser User}
+ * - {@link com.specmate.model.history.impl.HistoryEntryImpl#getDeletedObjects Deleted Objects}
* - {@link com.specmate.model.history.impl.HistoryEntryImpl#getComment Comment}
* - {@link com.specmate.model.history.impl.HistoryEntryImpl#getChanges Changes}
*
@@ -130,6 +131,16 @@ public void setUser(String newUser) {
eDynamicSet(HistoryPackage.HISTORY_ENTRY__USER, HistoryPackage.Literals.HISTORY_ENTRY__USER, newUser);
}
+ /**
+ *
+ *
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ public EList getDeletedObjects() {
+ return (EList)eDynamicGet(HistoryPackage.HISTORY_ENTRY__DELETED_OBJECTS, HistoryPackage.Literals.HISTORY_ENTRY__DELETED_OBJECTS, true, true);
+ }
+
/**
*
*
@@ -184,6 +195,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) {
return getTimestamp();
case HistoryPackage.HISTORY_ENTRY__USER:
return getUser();
+ case HistoryPackage.HISTORY_ENTRY__DELETED_OBJECTS:
+ return getDeletedObjects();
case HistoryPackage.HISTORY_ENTRY__COMMENT:
return getComment();
case HistoryPackage.HISTORY_ENTRY__CHANGES:
@@ -207,6 +220,10 @@ public void eSet(int featureID, Object newValue) {
case HistoryPackage.HISTORY_ENTRY__USER:
setUser((String)newValue);
return;
+ case HistoryPackage.HISTORY_ENTRY__DELETED_OBJECTS:
+ getDeletedObjects().clear();
+ getDeletedObjects().addAll((Collection extends String>)newValue);
+ return;
case HistoryPackage.HISTORY_ENTRY__COMMENT:
setComment((String)newValue);
return;
@@ -232,6 +249,9 @@ public void eUnset(int featureID) {
case HistoryPackage.HISTORY_ENTRY__USER:
setUser(USER_EDEFAULT);
return;
+ case HistoryPackage.HISTORY_ENTRY__DELETED_OBJECTS:
+ getDeletedObjects().clear();
+ return;
case HistoryPackage.HISTORY_ENTRY__COMMENT:
setComment(COMMENT_EDEFAULT);
return;
@@ -254,6 +274,8 @@ public boolean eIsSet(int featureID) {
return getTimestamp() != TIMESTAMP_EDEFAULT;
case HistoryPackage.HISTORY_ENTRY__USER:
return USER_EDEFAULT == null ? getUser() != null : !USER_EDEFAULT.equals(getUser());
+ case HistoryPackage.HISTORY_ENTRY__DELETED_OBJECTS:
+ return !getDeletedObjects().isEmpty();
case HistoryPackage.HISTORY_ENTRY__COMMENT:
return COMMENT_EDEFAULT == null ? getComment() != null : !COMMENT_EDEFAULT.equals(getComment());
case HistoryPackage.HISTORY_ENTRY__CHANGES:
diff --git a/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryPackageImpl.java b/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryPackageImpl.java
index c215c65c2..d58f74196 100644
--- a/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryPackageImpl.java
+++ b/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryPackageImpl.java
@@ -196,17 +196,26 @@ public EAttribute getHistoryEntry_User() {
*
* @generated
*/
- public EAttribute getHistoryEntry_Comment() {
+ public EAttribute getHistoryEntry_DeletedObjects() {
return (EAttribute)historyEntryEClass.getEStructuralFeatures().get(2);
}
+ /**
+ *
+ *
+ * @generated
+ */
+ public EAttribute getHistoryEntry_Comment() {
+ return (EAttribute)historyEntryEClass.getEStructuralFeatures().get(3);
+ }
+
/**
*
*
* @generated
*/
public EReference getHistoryEntry_Changes() {
- return (EReference)historyEntryEClass.getEStructuralFeatures().get(3);
+ return (EReference)historyEntryEClass.getEStructuralFeatures().get(4);
}
/**
@@ -288,6 +297,7 @@ public void createPackageContents() {
historyEntryEClass = createEClass(HISTORY_ENTRY);
createEAttribute(historyEntryEClass, HISTORY_ENTRY__TIMESTAMP);
createEAttribute(historyEntryEClass, HISTORY_ENTRY__USER);
+ createEAttribute(historyEntryEClass, HISTORY_ENTRY__DELETED_OBJECTS);
createEAttribute(historyEntryEClass, HISTORY_ENTRY__COMMENT);
createEReference(historyEntryEClass, HISTORY_ENTRY__CHANGES);
@@ -334,6 +344,7 @@ public void initializePackageContents() {
initEClass(historyEntryEClass, HistoryEntry.class, "HistoryEntry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getHistoryEntry_Timestamp(), ecorePackage.getELong(), "timestamp", null, 0, 1, HistoryEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getHistoryEntry_User(), ecorePackage.getEString(), "user", null, 0, 1, HistoryEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getHistoryEntry_DeletedObjects(), ecorePackage.getEString(), "deletedObjects", null, 0, -1, HistoryEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getHistoryEntry_Comment(), ecorePackage.getEString(), "comment", null, 0, 1, HistoryEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getHistoryEntry_Changes(), this.getChange(), null, "changes", null, 0, -1, HistoryEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
diff --git a/bundles/specmate-persistency-api/src/com/specmate/persistency/ITransaction.java b/bundles/specmate-persistency-api/src/com/specmate/persistency/ITransaction.java
index b5da06d77..710e9c570 100644
--- a/bundles/specmate-persistency-api/src/com/specmate/persistency/ITransaction.java
+++ b/bundles/specmate-persistency-api/src/com/specmate/persistency/ITransaction.java
@@ -10,6 +10,9 @@
*
*/
public interface ITransaction extends IView {
+ public static final String COMMENT_FIELD_SEPARATOR = ";";
+ public static final String COMMENT_DATA_SEPARATOR = ",";
+
/** Rolls back changes made in this transaction since the last commit */
public void rollback();
diff --git a/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/HistoryProviderImpl.java b/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/HistoryProviderImpl.java
index 61686a074..c35c821f4 100644
--- a/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/HistoryProviderImpl.java
+++ b/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/HistoryProviderImpl.java
@@ -23,6 +23,7 @@
import com.specmate.model.history.HistoryEntry;
import com.specmate.model.history.HistoryFactory;
import com.specmate.persistency.IHistoryProvider;
+import com.specmate.persistency.ITransaction;
import com.specmate.persistency.event.EChangeKind;
@Component(immediate = true)
@@ -106,17 +107,17 @@ private void fillHistoryEntry(CDOObject cdoObject, CDOCommitInfo cdoHistoryEleme
deltaProcessor.process();
historyEntry.getChanges().addAll(deltaProcessor.getChanges());
historyEntry.setTimestamp(cdoHistoryElement.getTimeStamp());
- extractUserInfo(cdoHistoryElement, historyEntry);
+ extractCommentInfo(cdoHistoryElement, historyEntry);
}
- private void extractUserInfo(CDOCommitInfo cdoHistoryElement, HistoryEntry historyEntry) {
+ private void extractCommentInfo(CDOCommitInfo cdoHistoryElement, HistoryEntry historyEntry) {
String comment = cdoHistoryElement.getComment();
if (comment == null || comment.length() == 0) {
return;
}
- String[] info = comment.split(";", 2);
+ String[] info = comment.split(ITransaction.COMMENT_FIELD_SEPARATOR);
if (info.length == 0) {
return;
}
@@ -124,7 +125,14 @@ private void extractUserInfo(CDOCommitInfo cdoHistoryElement, HistoryEntry histo
historyEntry.setUser(info[0]);
if (info.length == 2) {
- historyEntry.setComment(info[1]);
+ String[] deletedObjects = info[1].split(ITransaction.COMMENT_DATA_SEPARATOR);
+ for (int i = 0; i < deletedObjects.length; i++) {
+ historyEntry.getDeletedObjects().add(deletedObjects[i]);
+ }
+ }
+
+ if (info.length == 3) {
+ historyEntry.setComment(info[2]);
}
}
diff --git a/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/TransactionImpl.java b/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/TransactionImpl.java
index b76def204..7539a8ed3 100644
--- a/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/TransactionImpl.java
+++ b/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/TransactionImpl.java
@@ -3,6 +3,7 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
@@ -16,6 +17,9 @@
import com.specmate.administration.api.IStatusService;
import com.specmate.common.SpecmateException;
import com.specmate.common.SpecmateValidationException;
+import com.specmate.model.base.Folder;
+import com.specmate.model.base.INamed;
+import com.specmate.model.requirements.CEGModel;
import com.specmate.model.support.util.SpecmateEcoreUtil;
import com.specmate.persistency.IChange;
import com.specmate.persistency.IChangeListener;
@@ -28,7 +32,6 @@
*
*/
public class TransactionImpl extends ViewImpl implements ITransaction {
-
/* The CDO transaction */
private CDOTransaction transaction;
@@ -69,9 +72,10 @@ private void commit(T object) throws SpecmateException {
throw new SpecmateException("Attempt to commit when in read-only mode");
}
try {
+ List detachedObjects;
try {
notifyListeners();
- List detachedObjects = transaction.getChangeSetData().getDetachedObjects();
+ detachedObjects = transaction.getChangeSetData().getDetachedObjects();
for (CDOIDAndVersion id : detachedObjects) {
SpecmateEcoreUtil.unsetAllReferences(transaction.getObject(id.getID()));
}
@@ -79,7 +83,7 @@ private void commit(T object) throws SpecmateException {
transaction.rollback();
throw (new SpecmateException("Error while preparing commit, transaction rolled back", s));
}
- extractAndSetMetadata(object);
+ setMetadata(object, detachedObjects);
transaction.commit();
} catch (CommitException e) {
transaction.rollback();
@@ -123,13 +127,51 @@ public boolean isDirty() {
return transaction.isDirty();
}
- private void extractAndSetMetadata(T object) {
+ private void setMetadata(T object, List detachedObjects) {
+ StringBuilder comment = new StringBuilder();
+
+ String userName = extractUserName(object);
+ if (userName != null) {
+ comment.append(userName);
+ comment.append(extractDeletedObjects(detachedObjects));
+ }
+
+ transaction.setCommitComment(comment.toString());
+ }
+
+ private String extractUserName(T object) {
+ String userName = null;
+
if (object instanceof RestResult>) {
- String userName = ((RestResult>) object).getUserName();
- if (userName != null) {
- transaction.setCommitComment(userName);
+ userName = ((RestResult>) object).getUserName();
+ }
+
+ return userName;
+ }
+
+ private String extractDeletedObjects(List detachedObjects) {
+ StringBuilder names = new StringBuilder();
+
+ if (detachedObjects.size() > 0) {
+ names.append(COMMENT_FIELD_SEPARATOR);
+ boolean addDataSeparator = false;
+ for (CDOIDAndVersion cdoidv : detachedObjects) {
+ CDOObject obj = transaction.getObject(cdoidv.getID());
+ if (obj instanceof Folder || obj instanceof CEGModel
+ || obj instanceof com.specmate.model.processes.Process) {
+
+ INamed named = (INamed) obj;
+ if (addDataSeparator) {
+ names.append(COMMENT_DATA_SEPARATOR);
+ }
+ names.append(named.getName());
+ addDataSeparator = true;
+ }
}
}
+
+ names.append(COMMENT_FIELD_SEPARATOR);
+ return names.toString();
}
private void notifyListeners() throws SpecmateException {
diff --git a/web/src/app/model/HistoryEntry.ts b/web/src/app/model/HistoryEntry.ts
index f1534da26..5a2850add 100644
--- a/web/src/app/model/HistoryEntry.ts
+++ b/web/src/app/model/HistoryEntry.ts
@@ -13,10 +13,11 @@
// Attributes
public timestamp: ELong;
public user: EString;
+ public deletedObjects: EString[];
public comment: EString;
// References
-
+
// Containment
public changes: Change[];
diff --git a/web/src/app/modules/views/side/modules/history-view/components/simple-history-view.component.html b/web/src/app/modules/views/side/modules/history-view/components/simple-history-view.component.html
index 9031b4488..dee26b674 100644
--- a/web/src/app/modules/views/side/modules/history-view/components/simple-history-view.component.html
+++ b/web/src/app/modules/views/side/modules/history-view/components/simple-history-view.component.html
@@ -6,6 +6,18 @@
+
+
diff --git a/bundles/specmate-model-ecore/model/specmate.history b/bundles/specmate-model-ecore/model/specmate.history
index 16e0a49d4..71f75715b 100644
--- a/bundles/specmate-model-ecore/model/specmate.history
+++ b/bundles/specmate-model-ecore/model/specmate.history
@@ -2242,5 +2242,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bundles/specmate-model-gen/src/com/specmate/model/history/Change.java b/bundles/specmate-model-gen/src/com/specmate/model/history/Change.java
index 6ff575549..c05585d2f 100644
--- a/bundles/specmate-model-gen/src/com/specmate/model/history/Change.java
+++ b/bundles/specmate-model-gen/src/com/specmate/model/history/Change.java
@@ -13,6 +13,8 @@
* The following features are supported:
*
*
+ * - {@link com.specmate.model.history.Change#getObjectName Object Name}
+ * - {@link com.specmate.model.history.Change#getOldValue Old Value}
* - {@link com.specmate.model.history.Change#getNewValue New Value}
* - {@link com.specmate.model.history.Change#getFeature Feature}
* - {@link com.specmate.model.history.Change#isIsCreate Is Create}
@@ -25,6 +27,58 @@
* @generated
*/
public interface Change extends CDOObject {
+ /**
+ * Returns the value of the 'Object Name' attribute.
+ *
+ *
+ * If the meaning of the 'Object Name' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ *
+ * @return the value of the 'Object Name' attribute.
+ * @see #setObjectName(String)
+ * @see com.specmate.model.history.HistoryPackage#getChange_ObjectName()
+ * @model
+ * @generated
+ */
+ String getObjectName();
+
+ /**
+ * Sets the value of the '{@link com.specmate.model.history.Change#getObjectName Object Name}' attribute.
+ *
+ *
+ * @param value the new value of the 'Object Name' attribute.
+ * @see #getObjectName()
+ * @generated
+ */
+ void setObjectName(String value);
+
+ /**
+ * Returns the value of the 'Old Value' attribute.
+ *
+ *
+ * If the meaning of the 'Old Value' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ *
+ * @return the value of the 'Old Value' attribute.
+ * @see #setOldValue(String)
+ * @see com.specmate.model.history.HistoryPackage#getChange_OldValue()
+ * @model
+ * @generated
+ */
+ String getOldValue();
+
+ /**
+ * Sets the value of the '{@link com.specmate.model.history.Change#getOldValue Old Value}' attribute.
+ *
+ *
+ * @param value the new value of the 'Old Value' attribute.
+ * @see #getOldValue()
+ * @generated
+ */
+ void setOldValue(String value);
+
/**
* Returns the value of the 'New Value' attribute.
*
diff --git a/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryPackage.java b/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryPackage.java
index a63038e5f..2cb6e61c8 100644
--- a/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryPackage.java
+++ b/bundles/specmate-model-gen/src/com/specmate/model/history/HistoryPackage.java
@@ -176,6 +176,24 @@ public interface HistoryPackage extends EPackage {
*/
int CHANGE = 2;
+ /**
+ * The feature id for the 'Object Name' attribute.
+ *
+ *
+ * @generated
+ * @ordered
+ */
+ int CHANGE__OBJECT_NAME = 0;
+
+ /**
+ * The feature id for the 'Old Value' attribute.
+ *
+ *
+ * @generated
+ * @ordered
+ */
+ int CHANGE__OLD_VALUE = 1;
+
/**
* The feature id for the 'New Value' attribute.
*
@@ -183,7 +201,7 @@ public interface HistoryPackage extends EPackage {
* @generated
* @ordered
*/
- int CHANGE__NEW_VALUE = 0;
+ int CHANGE__NEW_VALUE = 2;
/**
* The feature id for the 'Feature' attribute.
@@ -192,7 +210,7 @@ public interface HistoryPackage extends EPackage {
* @generated
* @ordered
*/
- int CHANGE__FEATURE = 1;
+ int CHANGE__FEATURE = 3;
/**
* The feature id for the 'Is Create' attribute.
@@ -201,7 +219,7 @@ public interface HistoryPackage extends EPackage {
* @generated
* @ordered
*/
- int CHANGE__IS_CREATE = 2;
+ int CHANGE__IS_CREATE = 4;
/**
* The feature id for the 'Is Delete' attribute.
@@ -210,7 +228,7 @@ public interface HistoryPackage extends EPackage {
* @generated
* @ordered
*/
- int CHANGE__IS_DELETE = 3;
+ int CHANGE__IS_DELETE = 5;
/**
* The number of structural features of the 'Change' class.
@@ -219,7 +237,7 @@ public interface HistoryPackage extends EPackage {
* @generated
* @ordered
*/
- int CHANGE_FEATURE_COUNT = 4;
+ int CHANGE_FEATURE_COUNT = 6;
/**
* The number of operations of the 'Change' class.
@@ -327,6 +345,28 @@ public interface HistoryPackage extends EPackage {
*/
EClass getChange();
+ /**
+ * Returns the meta object for the attribute '{@link com.specmate.model.history.Change#getObjectName Object Name}'.
+ *
+ *
+ * @return the meta object for the attribute 'Object Name'.
+ * @see com.specmate.model.history.Change#getObjectName()
+ * @see #getChange()
+ * @generated
+ */
+ EAttribute getChange_ObjectName();
+
+ /**
+ * Returns the meta object for the attribute '{@link com.specmate.model.history.Change#getOldValue Old Value}'.
+ *
+ *
+ * @return the meta object for the attribute 'Old Value'.
+ * @see com.specmate.model.history.Change#getOldValue()
+ * @see #getChange()
+ * @generated
+ */
+ EAttribute getChange_OldValue();
+
/**
* Returns the meta object for the attribute '{@link com.specmate.model.history.Change#getNewValue New Value}'.
*
@@ -472,6 +512,22 @@ interface Literals {
*/
EClass CHANGE = eINSTANCE.getChange();
+ /**
+ * The meta object literal for the 'Object Name' attribute feature.
+ *
+ *
+ * @generated
+ */
+ EAttribute CHANGE__OBJECT_NAME = eINSTANCE.getChange_ObjectName();
+
+ /**
+ * The meta object literal for the 'Old Value' attribute feature.
+ *
+ *
+ * @generated
+ */
+ EAttribute CHANGE__OLD_VALUE = eINSTANCE.getChange_OldValue();
+
/**
* The meta object literal for the 'New Value' attribute feature.
*
diff --git a/bundles/specmate-model-gen/src/com/specmate/model/history/impl/ChangeImpl.java b/bundles/specmate-model-gen/src/com/specmate/model/history/impl/ChangeImpl.java
index ffd30bfca..2317fe229 100644
--- a/bundles/specmate-model-gen/src/com/specmate/model/history/impl/ChangeImpl.java
+++ b/bundles/specmate-model-gen/src/com/specmate/model/history/impl/ChangeImpl.java
@@ -17,6 +17,8 @@
* The following features are implemented:
*
*
+ * - {@link com.specmate.model.history.impl.ChangeImpl#getObjectName Object Name}
+ * - {@link com.specmate.model.history.impl.ChangeImpl#getOldValue Old Value}
* - {@link com.specmate.model.history.impl.ChangeImpl#getNewValue New Value}
* - {@link com.specmate.model.history.impl.ChangeImpl#getFeature Feature}
* - {@link com.specmate.model.history.impl.ChangeImpl#isIsCreate Is Create}
@@ -26,6 +28,26 @@
* @generated
*/
public class ChangeImpl extends CDOObjectImpl implements Change {
+ /**
+ * The default value of the '{@link #getObjectName() Object Name}' attribute.
+ *
+ *
+ * @see #getObjectName()
+ * @generated
+ * @ordered
+ */
+ protected static final String OBJECT_NAME_EDEFAULT = null;
+
+ /**
+ * The default value of the '{@link #getOldValue() Old Value}' attribute.
+ *
+ *
+ * @see #getOldValue()
+ * @generated
+ * @ordered
+ */
+ protected static final String OLD_VALUE_EDEFAULT = null;
+
/**
* The default value of the '{@link #getNewValue() New Value}' attribute.
*
@@ -95,6 +117,42 @@ protected int eStaticFeatureCount() {
return 0;
}
+ /**
+ *
+ *
+ * @generated
+ */
+ public String getObjectName() {
+ return (String)eDynamicGet(HistoryPackage.CHANGE__OBJECT_NAME, HistoryPackage.Literals.CHANGE__OBJECT_NAME, true, true);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public void setObjectName(String newObjectName) {
+ eDynamicSet(HistoryPackage.CHANGE__OBJECT_NAME, HistoryPackage.Literals.CHANGE__OBJECT_NAME, newObjectName);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public String getOldValue() {
+ return (String)eDynamicGet(HistoryPackage.CHANGE__OLD_VALUE, HistoryPackage.Literals.CHANGE__OLD_VALUE, true, true);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public void setOldValue(String newOldValue) {
+ eDynamicSet(HistoryPackage.CHANGE__OLD_VALUE, HistoryPackage.Literals.CHANGE__OLD_VALUE, newOldValue);
+ }
+
/**
*
*
@@ -175,6 +233,10 @@ public void setIsDelete(boolean newIsDelete) {
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
+ case HistoryPackage.CHANGE__OBJECT_NAME:
+ return getObjectName();
+ case HistoryPackage.CHANGE__OLD_VALUE:
+ return getOldValue();
case HistoryPackage.CHANGE__NEW_VALUE:
return getNewValue();
case HistoryPackage.CHANGE__FEATURE:
@@ -195,6 +257,12 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) {
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
+ case HistoryPackage.CHANGE__OBJECT_NAME:
+ setObjectName((String)newValue);
+ return;
+ case HistoryPackage.CHANGE__OLD_VALUE:
+ setOldValue((String)newValue);
+ return;
case HistoryPackage.CHANGE__NEW_VALUE:
setNewValue((String)newValue);
return;
@@ -219,6 +287,12 @@ public void eSet(int featureID, Object newValue) {
@Override
public void eUnset(int featureID) {
switch (featureID) {
+ case HistoryPackage.CHANGE__OBJECT_NAME:
+ setObjectName(OBJECT_NAME_EDEFAULT);
+ return;
+ case HistoryPackage.CHANGE__OLD_VALUE:
+ setOldValue(OLD_VALUE_EDEFAULT);
+ return;
case HistoryPackage.CHANGE__NEW_VALUE:
setNewValue(NEW_VALUE_EDEFAULT);
return;
@@ -243,6 +317,10 @@ public void eUnset(int featureID) {
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
+ case HistoryPackage.CHANGE__OBJECT_NAME:
+ return OBJECT_NAME_EDEFAULT == null ? getObjectName() != null : !OBJECT_NAME_EDEFAULT.equals(getObjectName());
+ case HistoryPackage.CHANGE__OLD_VALUE:
+ return OLD_VALUE_EDEFAULT == null ? getOldValue() != null : !OLD_VALUE_EDEFAULT.equals(getOldValue());
case HistoryPackage.CHANGE__NEW_VALUE:
return NEW_VALUE_EDEFAULT == null ? getNewValue() != null : !NEW_VALUE_EDEFAULT.equals(getNewValue());
case HistoryPackage.CHANGE__FEATURE:
diff --git a/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryPackageImpl.java b/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryPackageImpl.java
index d58f74196..597d9e134 100644
--- a/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryPackageImpl.java
+++ b/bundles/specmate-model-gen/src/com/specmate/model/history/impl/HistoryPackageImpl.java
@@ -232,7 +232,7 @@ public EClass getChange() {
*
* @generated
*/
- public EAttribute getChange_NewValue() {
+ public EAttribute getChange_ObjectName() {
return (EAttribute)changeEClass.getEStructuralFeatures().get(0);
}
@@ -241,7 +241,7 @@ public EAttribute getChange_NewValue() {
*
* @generated
*/
- public EAttribute getChange_Feature() {
+ public EAttribute getChange_OldValue() {
return (EAttribute)changeEClass.getEStructuralFeatures().get(1);
}
@@ -250,7 +250,7 @@ public EAttribute getChange_Feature() {
*
* @generated
*/
- public EAttribute getChange_IsCreate() {
+ public EAttribute getChange_NewValue() {
return (EAttribute)changeEClass.getEStructuralFeatures().get(2);
}
@@ -259,10 +259,28 @@ public EAttribute getChange_IsCreate() {
*
* @generated
*/
- public EAttribute getChange_IsDelete() {
+ public EAttribute getChange_Feature() {
return (EAttribute)changeEClass.getEStructuralFeatures().get(3);
}
+ /**
+ *
+ *
+ * @generated
+ */
+ public EAttribute getChange_IsCreate() {
+ return (EAttribute)changeEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public EAttribute getChange_IsDelete() {
+ return (EAttribute)changeEClass.getEStructuralFeatures().get(5);
+ }
+
/**
*
*
@@ -302,6 +320,8 @@ public void createPackageContents() {
createEReference(historyEntryEClass, HISTORY_ENTRY__CHANGES);
changeEClass = createEClass(CHANGE);
+ createEAttribute(changeEClass, CHANGE__OBJECT_NAME);
+ createEAttribute(changeEClass, CHANGE__OLD_VALUE);
createEAttribute(changeEClass, CHANGE__NEW_VALUE);
createEAttribute(changeEClass, CHANGE__FEATURE);
createEAttribute(changeEClass, CHANGE__IS_CREATE);
@@ -349,6 +369,8 @@ public void initializePackageContents() {
initEReference(getHistoryEntry_Changes(), this.getChange(), null, "changes", null, 0, -1, HistoryEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(changeEClass, Change.class, "Change", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getChange_ObjectName(), ecorePackage.getEString(), "objectName", null, 0, 1, Change.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getChange_OldValue(), ecorePackage.getEString(), "oldValue", null, 0, 1, Change.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getChange_NewValue(), ecorePackage.getEString(), "newValue", null, 0, 1, Change.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getChange_Feature(), ecorePackage.getEString(), "feature", null, 0, 1, Change.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getChange_IsCreate(), ecorePackage.getEBoolean(), "isCreate", null, 0, 1, Change.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
diff --git a/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/HistoryProviderImpl.java b/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/HistoryProviderImpl.java
index c35c821f4..a6189bd89 100644
--- a/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/HistoryProviderImpl.java
+++ b/bundles/specmate-persistency-cdo/src/com/specmate/persistency/cdo/internal/HistoryProviderImpl.java
@@ -13,21 +13,28 @@
import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.log.LogService;
import com.specmate.common.SpecmateException;
+import com.specmate.model.base.BasePackage;
+import com.specmate.model.base.INamed;
import com.specmate.model.history.Change;
import com.specmate.model.history.History;
import com.specmate.model.history.HistoryEntry;
import com.specmate.model.history.HistoryFactory;
+import com.specmate.model.requirements.RequirementsPackage;
import com.specmate.persistency.IHistoryProvider;
+import com.specmate.persistency.IPersistencyService;
import com.specmate.persistency.ITransaction;
import com.specmate.persistency.event.EChangeKind;
@Component(immediate = true)
public class HistoryProviderImpl implements IHistoryProvider {
+ private IPersistencyService persistency;
+ private LogService logService;
@Override
public History getHistory(EObject object) throws SpecmateException {
@@ -95,9 +102,10 @@ private History processHistory(CDOObject cdoObject, History history) {
HistoryEntry historyEntry = HistoryFactory.eINSTANCE.createHistoryEntry();
fillHistoryEntry(cdoObject, cdoHistoryElement, historyEntry);
- if (!historyEntry.getChanges().isEmpty()) {
+ if (!historyEntry.getChanges().isEmpty() || !historyEntry.getDeletedObjects().isEmpty()) {
history.getEntries().add(historyEntry);
}
+
}
return history;
}
@@ -174,27 +182,23 @@ protected void changedObject(CDOID id, EStructuralFeature feature, EChangeKind c
return;
}
- Change change = HistoryFactory.eINSTANCE.createChange();
- change.setFeature(feature.getName());
+ if (showChange(feature, changeKind)) {
+ String objectName = getObjectName(id);
+ if (objectName != null) {
+ Change change = HistoryFactory.eINSTANCE.createChange();
- if (feature instanceof EReference) {
- EReference ref = (EReference) feature;
- if (ref.isContainment() && changeKind.equals(EChangeKind.REMOVE)) {
- change.setIsDelete(true);
- change.setNewValue(oldValue.toString());
- } else if (ref.isContainment() && changeKind.equals(EChangeKind.ADD)) {
- change.setIsCreate(true);
- change.setNewValue(newValue.toString());
- } else {
- return;
- }
- }
+ if (newValue != null) {
+ change.setNewValue(newValue.toString());
+ }
+ if (oldValue != null) {
+ change.setOldValue(oldValue.toString());
+ }
- if (newValue != null) {
- change.setNewValue(newValue.toString());
+ change.setFeature(feature.getName());
+ change.setObjectName(objectName);
+ changes.add(change);
+ }
}
-
- changes.add(change);
}
@Override
@@ -204,12 +208,14 @@ protected void newObject(CDOID id, String className, Map {
- // we just create a new change if we also have something to display, i.e. value
- if (v != null && v instanceof String) {
+ // For now, we are only interested in seeing the new objects' name in the
+ // history
+ if (k.getName().equals(BasePackage.Literals.INAMED__NAME.getName())) {
Change change = HistoryFactory.eINSTANCE.createChange();
change.setIsCreate(true);
change.setFeature(k.getName());
change.setNewValue((String) v);
+ change.setObjectName((String) v);
changes.add(change);
}
});
@@ -217,13 +223,46 @@ protected void newObject(CDOID id, String className, Map detachedObjects) {
boolean addDataSeparator = false;
for (CDOIDAndVersion cdoidv : detachedObjects) {
CDOObject obj = transaction.getObject(cdoidv.getID());
- if (obj instanceof Folder || obj instanceof CEGModel
- || obj instanceof com.specmate.model.processes.Process) {
-
+ if (obj instanceof ISpecmateModelObject || obj instanceof com.specmate.model.processes.Process) {
INamed named = (INamed) obj;
if (addDataSeparator) {
names.append(COMMENT_DATA_SEPARATOR);
diff --git a/web/src/app/model/Change.ts b/web/src/app/model/Change.ts
index 49ba28f46..f86fe98eb 100644
--- a/web/src/app/model/Change.ts
+++ b/web/src/app/model/Change.ts
@@ -10,6 +10,8 @@
public static className: string = "Change";
// Attributes
+ public objectName: EString;
+ public oldValue: EString;
public newValue: EString;
public feature: EString;
public isCreate: EBoolean;
diff --git a/web/src/app/modules/views/side/modules/history-view/components/simple-history-view.component.html b/web/src/app/modules/views/side/modules/history-view/components/simple-history-view.component.html
index dee26b674..ad7601241 100644
--- a/web/src/app/modules/views/side/modules/history-view/components/simple-history-view.component.html
+++ b/web/src/app/modules/views/side/modules/history-view/components/simple-history-view.component.html
@@ -13,8 +13,11 @@