Commit 12257ccb authored by marceteau's avatar marceteau
Browse files

retrait balise Comment + modifs mineures

parent 78786f3a
......@@ -96,7 +96,6 @@ import fr.cines.pac.aip.FichMetaType;
import fr.cines.pac.aip.PacType;
import fr.cines.pac.aip.StringNotNULLtext;
import fr.cines.pac.aip.StructureFichier;
import fr.cines.pac.aip.TraitementEnum;
import fr.cines.pac.converter.exception.DuplicateLanguageException;
import fr.cines.pac.ingest.util.exception.IngestRejectException;
import fr.cines.validator.ValidatorFactory;
......@@ -135,7 +134,6 @@ 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;
/**
......@@ -234,6 +232,7 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
private static final String APPRAISAL_RULE = "AppraisalRule_Rule";
private static final String DISSEMINATION_RULE = "DisseminationRule_Rule";
private static final String PREFIXE_ARK = "prefixeARK";
private static final String COMMENT = "Comment";
//Relation est un cas particulier pour la BSU
private static final String RELATION = "relation";
//Cas particulier pour certains SV
......@@ -417,6 +416,12 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
identifier.setValue(sip.getDocMeta().getIdentifiantVersement());
else identifier.setValue(this.rootFolder.getParent().getFileName().toString());
if((properties.getProperty(COMMENT) != null) && !properties.getProperty(COMMENT).equalsIgnoreCase("")) {
TextType textType = objectFactory.createTextType();
textType.setValue(properties.getProperty(COMMENT));
manifest.getComment().add(textType);
}
manifest.setMessageIdentifier(identifier);
CodeListVersionsType codeListVersion = objectFactory.createCodeListVersionsType();
......@@ -590,7 +595,9 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
// Version Tag Language
List<Locale> languages = sip.getDocDC().getLanguage();
for (Locale language : languages) {
content.getLanguage().add(language.getLanguage());
if((language.getLanguage() != null) && (language.getLanguage().length() > 0)) {
content.getLanguage().add(language.getLanguage());
}
}
List<StringNotNULLtext> subjects = sip.getDocDC().getSubject();
......@@ -953,7 +960,7 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
}
if(sip.getDate().equals("s.d.".trim()))
content.getAny().add(createDublinCoreMetadataNoPrefix(sip.getDate(), "dateLitteral"));
content.getAny().add(createDublinCoreMetadataNoPrefix(sip.getDate(), "DateLitteral"));
boolean generateCinesDcFormat = Boolean.parseBoolean(properties.getProperty(CINES_DC_FORMAT));
if (generateCinesDcFormat) {
......@@ -1391,13 +1398,29 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
FileInfoType fileInfo = objectFactory.createFileInfoType();
Path path = Paths.get(document.getNomFichier().trim());
String finalName;
if(!fileNameCounter.containsKey(path.getFileName().toString())) {
fileNameCounter.put(path.getFileName().toString(), new Integer(0));
String usedFileName = null;
if(path.getFileName().toString().trim().equalsIgnoreCase("aip.xml") || path.getFileName().toString().trim().equalsIgnoreCase("sip.xml")) {
usedFileName = path.getFileName().toString().trim();
} else if(path.getFileName().toString().contains(".")) {
String extensionFileName = path.getFileName().toString().split("\\.")[path.getFileName().toString().trim().split("\\.").length-1];
usedFileName = document.getEmpreinte().getValue() + "." + extensionFileName;
}
finalName = Integer.toString(fileNameCounter.get(path.getFileName().toString())) + "_" + path.getFileName();
Integer oldCounter = fileNameCounter.get(path.getFileName().toString());
fileNameCounter.replace(path.getFileName().toString(), oldCounter + 1) ;
// String usedFileName = path.getFileName().toString().trim();
//
// if(usedFileName.contains(" ")) {
// usedFileName = usedFileName.replace(' ', '_');
// }
if(!fileNameCounter.containsKey(usedFileName)) {
fileNameCounter.put(usedFileName, new Integer(0));
}
finalName = Integer.toString(fileNameCounter.get(usedFileName)) + "_" + usedFileName;
Integer oldCounter = fileNameCounter.get(usedFileName);
fileNameCounter.replace(usedFileName, oldCounter + 1) ;
fileInfo.setFilename(finalName);
......@@ -1933,12 +1956,13 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
// Si la langue n'est pas spécifiée on essaie de la détecter
if (element.getLanguage() == null) {
proposedLanguage = detectLanguage(element.getValue());
// proposedLanguage = detectLanguage(element.getValue());
proposedLanguage = null;
} else {
proposedLanguage = element.getLanguage().toString();
}
if(listLang.contains(proposedLanguage)) {
if(proposedLanguage != null && listLang.contains(proposedLanguage)) {
//on oublie l'attribut und prévu initialement
/*if(listLang.contains("und")) {
elemSeda21.setLang(proposedLanguage);
......@@ -1949,7 +1973,7 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
elemSeda21.setLang("und");
}*/
setErrorLanguage(true);
} else {
} else if(proposedLanguage != null) {
listLang.add(proposedLanguage);
elemSeda21.setLang(proposedLanguage);
}
......
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