package dk.statsbiblioteket.doms.ingesters.radiotv;

import dk.statsbiblioteket.util.xml.DOM;
import dk.statsbiblioteket.util.xml.XPathSelector;

/** Constants used while building document. */
public class Common {
    static final String COMMENT = "Ingest of Radio/TV data";
    static final String FAILED_COMMENT = COMMENT + ": Something failed, rolling back";
    static final int MAX_FAIL_COUNT = 10;

    static final String PBCORE_NAMESPACE = "http://www.pbcore.org/PBCore/PBCoreNamespace.html";
    static final String DC_NAMESPACE = "http://purl.org/dc/elements/1.1/";
    static final XPathSelector XPATH_SELECTOR = DOM
            .createXPathSelector("pbc", PBCORE_NAMESPACE,
                                 "dc", DC_NAMESPACE);
    static final String PBCORE_DESCRIPTION_ELEMENT
                    = "//program/pbcore/pbc:PBCoreDescriptionDocument";
    static final String DC_IDENTIFIER_ELEMENT = "//dc:identifier";
    static final String PBCORE_TITLE_ELEMENT = "//pbc:pbcoreTitle[pbc:titleType=\"titel\"]/pbc:title";
    static final String PBCORE_RITZAU_IDENTIFIER_ELEMENT
            = "pbc:pbcoreIdentifier[pbc:identifierSource=\"id\"]/pbc:identifier";
    static final String PBCORE_GALLUP_IDENTIFIER_ELEMENT
                    = "pbc:pbcoreIdentifier[pbc:identifierSource=\"tvmeter\"]/pbc:identifier";
    static final String RITZAU_ORIGINALS_ELEMENT = "//program/originals/ritzau_original";
    static final String GALLUP_ORIGINALS_ELEMENT = "//program/originals/gallup_original|//program/originals/tvmeterProgram";
    static final String PROGRAM_BROADCAST_ELEMENT = "//program/programBroadcast";
    static final String RECORDING_FILES_URLS = "//program/fileUrls/fileUrl";

    static final String PROGRAM_TEMPLATE_PID = "doms:Template_Program";
    static final String PROGRAM_PBCORE_DS_ID = "PBCORE";
    static final String RITZAU_ORIGINAL_DS_ID = "RITZAU_ORIGINAL";
    static final String GALLUP_ORIGINAL_DS_ID = "GALLUP_ORIGINAL";
    static final String PROGRAM_BROADCAST_DS_ID = "PROGRAM_BROADCAST";
    static final String DC_DS_ID = "DC";
    static final String HAS_FILE_RELATION_TYPE
            = "http://doms.statsbiblioteket.dk/relations/default/0/1/#hasFile";
}

@@ -570,16 +570,236 @@
 /1.1/%22;%0A
+    static final String RITZAU_NAMESPACE = %22http://doms.statsbiblioteket.dk/types/ritzau_original/0/1/#%22;%0A    private static final String GALLUP_NAMESPACE = %22http://doms.statsbiblioteket.dk/types/gallup_original/0/1/#%22;%0A
     stat
@@ -951,16 +951,138 @@
 AMESPACE
+,%0A                                 %22ritzau%22, RITZAU_NAMESPACE,%0A                                 %22gallup%22, GALLUP_NAMESPACE
 );%0A    s
@@ -1730,32 +1730,39 @@
 originals/ritzau
+:ritzau
 _original%22;%0A    
@@ -1827,32 +1827,39 @@
 originals/gallup
+:gallup
 _original%7C//prog
@@ -1872,16 +1872,23 @@
 iginals/
+gallup:
 tvmeterP

Use namespaced xpath queries