Skip to content

Commit

Permalink
Merge branch 'release/3.3.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-gomes committed Mar 5, 2018
2 parents 968a06c + 820f19a commit 9496a72
Show file tree
Hide file tree
Showing 36 changed files with 717 additions and 1,245 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ dependencies {
// Other dependencies we're unable to resolve via standard repositories

if (buildAccess == 'internal') {
preCompile group: 'gov.nasa.jpl.cae.magicdraw', name: 'cae-magicdraw-core', version: '3.3.2', ext: 'zip'
preCompile group: 'gov.nasa.jpl.cae.magicdraw', name: 'cae-magicdraw-core', version: '3.3.3', ext: 'zip'
}
else {
preCompile group: 'com.nomagic', name: 'magicdraw', version: '185sp3', classifier: 'MagicDraw_185_sp3_no_install', ext: 'zip'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.3.2
version=3.3.3
group=org.openmbee.magicdraw.mdk
descriptorFile=MDR_Plugin_Model_Development_Kit_91110_descriptor.xml
magicdDrawGroupName=gov.nasa.jpl.cae.magicdraw.mdk
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/gov/nasa/jpl/mbee/mdk/MMSSyncPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.nomagic.magicdraw.plugins.Plugin;
import gov.nasa.jpl.mbee.mdk.mms.sync.coordinated.CoordinatedSyncProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.delta.DeltaSyncProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.jms.JMSSyncProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalSyncProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.mms.MMSDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.status.SyncStatusProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.util.TaskRunner;

Expand All @@ -18,8 +18,8 @@
*/
public class MMSSyncPlugin extends Plugin {
private static MMSSyncPlugin instance;
private LocalSyncProjectEventListenerAdapter localSyncProjectEventListenerAdapter;
private JMSSyncProjectEventListenerAdapter jmsSyncProjectEventListenerAdapter;
private LocalDeltaProjectEventListenerAdapter localDeltaProjectEventListenerAdapter;
private MMSDeltaProjectEventListenerAdapter mmsDeltaProjectEventListenerAdapter;
private DeltaSyncProjectEventListenerAdapter deltaSyncProjectEventListenerAdapter;
private CoordinatedSyncProjectEventListenerAdapter coordinatedSyncProjectEventListenerAdapter;
private SyncStatusProjectEventListenerAdapter syncStatusProjectEventListenerAdapter;
Expand All @@ -31,12 +31,12 @@ public static MMSSyncPlugin getInstance() {
return instance;
}

public LocalSyncProjectEventListenerAdapter getLocalSyncProjectEventListenerAdapter() {
return localSyncProjectEventListenerAdapter;
public LocalDeltaProjectEventListenerAdapter getLocalDeltaProjectEventListenerAdapter() {
return localDeltaProjectEventListenerAdapter;
}

public JMSSyncProjectEventListenerAdapter getJmsSyncProjectEventListenerAdapter() {
return jmsSyncProjectEventListenerAdapter;
public MMSDeltaProjectEventListenerAdapter getMmsDeltaProjectEventListenerAdapter() {
return mmsDeltaProjectEventListenerAdapter;
}

public DeltaSyncProjectEventListenerAdapter getDeltaSyncProjectEventListenerAdapter() {
Expand All @@ -57,8 +57,8 @@ public void init() {
Application.getInstance().getProjectsManager().addProjectListener(coordinatedSyncProjectEventListenerAdapter = new CoordinatedSyncProjectEventListenerAdapter());
Application.getInstance().getProjectsManager().addProjectListener(deltaSyncProjectEventListenerAdapter = new DeltaSyncProjectEventListenerAdapter());
// Common and MMS clear their respective inMemoryChangelogs on save, so it needs to go after coordinated and delta which use it.
Application.getInstance().getProjectsManager().addProjectListener(localSyncProjectEventListenerAdapter = new LocalSyncProjectEventListenerAdapter());
Application.getInstance().getProjectsManager().addProjectListener(jmsSyncProjectEventListenerAdapter = new JMSSyncProjectEventListenerAdapter());
Application.getInstance().getProjectsManager().addProjectListener(localDeltaProjectEventListenerAdapter = new LocalDeltaProjectEventListenerAdapter());
Application.getInstance().getProjectsManager().addProjectListener(mmsDeltaProjectEventListenerAdapter = new MMSDeltaProjectEventListenerAdapter());
Application.getInstance().getProjectsManager().addProjectListener(syncStatusProjectEventListenerAdapter = new SyncStatusProjectEventListenerAdapter());

Application.getInstance().addSaveParticipant(coordinatedSyncProjectEventListenerAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
import com.nomagic.uml2.ext.magicdraw.components.mdbasiccomponents.Component;
import gov.nasa.jpl.mbee.mdk.api.incubating.convert.Converters;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalSyncProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalSyncTransactionCommitListener;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaTransactionCommitListener;
import gov.nasa.jpl.mbee.mdk.util.Utils;

import java.awt.event.ActionEvent;
Expand All @@ -35,7 +35,7 @@ public void actionPerformed(ActionEvent e) {
if (con == null || !con) {
return;
}
LocalSyncTransactionCommitListener listener = LocalSyncProjectEventListenerAdapter.getProjectMapping(Application.getInstance().getProject()).getLocalSyncTransactionCommitListener();
LocalDeltaTransactionCommitListener listener = LocalDeltaProjectEventListenerAdapter.getProjectMapping(Application.getInstance().getProject()).getLocalDeltaTransactionCommitListener();
if (listener != null) {
listener.setDisabled(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
import com.nomagic.uml2.ext.magicdraw.components.mdbasiccomponents.Component;
import gov.nasa.jpl.mbee.mdk.api.incubating.convert.Converters;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalSyncProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalSyncTransactionCommitListener;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaTransactionCommitListener;
import gov.nasa.jpl.mbee.mdk.util.Utils;

import java.awt.event.ActionEvent;
Expand All @@ -34,7 +34,7 @@ public void actionPerformed(ActionEvent e) {
if (con == null || !con) {
return;
}
LocalSyncTransactionCommitListener listener = LocalSyncProjectEventListenerAdapter.getProjectMapping(Application.getInstance().getProject()).getLocalSyncTransactionCommitListener();
LocalDeltaTransactionCommitListener listener = LocalDeltaProjectEventListenerAdapter.getProjectMapping(Application.getInstance().getProject()).getLocalDeltaTransactionCommitListener();
if (listener != null) {
listener.setDisabled(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private void importFromCsv(CSVReader reader) throws IOException {
PropertyEnum whatToChange = null;
BaseElement e = Converters.getIdToElementConverter()
.apply(props[c], project);
String value = props[c + 1];
String value = c + 1 < props.length ? props[c + 1] : "";
if (what != null && what.size() > row && what.get(row).size() > col) {
whatToChange = what.get(row).get(col);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/nasa/jpl/mbee/mdk/emf/EMFExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static String getEID(EObject eObject) {
return Converters.getIProjectToIdConverter().apply(project.getPrimaryProject()) + MDKConstants.PRIMARY_MODEL_ID_SUFFIX;
}

// local projects don't properly maintain the ids of some elements. this id spoofing mitigates that for us, but can mess up the jms sync counts in some cases (annoying, but ultimately harmless)
// local projects don't properly maintain the ids of some elements. this id spoofing mitigates that for us, but can mess up the MMS delta counts in some cases (annoying, but ultimately harmless)
// NOTE - this spoofing is replicated in LocalSyncTransactionListener in order to properly add / remove elements in the unsynched queue. any updates here should be replicated there as well.
if (element instanceof InstanceSpecification && ((InstanceSpecification) element).getStereotypedElement() != null) {
return getEID(((InstanceSpecification) element).getStereotypedElement()) + MDKConstants.APPLIED_STEREOTYPE_INSTANCE_ID_SUFFIX;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/gov/nasa/jpl/mbee/mdk/emf/EMFImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ else if (eStructuralFeature instanceof EReference) {
}
String id = jsonNode.asText();
Element referencedElement = getIdToElementConverter().apply(id, project);
System.out.println("[LOOKUP] " + id + " -> " + referencedElement);
if (referencedElement == null) {
if (strict) {
throw new ReferenceException(element, objectNode, "Could not find referenced element " + id + " in model for key \"" + key + "\" in JSON.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import gov.nasa.jpl.mbee.mdk.mms.MMSUtils;
import gov.nasa.jpl.mbee.mdk.mms.json.JsonEquivalencePredicate;
import gov.nasa.jpl.mbee.mdk.mms.json.JsonPatchFunction;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalSyncProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalSyncTransactionCommitListener;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaTransactionCommitListener;
import gov.nasa.jpl.mbee.mdk.mms.validation.ImageValidator;
import gov.nasa.jpl.mbee.mdk.model.DocBookOutputVisitor;
import gov.nasa.jpl.mbee.mdk.model.Document;
Expand Down Expand Up @@ -112,9 +112,6 @@ public void run(ProgressStatus progressStatus) {
Map<String, ViewMapping> viewMap = new LinkedHashMap<>();

for (Element rootView : rootViews) {
if (MDUtils.isDeveloperMode()) {
//Application.getInstance().getGUILog().log("Generating " + rootView.getHumanName() + " (" + rootView.getLocalID() + ").");
}
// STAGE 1: Calculating view structure
progressStatus.setDescription("Calculating view structure");
progressStatus.setCurrent(1);
Expand All @@ -136,11 +133,16 @@ public void run(ProgressStatus progressStatus) {
failure = true;
return;
}

DocBookOutputVisitor docBookOutputVisitor = new DocBookOutputVisitor(true);
dge.accept(docBookOutputVisitor);

SessionManager.getInstance().closeSession(project);
DocBookOutputVisitor docBookOutputVisitor;
try {
docBookOutputVisitor = new DocBookOutputVisitor(true);
dge.accept(docBookOutputVisitor);
}
finally {
if (SessionManager.getInstance().isSessionCreated(project)) {
SessionManager.getInstance().closeSession(project);
}
}

DBBook book = docBookOutputVisitor.getBook();
if (book == null) {
Expand Down Expand Up @@ -222,7 +224,7 @@ public void run(ProgressStatus progressStatus) {
return;
}

LocalSyncTransactionCommitListener localSyncTransactionCommitListener = LocalSyncProjectEventListenerAdapter.getProjectMapping(project).getLocalSyncTransactionCommitListener();
LocalDeltaTransactionCommitListener localDeltaTransactionCommitListener = LocalDeltaProjectEventListenerAdapter.getProjectMapping(project).getLocalDeltaTransactionCommitListener();
Set<Element> elementsToDelete = new HashSet<>();

// Create the session you intend to cancel to revert all temporary elements.
Expand All @@ -235,8 +237,8 @@ public void run(ProgressStatus progressStatus) {
failure = true;
return;
}
if (localSyncTransactionCommitListener != null) {
localSyncTransactionCommitListener.setDisabled(true);
if (localDeltaTransactionCommitListener != null) {
localDeltaTransactionCommitListener.setDisabled(true);
}

// Query existing server-side JSONs for views
Expand Down Expand Up @@ -761,8 +763,8 @@ public List<EStructuralFeatureOverride> getEStructuralFeatureOverrides() {
if (SessionManager.getInstance().isSessionCreated(project)) {
SessionManager.getInstance().cancelSession(project);
}
if (localSyncTransactionCommitListener != null) {
localSyncTransactionCommitListener.setDisabled(false);
if (localDeltaTransactionCommitListener != null) {
localDeltaTransactionCommitListener.setDisabled(false);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/gov/nasa/jpl/mbee/mdk/json/JacksonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ public static ObjectNode parseJsonObject(JsonParser jsonParser) throws IOExcepti
if (current != JsonToken.START_OBJECT) {
throw new IOException("Unable to build object from JSON parser.");
}
ObjectNode objectNode = getObjectMapper().readTree(jsonParser);
return objectNode;
return getObjectMapper().readTree(jsonParser);
}

public static ArrayNode parseJsonArray(JsonParser jsonParser, ArrayNode arrayNode) throws IOException {
Expand Down
Loading

0 comments on commit 9496a72

Please sign in to comment.