Add ESFSafetyConceptsUtil to ESFSafetyConcepts profile plug-in.
Change-Id: Ifc774021f913621a4eb258bec11b9681f6bddd96
diff --git a/core/profile/org.polarsys.esf.core.profile.esfsafetyconcepts/META-INF/MANIFEST.MF b/core/profile/org.polarsys.esf.core.profile.esfsafetyconcepts/META-INF/MANIFEST.MF
index 1b2ec5a..968b14a 100644
--- a/core/profile/org.polarsys.esf.core.profile.esfsafetyconcepts/META-INF/MANIFEST.MF
+++ b/core/profile/org.polarsys.esf.core.profile.esfsafetyconcepts/META-INF/MANIFEST.MF
@@ -18,6 +18,7 @@
org.eclipse.emf.ecore.xmi;bundle-version="2.11.1";visibility:=reexport
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.polarsys.esf.core.profile.esfsafetyconcepts.set,
+ org.polarsys.esf.core.profile.esfsafetyconcepts.util,
org.polarsys.esf.esfsafetyconcepts,
org.polarsys.esf.esfsafetyconcepts.impl,
org.polarsys.esf.esfsafetyconcepts.sdysfuctions,
diff --git a/core/profile/org.polarsys.esf.core.profile.esfsafetyconcepts/src/main/java/org/polarsys/esf/core/profile/esfsafetyconcepts/util/ESFSafetyConceptsUtil.java b/core/profile/org.polarsys.esf.core.profile.esfsafetyconcepts/src/main/java/org/polarsys/esf/core/profile/esfsafetyconcepts/util/ESFSafetyConceptsUtil.java
new file mode 100644
index 0000000..70d6233
--- /dev/null
+++ b/core/profile/org.polarsys.esf.core.profile.esfsafetyconcepts/src/main/java/org/polarsys/esf/core/profile/esfsafetyconcepts/util/ESFSafetyConceptsUtil.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2016 ALL4TEC & CEA LIST.
+ * 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:
+ * ALL4TEC & CEA LIST - initial API and implementation
+ ******************************************************************************/
+package org.polarsys.esf.core.profile.esfsafetyconcepts.util;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.polarsys.esf.esfsafetyconcepts.impl.SSafetyArtifacts;
+
+/**
+ * The utility class for dealing with SafetyArtifacts package.
+ *
+ * @author $Author: ymunoz $
+ * @version $Revision: 168 $
+ */
+public final class ESFSafetyConceptsUtil {
+
+ /**
+ * Default constructor, private as it's a utility class.
+ */
+ private ESFSafetyConceptsUtil() {
+ // Nothing to do
+ }
+
+ /**
+ * Retrieve SafetyArtifacts package.
+ *
+ * @param pESFModel ESFModel root
+ * @return The SafetyArtifacts package
+ */
+ public static Package retrieveSafetyArtifactsPackage(final Model pESFModel) {
+ Package vSafetyArtifactsPackage = null;
+ Boolean vFound = false;
+ List<Package> vPackagesList = pESFModel.getNestedPackages();
+ Iterator<Package> vIterator = vPackagesList.iterator();
+
+ while (vFound == false && vIterator.hasNext()) {
+ Package vPackage = vIterator.next();
+ if (UMLUtil.getStereotypeApplication(vPackage, SSafetyArtifacts.class) != null) {
+ vFound = true;
+ vSafetyArtifactsPackage = vPackage;
+ }
+ }
+ return vSafetyArtifactsPackage;
+ }
+
+}