Skip to content
Snippets Groups Projects
Commit 02d3fb8d authored by Stephane Dervaux's avatar Stephane Dervaux
Browse files

Merge branch '0.9.5'

parents 9f9f092a e83e7b39
No related branches found
No related tags found
No related merge requests found
Pipeline #39297 passed
......@@ -6,7 +6,7 @@
<groupId>fr.inrae.po2engine</groupId>
<artifactId>PO2Engine</artifactId>
<version>0.9.4</version>
<version>0.9.5</version>
<packaging>jar</packaging>
<properties>
......
......@@ -92,13 +92,13 @@ public class Data extends OntoData{
projectFile = null;
}
public void addToListAllFile(String filePath) {
if(filePath != null) {
if(!listAllFile.contains(filePath)) {
listAllFile.add(new File(filePath));
}
}
}
// public void addToListAllFile(String filePath) {
// if(filePath != null) {
// if(!listAllFile.contains(filePath)) {
// listAllFile.add(new File(filePath));
// }
// }
// }
public String getLocalPath() {
return projectFile.getFilePath();
......
......@@ -19,6 +19,7 @@ import org.apache.logging.log4j.Logger;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
public class ItineraryFile extends GenericFile {
......@@ -40,6 +41,10 @@ public class ItineraryFile extends GenericFile {
this.nameProperty.bind(Bindings.concat(itiPart.getItiNumber(), " (",itiPart.getItiName(),")"));
}
public void removeLinkItinerary(Pair<Pair<ComplexField, ObjectProperty<StepFile>>, Pair<ComplexField, ObjectProperty<StepFile>>> link) {
this.itiPart.removeLinkItinerary(link);
}
public void addLinkItinerary(StepFile father, StepFile son) {
this.itiPart.addLinkItinerary(father, son);
}
......@@ -134,4 +139,18 @@ public class ItineraryFile extends GenericFile {
public Individual publish(OntClass classProcess, JSONObject json) {
return this.itiPart.publish(classProcess, json);
}
public void cloneFrom(ItineraryFile originalIti, Map<StepFile, StepFile> mappingStep) {
for (Pair<Pair<ComplexField, ObjectProperty<StepFile>>, Pair<ComplexField, ObjectProperty<StepFile>>> pair : originalIti.getItinerary()) {
StepFile oFather = pair.getKey().getValue().get();
StepFile oSon = pair.getValue().getValue().get();
StepFile cFather = mappingStep.get(oFather);
StepFile cSon = mappingStep.get(oSon);
this.addLinkItinerary(cFather, cSon);
}
}
public void clear() {
this.itiPart.clear();
}
}
......@@ -240,12 +240,9 @@ public class StepFile extends GenericFile {
lastCompo = new CompositionFile(this, input);
ConduiteFile cond = new ConduiteFile(lastCompo);
lastCompo.setConduiteFile(cond);
cond.initConduitePart();
getData().addToListAllFile(lastCompo.getFilePath());
getData().addToListAllFile(cond.getFilePath());
// getData().addToListAllFile(lastCompo.getFilePath());
// getData().addToListAllFile(lastCompo.getConduiteFile().getFilePath());
} else {
addCompositionFile(lastCompo, input);
}
......@@ -707,13 +704,10 @@ public class StepFile extends GenericFile {
CompositionFile newCompo = new CompositionFile(this, entry.getValue());
mappingCompo.put(entry.getKey(), newCompo);
ConduiteFile cond = new ConduiteFile(newCompo);
newCompo.setConduiteFile(cond);
newCompo.setCompositionID(entry.getKey().getCompositionID());
cond.initConduitePart();
newCompo.cloneFrom(entry.getKey());
this.getData().addToListAllFile(newCompo.getFilePath());
this.getData().addToListAllFile(cond.getFilePath());
// this.getData().addToListAllFile(newCompo.getFilePath());
// this.getData().addToListAllFile(newCompo.getConduiteFile().getFilePath());
}
}
......@@ -868,7 +862,7 @@ public class StepFile extends GenericFile {
String fileName = entry.getKey().replaceAll("obs\\|", "");
ObservationFile newFile = new ObservationFile(fileName,this);
this.getData().addToListAllFile(newFile.getFilePath());
// this.getData().addToListAllFile(newFile.getFilePath());
File tempFile = File.createTempFile("blalbla", "xlsx", null);
FileUtils.copyInputStreamToFile(new ByteArrayInputStream(bytes), tempFile);
if(!newFile.constructDataFromImport(tempFile)) {
......@@ -941,7 +935,7 @@ public class StepFile extends GenericFile {
} else {
String fileName = entry.getKey().replaceAll("obs\\|", "");
ObservationFile newFile = new ObservationFile(fileName, this);
this.getData().addToListAllFile(newFile.getFilePath());
// this.getData().addToListAllFile(newFile.getFilePath());
File tempFile = File.createTempFile("blalbla", "xlsx", null);
FileUtils.copyInputStreamToFile(new ByteArrayInputStream(bytes), tempFile);
......
......@@ -425,18 +425,6 @@ public class GeneralItineraryPart extends GenericPart {
return false;
}
public void cloneFrom(GeneralItineraryPart originalIti, Map<StepFile, StepFile> mappingStep) {
for (Pair<Pair<ComplexField, ObjectProperty<StepFile>>, Pair<ComplexField, ObjectProperty<StepFile>>> pair : originalIti.getItinerary()) {
StepFile oFather = pair.getKey().getValue().get();
StepFile oSon = pair.getValue().getValue().get();
StepFile cFather = mappingStep.get(oFather);
StepFile cSon = mappingStep.get(oSon);
this.addLinkItinerary(cFather, cSon);
// this.generateStepDataNode(cFather);
// this.generateStepDataNode(cSon);
}
}
public void addObservation(ObservationFile newFile) {
this.listObservation.add(newFile);
this.data.setModified(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment