Merge branch 'dev'

miguelnunes miguelnunes 2014-06-30

added src/main/java/net/timbusproject/iermtoowl/utils/EPCReader.java
added src/main/java/net/timbusproject/iermtoowl/epc/Elements.java
added src/main/java/net/timbusproject/iermtoowl/epc/EPCModel.java
added src/main/java/net/timbusproject/iermtoowl/epc/Connections.java
added Readme.md
changed src/main/java/net/timbusproject/iermtoowl/utils/OntologyMapper.java
changed src/main/java/net/timbusproject/iermtoowl/Main.java
changed catalog-v001.xml
copied src/main/java/net/timbusproject/iermtoowl/utils/UnifiedRiskReader.java -> src/main/java/net/timbusproject/iermtoowl/utils/RiskReader.java
copied src/main/java/net/timbusproject/iermtoowl/BusinessActivity.java -> src/main/java/net/timbusproject/iermtoowl/risks/BusinessActivity.java
copied src/main/java/net/timbusproject/iermtoowl/BusinessProcess.java -> src/main/java/net/timbusproject/iermtoowl/risks/BusinessProcess.java
copied src/main/java/net/timbusproject/iermtoowl/Resource.java -> src/main/java/net/timbusproject/iermtoowl/risks/Resource.java
copied src/main/java/net/timbusproject/iermtoowl/Risk.java -> src/main/java/net/timbusproject/iermtoowl/risks/Risk.java
src/main/java/net/timbusproject/iermtoowl/utils/EPCReader.java Diff Switch to side-by-side view
Loading...
src/main/java/net/timbusproject/iermtoowl/epc/Elements.java Diff Switch to side-by-side view
Loading...
src/main/java/net/timbusproject/iermtoowl/epc/EPCModel.java Diff Switch to side-by-side view
Loading...
src/main/java/net/timbusproject/iermtoowl/epc/Connections.java Diff Switch to side-by-side view
Loading...
Readme.md Diff Switch to side-by-side view
Loading...
src/main/java/net/timbusproject/iermtoowl/utils/OntologyMapper.java Diff Switch to side-by-side view
Loading...
src/main/java/net/timbusproject/iermtoowl/Main.java Diff Switch to side-by-side view
Loading...
catalog-v001.xml Diff Switch to side-by-side view
Loading...
src/main/java/net/timbusproject/iermtoowl/utils/UnifiedRiskReader.java to src/main/java/net/timbusproject/iermtoowl/utils/RiskReader.java
--- a/src/main/java/net/timbusproject/iermtoowl/utils/UnifiedRiskReader.java
+++ b/src/main/java/net/timbusproject/iermtoowl/utils/RiskReader.java
@@ -1,9 +1,10 @@
 package net.timbusproject.iermtoowl.utils;
 
-import net.timbusproject.iermtoowl.BusinessActivity;
-import net.timbusproject.iermtoowl.BusinessProcess;
-import net.timbusproject.iermtoowl.Resource;
-import net.timbusproject.iermtoowl.Risk;
+import net.timbusproject.iermtoowl.Main;
+import net.timbusproject.iermtoowl.risks.BusinessActivity;
+import net.timbusproject.iermtoowl.risks.BusinessProcess;
+import net.timbusproject.iermtoowl.risks.Resource;
+import net.timbusproject.iermtoowl.risks.Risk;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -13,17 +14,17 @@
 /**
  * Created by miguel on 24-06-2014.
  */
-public class UnifiedRiskReader {
+public class RiskReader {
 
-    static BusinessProcess riskXml;
+    private BusinessProcess riskXml;
 
-    public UnifiedRiskReader() {
+    public RiskReader() {
     }
 
-    public void readFromFile(String path) {
+    public BusinessProcess readFromFile(String path) {
         try {
 
-            File file = fileHandler(path);
+            File file = Main.fileHandler(path);
             JAXBContext jaxbContext = JAXBContext.newInstance(BusinessProcess.class);
 
             Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
@@ -31,12 +32,13 @@
 
             relateResources();
 
-            System.out.println("Elements found:\nRisks: " + riskXml.getRisk().size() + "\nResources: " +
+            System.out.println("RISK XML - Elements found:\nRisks: " + riskXml.getRisk().size() + "\nResources: " +
             riskXml.getResource().size() + "\nBusiness Activities: " + riskXml.getBusinessActivity().size());
 
         } catch (JAXBException e) {
             e.printStackTrace();
         }
+        return riskXml;
     }
 
     private void relateResources() {
@@ -65,17 +67,8 @@
         }
     }
 
-    public static File fileHandler(String path) {
-        File file;
-        if (path.startsWith("/") || path.startsWith("~"))
-            file = new File(path);
-        else
-            file = new File(new File(System.getProperty("user.dir")), path);
-        return file;
-    }
-
     public static void main(String[] args) {
-        UnifiedRiskReader reader = new UnifiedRiskReader();
+        RiskReader reader = new RiskReader();
         reader.readFromFile("/home/miguel/Documentos/ierm-bpmn-owl-project/ierm-owl/risk-output-forDPES.xml");
     }
 }
src/main/java/net/timbusproject/iermtoowl/BusinessActivity.java to src/main/java/net/timbusproject/iermtoowl/risks/BusinessActivity.java
--- a/src/main/java/net/timbusproject/iermtoowl/BusinessActivity.java
+++ b/src/main/java/net/timbusproject/iermtoowl/risks/BusinessActivity.java
@@ -1,4 +1,4 @@
-package net.timbusproject.iermtoowl;
+package net.timbusproject.iermtoowl.risks;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -15,6 +15,7 @@
 
     private String id;
     private String name;
+    private String functionId;
     private List<String> requireResource;
 
     private ArrayList<Resource> requiredResourceInstance = new ArrayList<>();
@@ -44,6 +45,14 @@
         this.id = id;
     }
 
+    public String getFunctionId() {
+        return functionId;
+    }
+
+    public void setFunctionId(String functionId) {
+        this.functionId = functionId;
+    }
+
     public BusinessActivity(String id, String name) {
         this.id = id;
         this.name = name;
@@ -70,10 +79,7 @@
         return false;
     }
 
-    @Override
-    public String toString() {
-        return "id: " + id + ", name: " + name + ", requiredResources: " + requireResource;
-    }
+
 
     public ArrayList<Resource> getRequiredResourceInstance() {
         return requiredResourceInstance;
@@ -82,4 +88,8 @@
     public void setRequiredResourceInstance(ArrayList<Resource> requiredResourceInstance) {
         this.requiredResourceInstance = requiredResourceInstance;
     }
+    @Override
+    public String toString() {
+        return "id: " + id + ", name: " + name + ", requiredResources: " + requireResource;
+    }
 }
src/main/java/net/timbusproject/iermtoowl/BusinessProcess.java to src/main/java/net/timbusproject/iermtoowl/risks/BusinessProcess.java
--- a/src/main/java/net/timbusproject/iermtoowl/BusinessProcess.java
+++ b/src/main/java/net/timbusproject/iermtoowl/risks/BusinessProcess.java
@@ -1,10 +1,9 @@
-package net.timbusproject.iermtoowl;
+package net.timbusproject.iermtoowl.risks;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
-import java.util.ArrayList;
 import java.util.List;
 
 /**
src/main/java/net/timbusproject/iermtoowl/Resource.java to src/main/java/net/timbusproject/iermtoowl/risks/Resource.java
--- a/src/main/java/net/timbusproject/iermtoowl/Resource.java
+++ b/src/main/java/net/timbusproject/iermtoowl/risks/Resource.java
@@ -1,4 +1,4 @@
-package net.timbusproject.iermtoowl;
+package net.timbusproject.iermtoowl.risks;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
src/main/java/net/timbusproject/iermtoowl/Risk.java to src/main/java/net/timbusproject/iermtoowl/risks/Risk.java
--- a/src/main/java/net/timbusproject/iermtoowl/Risk.java
+++ b/src/main/java/net/timbusproject/iermtoowl/risks/Risk.java
@@ -1,4 +1,4 @@
-package net.timbusproject.iermtoowl;
+package net.timbusproject.iermtoowl.risks;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;