Commit 45aba5de authored by marceteau's avatar marceteau
Browse files

correctif dans le schema + divers

parent 794c59f8
......@@ -236,11 +236,11 @@
<directory>/etc/${unix.name}</directory>
<username>${unix.user}</username>
<groupname>${unix.group}</groupname>
<sources>
<source>
<location>${project.build.outputDirectory}/correspondances_properties.csv</location>
</source>
</sources>
<!-- <sources> -->
<!-- <source> -->
<!-- <location>${project.build.outputDirectory}/correspondances_properties.csv</location> -->
<!-- </source> -->
<!-- </sources> -->
</mapping>
<mapping>
<directory>/usr/bin</directory>
......
......@@ -61,6 +61,7 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.UnmarshalException;
import javax.xml.bind.Unmarshaller;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeConstants;
......@@ -138,6 +139,7 @@ import fr.gouv.culture.archivesdefrance.seda.v2.TextTechnicalMetadataType;
import fr.gouv.culture.archivesdefrance.seda.v2.TextType;
import fr.gouv.culture.archivesdefrance.seda.v2.UpdateOperationType;
import fr.gouv.culture.archivesdefrance.seda.v2.VideoTechnicalMetadataType;
import net.sf.saxon.functions.Substring;
/**
......@@ -341,25 +343,32 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
logger.error("L'archive Dublin Core ne contient pas bloc <Archive>");
}
JAXBContext contextSeda21 = JAXBContext.newInstance(ArchiveTransferType.class);
Marshaller marshaller = contextSeda21.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new DublincCoreNamespacePrefixMapper());
OutputStream os = new FileOutputStream(convertedManifest);
marshaller.marshal(manifest, os);
os.close();
try {
JAXBContext contextSeda21 = JAXBContext.newInstance(ArchiveTransferType.class);
Marshaller marshaller = contextSeda21.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new DublincCoreNamespacePrefixMapper());
OutputStream os = new FileOutputStream(convertedManifest);
marshaller.marshal(manifest, os);
os.close();
} catch (JAXBException e) {
e.printStackTrace();
}
}
catch (IOException e) {
e.printStackTrace();
} catch (JAXBException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (TransformerFactoryConfigurationError e) {
e.printStackTrace();
} catch (JAXBException e) {
if(e instanceof UnmarshalException) {
throw new IngestRejectException(rootFolder.toString(), "E0002");
}
System.out.println("Problème dans la deserialisation");
}
// On peuple avec les dataObjects, seul le chemin original est gardé
......@@ -1252,9 +1261,12 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
TextTechnicalMetadataType text = objectFactory.createTextTechnicalMetadataType();
for(StructureFichier sf : document.getStructureFichier()) {
String schemaValue;
if(sf.getValue().trim().startsWith("DESC/") || sf.getValue().trim().startsWith("DEPOT/DESC/")) {
String[] structureFichier = sf.getValue().split("/");
schemaValue = structureFichier[structureFichier.length-1];
if(sf.getValue().trim().startsWith("DESC/")) {
schemaValue = sf.getValue().trim().substring(5);
} else if ((sf.getValue().trim().startsWith("DEPOT/DESC/")) || (sf.getValue().trim().startsWith("DESC/DEPOT/")) ) {
schemaValue = sf.getValue().trim().substring(11);
} else if (sf.getValue().trim().startsWith("DEPOT/")) {
schemaValue = sf.getValue().trim().substring(6);
} else {
schemaValue = sf.getValue();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment