Skip to content

Commit

Permalink
Merge branch 'hotfix/3.3.6' into support/3.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-gomes committed Jun 6, 2018
2 parents b669dd2 + fb61f39 commit 8d14eae
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 67 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.5', ext: 'zip'
preCompile group: 'gov.nasa.jpl.cae.magicdraw', name: 'cae-magicdraw-core', version: '3.3.6', 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.5
version=3.3.6
group=org.openmbee.magicdraw.mdk
descriptorFile=MDR_Plugin_Model_Development_Kit_91110_descriptor.xml
magicdDrawGroupName=gov.nasa.jpl.cae.magicdraw.mdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ public class UpdateClientElementAction extends RuleViolationAction implements An
private ValidationRule editableValidationRule = new ValidationRule("Element Editability", "The element to be updated shall be editable.", ViolationSeverity.WARNING),
failedChangeValidationRule = new ValidationRule("Failed Change", "The element shall not fail to change.", ViolationSeverity.ERROR),
equivalentElementValidationRule = new ValidationRule("Element Equivalency", "The changed element shall be equivalent to the source element.", ViolationSeverity.WARNING),
successfulChangeValidationRule = new ValidationRule("Successful Change", "The element shall successfully change.", ViolationSeverity.INFO),
deletionOnSuccessValidationRule = new ValidationRule("Deletion on Success", "The element to be deleted shall only be deleted if all elements to be created/updated are successfully imported.", ViolationSeverity.WARNING);
successfulChangeValidationRule = new ValidationRule("Successful Change", "The element shall successfully change.", ViolationSeverity.INFO);
//deletionOnSuccessValidationRule = new ValidationRule("Deletion on Success", "The element to be deleted shall only be deleted if all elements to be created/updated are successfully imported.", ViolationSeverity.WARNING);

{
validationSuite.addValidationRule(editableValidationRule);
validationSuite.addValidationRule(failedChangeValidationRule);
validationSuite.addValidationRule(equivalentElementValidationRule);
validationSuite.addValidationRule(successfulChangeValidationRule);
validationSuite.addValidationRule(deletionOnSuccessValidationRule);
//validationSuite.addValidationRule(deletionOnSuccessValidationRule);
}

private Collection<ObjectNode> elementsToUpdate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.nomagic.magicdraw.core.ProjectUtilities;
import com.nomagic.magicdraw.esi.EsiUtils;
import com.nomagic.magicdraw.openapi.uml.SessionManager;
import com.nomagic.magicdraw.teamwork2.locks.ILockProjectService;
import com.nomagic.task.ProgressStatus;
import com.nomagic.task.RunnableWithProgress;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
Expand Down Expand Up @@ -104,22 +103,7 @@ public void run(ProgressStatus progressStatus) {

// UPDATE LOCKS

ILockProjectService lockService = EsiUtils.getLockService(project);
if (lockService == null) {
Application.getInstance().getGUILog().log("[ERROR] Teamwork Cloud lock service is unavailable. Skipping sync. All changes will be re-attempted in the next sync.");
return;
}

listener.setDisabled(true);
try {
lockService.updateLocks(progressStatus);
} catch (RuntimeException e) {
Application.getInstance().getGUILog().log("[ERROR] Failed to update locks from Teamwork Cloud. Skipping sync. All changes will be persisted in the model and re-attempted in the next sync. Reason: " + e.getMessage());
e.printStackTrace();
return;
} finally {
listener.setDisabled(false);
}

// UPDATE MMS CHANGELOG

Expand Down Expand Up @@ -279,27 +263,13 @@ else if (shouldUpdate && mmsChange != null) {
Application.getInstance().getGUILog().log("[INFO] Attempted to update element " + id + " locally, but it does not exist. Skipping.");
continue;
}
if (!element.isEditable() && lockService.isLocked(element) && !lockService.isLockedByMe(element)) {
if (MDUtils.isDeveloperMode()) {
Application.getInstance().getGUILog().log("[INFO] Attempted to update element " + id + " locally, but it is locked by someone else. Skipping.");
}
failedMmsChangelog.addChange(id, null, Changelog.ChangeType.UPDATED);
continue;
}
mmsElementsToUpdateLocally.put(id, new Pair<>(objectNode, element));
break;
case DELETED:
if (element == null) {
Application.getInstance().getGUILog().log("[INFO] Attempted to delete element " + id + " locally, but it doesn't exist. Skipping.");
continue;
}
if (!element.isEditable() && lockService.isLocked(element) && !lockService.isLockedByMe(element)) {
if (MDUtils.isDeveloperMode()) {
Application.getInstance().getGUILog().log("[INFO] Attempted to delete element " + id + " locally, but it is locked by someone else. Skipping.");
}
failedMmsChangelog.addChange(id, null, Changelog.ChangeType.DELETED);
continue;
}
mmsElementsToDeleteLocally.put(id, element);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import com.nomagic.magicdraw.commands.MacroCommand;
import com.nomagic.magicdraw.commands.RemoveCommandCreator;
import com.nomagic.magicdraw.core.Project;
import com.nomagic.magicdraw.core.ProjectUtilities;
import com.nomagic.magicdraw.esi.EsiUtils;
import com.nomagic.magicdraw.teamwork2.locks.ILockProjectService;
import com.nomagic.uml2.ext.jmi.helpers.ModelHelper;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.InstanceSpecification;
Expand All @@ -20,15 +17,12 @@
import gov.nasa.jpl.mbee.mdk.api.incubating.convert.Converters;
import gov.nasa.jpl.mbee.mdk.json.JacksonUtils;
import gov.nasa.jpl.mbee.mdk.util.Changelog;
import gov.nasa.jpl.mbee.mdk.util.MDUtils;

import java.io.IOException;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -160,30 +154,4 @@ public static Changelog<String, Void> buildChangelog(Changelog changelog, Object
}
return changelog;
}

public static List<Element> lockSyncFolder(Project project) {
if (!ProjectUtilities.isFromEsiServer(project.getPrimaryProject())) {
return Collections.emptyList();
}
String folderId = Converters.getIProjectToIdConverter().apply(project.getPrimaryProject()) + MDKConstants.SYNC_SYSML_ID_SUFFIX;
Element folder = Converters.getIdToElementConverter().apply(folderId, project);
if (folder == null) {
return Collections.emptyList();
}
ILockProjectService lockService = EsiUtils.getLockService(project);
if (lockService == null) {
return Collections.emptyList();
}
Collection<Element> ownedElements = folder.getOwnedElement();
List<Element> lockedElements = new ArrayList<>(ownedElements.size());
for (Element element : folder.getOwnedElement()) {
if (element instanceof com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class && !lockService.isLocked(element) && lockService.canBeLocked(element)) {
lockedElements.add(element);
}
}
if (!lockService.lockElements(lockedElements, false, null)) {
return Collections.emptyList();
}
return lockedElements;
}
}

0 comments on commit 8d14eae

Please sign in to comment.