Beispiel #1
0
$conta_Document_id = count($Document_array);
// $ExtrinsicObject_array = $dom_ebXML->get_elements_by_tagname("ExtrinsicObject");
#### CICLO SU TUTTI I FILE ALLEGATI
for ($o = 0; $o < $conta_EO; $o++) {
    #### SINGOLO NODO ExtrinsicObject
    $ExtrinsicObject_node = $ExtrinsicObject_array[$o];
    #### RICAVO ATTRIBUTO id DI ExtrinsicObject
    $ExtrinsicObject_id_attr = $ExtrinsicObject_node->get_attribute('id');
    #### RICAVO ATTRIBUTO mymeType
    $ExtrinsicObject_mimeType_attr = $ExtrinsicObject_node->get_attribute('mimeType');
    #### RICAVO LA RELATIVA ESTENSIONE PER IL FILE
    $get_extension = "SELECT EXTENSION FROM MIMETYPE WHERE CODE = '{$ExtrinsicObject_mimeType_attr}'";
    $res = query_select2($get_extension, $connessione);
    $file_extension = $res[0][0];
    ##### COMPONGO IL NOME DEL FILE (nomefile.estensione)
    $file_name = idrandom() . "." . $file_extension;
    #######################################################################
    ########################Divido caso MTOM XOP#############################
    #######################################################################
    if ($MTOM == true) {
        $trovato_id = false;
        for ($s = 0; $s < $conta_Document_id && !$trovato_id; $s++) {
            $Document_node = $Document_array[$s];
            $Document_id_attr = $Document_node->get_attribute('id');
            if ($ExtrinsicObject_id_attr[$o] == $Document_id_attr[$s]) {
                $trovato_id = true;
                $Document_value_encoded64 = $Document_node->node_value();
                writeTimeFile($idfile . "--Repository: Allegato = {$Document_value_encoded64}");
                $allegato_STRING = base64_decode($Document_value_encoded64);
            }
        }
Beispiel #2
0
//OKKIO FONDAMENTALE!!!
// NAV
if ($NAV == "A") {
    $bound_mail = "--" . md5(time());
    $eol = "\r\n";
    $headers_mail = "From: " . $NAV_from . $eol;
    $headers_mail .= "Message-ID: <" . time() . "@" . $_SERVER['SERVER_NAME'] . ">" . $eol;
    $headers_mail .= "MIME-Version: 1.0" . $eol;
    $headers_mail .= "Content-Type: multipart/mixed; boundary=" . $bound_mail . $eol;
    $msg_mail = "--" . $bound_mail . $eol;
    $msg_mail .= "Content-Type: text/plain; charset=us-ascii" . $eol;
    $msg_mail .= "Instructions to the user as to the use of this e-mail message." . $eol;
    //$msg_mail .= print_r($DocumentEntryUniqueId_valid_array).$eol;
    $msg_mail .= "--" . $bound_mail . $eol;
    $msg_mail .= "Content-Type: application/xml; charset=UTF-8" . $eol;
    $msg_mail .= "Content-Disposition: attachment; filename=\"IHEXDSNAV-" . idrandom() . ".xml\"" . $eol;
    $msg_mail .= "<Signature Id=\"signatureID\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n<SignedInfo>\n<CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/>\n<SignatureMethod Algorithm=\"urn:ihe:iti:dsg:nosig\"/>\n<Reference URI=\"#IHEManifest\" Type=\"http://www.w3.org/2000/09/xmldsig#Manifest\">\n<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>\n<DigestValue>00</DigestValue>\n</Reference>\n</SignedInfo>\n<SignatureValue>base64SignatureValue</SignatureValue>\n<Object>\n<SignatureProperties>\n<SignatureProperty Id=\"recommendedRegistry\"\ntarget=\"signatureID\">http://" . $_SERVER['SERVER_NAME'] . $www_REG_path . "storedquery.php</SignatureProperty>\n<SignatureProperty Id=\"sendAcknowledgementTo\"\ntarget=\"signatureID\">" . $NAV_to . "</SignatureProperty>\n</SignatureProperties>\n<Manifest Id=\"IHEManifest\">";
    for ($index_doc = 0; $index_doc < count($DocumentEntryUniqueId_valid_array[3]); $index_doc++) {
        $msg_mail .= "<Reference URI=\"" . $DocumentEntryUniqueId_valid_array[3][$index_doc] . "\">\n<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>\n<DigestValue>base64DigestValue</DigestValue>\n<!--this is document " . $index_doc . ", read it first-->\n</Reference>";
    }
    $msg_mail .= "\n</Manifest>\n</Object>\n</Signature>" . $eol;
    $msg_mail .= "--" . $bound_mail . "--";
    mail($NAV_to, "Notification of Document Availability", $msg_mail, $headers_mail);
    if ($clean_cache != "O") {
        writeTmpFiles($msg_mail, $idfile . "-mail-" . $idfile);
    }
    writeTimeFile($idfile . "--Registry: Ho spedito i messaggi di NAV");
}
if ($ATNA_active == 'A') {
    require_once './lib/syslog.php';
    $syslog = new Syslog();
Beispiel #3
0
function fill_ExtrinsicObject_tables($dom, $connessione)
{
    #### LANGUAGECODE DI DEFAULT
    $lang = "it-it";
    ##### ARRAY DELL'ATTRIBUTO ID DI EXTRINSICOBJECT
    $ExtrinsicObject_id_array = array();
    $simbolic_ExtrinsicObject_id_array = array();
    ##### ARRAY DEGLI ATTRIBUTI DEL NODO EXTRINSICOBJECT
    $DB_array_extrinsicobject_attributes = array();
    ##### RADICE DEL DOCUMENTO ebXML
    $root_ebXML = $dom->document_element();
    ##### ARRAY DEI NODI EXTRINSICOBJECT
    $dom_ebXML_ExtrinsicObject_node_array = $root_ebXML->get_elements_by_tagname("ExtrinsicObject");
    ##### ARRAY DEI NODI ASSOCIATION
    $dom_ebXML_Association_node_array = $root_ebXML->get_elements_by_tagname("Association");
    if (!empty($dom_ebXML_ExtrinsicObject_node_array)) {
        #### CICLO SU OGNI DOCUMENTO RICEVUTO ####
        for ($index = 0; $index < count($dom_ebXML_ExtrinsicObject_node_array); $index++) {
            ##### NODO EXTRINSICOBJECT RELATIVO AL DOCUMENTO NUMERO $index
            $ExtrinsicObject_node = $dom_ebXML_ExtrinsicObject_node_array[$index];
            ############## RECUPERO TUTTI GLI ATTRIBUTI DEL NODO EXTRINSICOBJECT
            $value_ExtrinsicObject_id = "urn:uuid:" . idrandom();
            $simbolic_ExtrinsicObject_id = $ExtrinsicObject_node->get_attribute('id');
            $simbolic_ExtrinsicObject_id_array[] = $ExtrinsicObject_node->get_attribute('id');
            #############################################################
            ####NOTA BENE NEL CASO NON SIMBOLICO(VEDI SOLINFO)
            if (!isSimbolic($simbolic_ExtrinsicObject_id)) {
                $value_ExtrinsicObject_id = $simbolic_ExtrinsicObject_id;
            }
            #############################################################
            $ExtrinsicObject_id_array[$simbolic_ExtrinsicObject_id] = $value_ExtrinsicObject_id;
            $value_accessControlPolicy = $ExtrinsicObject_node->get_attribute('accessControlPolicy');
            if ($value_accessControlPolicy == '') {
                $value_accessControlPolicy = "NULL";
            }
            $value_objectType = $ExtrinsicObject_node->get_attribute('objectType');
            if ($value_objectType == '') {
                #### DEVO CERCARE NEL DB: INITIALIZE
                $query_for_objectType = "SELECT id FROM ClassificationNode WHERE ClassificationNode.code = 'XDSDocumentEntry'";
                $res = query_select2($query_for_objectType, $connessione);
                writeSQLQuery($res . ": " . $query_for_objectType);
                $value_objectType = $res[0][0];
            }
            $value_expiration = $ExtrinsicObject_node->get_attribute('expiration');
            if ($value_expiration == '') {
                $value_expiration = "CURRENT_TIMESTAMP";
            }
            $value_majorVersion = $ExtrinsicObject_node->get_attribute('majorVersion');
            if ($value_majorVersion == '') {
                $value_majorVersion = "0";
            }
            $value_minorVersion = $ExtrinsicObject_node->get_attribute('minorVersion');
            if ($value_minorVersion == '') {
                $value_minorVersion = "1";
            }
            $value_stability = $ExtrinsicObject_node->get_attribute('stability');
            if ($value_stability == '') {
                $value_stability = "NULL";
            }
            $value_status = $ExtrinsicObject_node->get_attribute('status');
            #### DEAULT
            //$value_status = "Approved";###QUI LA SUBMISSION VA A BUON FINE
            $value_status = "NotCompleted";
            ### VERIFICO CASO DI REPLACEMENT
            for ($t = 0; $t < count($dom_ebXML_Association_node_array); $t++) {
                $dom_ebXML_Association_node = $dom_ebXML_Association_node_array[$t];
                #### ATTRIBUTO associationType
                $Association_node_associationType_attr = $dom_ebXML_Association_node->get_attribute('associationType');
                /*if($Association_node_associationType_attr=='RPLC' || $Association_node_associationType_attr=='XFRM_RPLC')
                		{
                			$value_status = "Approved";
                		}
                		else if($Association_node_associationType_attr=='XFRM')
                		{
                			$value_status = "Approved";
                		}
                		else if($Association_node_associationType_attr=='APND')
                		{
                			$value_status = "Approved";
                		}
                		else continue;	*/
            }
            //END OF for($t=0;$t<count($dom_ebXML_Association_node_array);$t++)
            $value_userVersion = $ExtrinsicObject_node->get_attribute('userVersion');
            if ($value_userVersion == '') {
                $value_userVersion = "NULL";
            }
            $value_isOpaque = $ExtrinsicObject_node->get_attribute('isOpaque');
            if ($value_isOpaque == '') {
                $value_isOpaque = "0";
            }
            $value_mimeType = $ExtrinsicObject_node->get_attribute('mimeType');
            if ($value_mimeType == '') {
                $value_mimeType = "text/xml";
            }
            $DB_array_extrinsicobject_attributes['id'] = $value_ExtrinsicObject_id;
            $DB_array_extrinsicobject_attributes['accessControlPolicy'] = $value_accessControlPolicy;
            $DB_array_extrinsicobject_attributes['objectType'] = $value_objectType;
            $DB_array_extrinsicobject_attributes['expiration'] = $value_expiration;
            $DB_array_extrinsicobject_attributes['majorVersion'] = $value_majorVersion;
            $DB_array_extrinsicobject_attributes['minorVersion'] = $value_minorVersion;
            $DB_array_extrinsicobject_attributes['stability'] = $value_stability;
            $DB_array_extrinsicobject_attributes['status'] = $value_status;
            $DB_array_extrinsicobject_attributes['userVersion'] = $value_userVersion;
            $DB_array_extrinsicobject_attributes['isOpaque'] = $value_isOpaque;
            $DB_array_extrinsicobject_attributes['mimeType'] = $value_mimeType;
            ####### QUI ORA POSSO RIEMPIRE IL DB
            $INSERT_INTO_ExtrinsicObject = "INSERT INTO ExtrinsicObject \n(id,accessControlPolicy,objectType,expiration,majorVersion,minorVersion,stability,status,userVersion,isOpaque,mimeType) \nVALUES \n('" . trim($DB_array_extrinsicobject_attributes['id']) . "','" . trim($DB_array_extrinsicobject_attributes['accessControlPolicy']) . "','" . trim($DB_array_extrinsicobject_attributes['objectType']) . "'," . trim($DB_array_extrinsicobject_attributes['expiration']) . ",'" . trim($DB_array_extrinsicobject_attributes['majorVersion']) . "','" . trim($DB_array_extrinsicobject_attributes['minorVersion']) . "','" . trim($DB_array_extrinsicobject_attributes['stability']) . "','" . trim($DB_array_extrinsicobject_attributes['status']) . "','" . trim($DB_array_extrinsicobject_attributes['userVersion']) . "','" . trim($DB_array_extrinsicobject_attributes['isOpaque']) . "','" . trim($DB_array_extrinsicobject_attributes['mimeType']) . "')";
            $ris = query_exec2($INSERT_INTO_ExtrinsicObject, $connessione);
            writeSQLQuery($ris . ": " . $INSERT_INTO_ExtrinsicObject);
            ############## FINE RECUPERO TUTTI GLI ATTRIBUTI DEL NODO EXTRINSICOBJECT
            #### ARRAY DEI FIGLI DEL NODO EXTRINSICOBJECT ##############
            $ExtrinsicObject_child_nodes = $ExtrinsicObject_node->child_nodes();
            ########################################################################
            ######### PROCESSO TUTTI I NODI FIGLI DI EXTRINSICOBJECT
            ### PARENT
            $value_parent = $value_ExtrinsicObject_id;
            #### LANGUAGECODE DI DEFAULT
            $lang = "it-it";
            for ($k = 0; $k < count($ExtrinsicObject_child_nodes); $k++) {
                #### SINGOLO NODO FIGLIO DI EXTRINSICOBJECT
                $ExtrinsicObject_child_node = $ExtrinsicObject_child_nodes[$k];
                #### NOME DEL NODO
                $ExtrinsicObject_child_node_tagname = $ExtrinsicObject_child_node->node_name();
                #### NODO SLOT
                if ($ExtrinsicObject_child_node_tagname == 'Slot') {
                    $slot_node = $ExtrinsicObject_child_node;
                    $DB_array_slot_attributes = array();
                    $value_name = $slot_node->get_attribute('name');
                    if ($value_name == '') {
                        $value_name = "NOT DECLARED";
                    }
                    $value_slotType = $slot_node->get_attribute('slotType');
                    if ($value_slotType == '') {
                        $value_slotType = "NULL";
                    }
                    $DB_array_slot_attributes['name'] = $value_name;
                    $DB_array_slot_attributes['slotType'] = $value_slotType;
                    $DB_array_slot_attributes['value'] = '';
                    $DB_array_slot_attributes['parent'] = $value_parent;
                    #### NODI FIGLI DI SLOT
                    $slot_child_nodes = $slot_node->child_nodes();
                    for ($q = 0; $q < count($slot_child_nodes); $q++) {
                        $slot_child_node = $slot_child_nodes[$q];
                        $slot_child_node_tagname = $slot_child_node->node_name();
                        if ($slot_child_node_tagname == 'ValueList') {
                            $valuelist_node = $slot_child_node;
                            $valuelist_child_nodes = $valuelist_node->child_nodes();
                            for ($r = 0; $r < count($valuelist_child_nodes); $r++) {
                                $value_node = $valuelist_child_nodes[$r];
                                $value_node_tagname = $value_node->node_name();
                                if ($value_node_tagname == 'Value') {
                                    $value_value = $value_node->get_content();
                                    $DB_array_slot_attributes['value'] = $value_value;
                                    #### LANGUAGE CODE
                                    if (strtoupper($value_name) == "LANGUAGECODE") {
                                        ### LANG
                                        $lang = $value_value;
                                        $update_Name_lang = "UPDATE Name SET Name.lang = '{$lang}' WHERE Name.parent = '{$value_ExtrinsicObject_id}'";
                                        $update_Description_lang = "UPDATE Description SET Description.lang = '{$lang}' WHERE Description.parent = '{$value_ExtrinsicObject_id}'";
                                        $rs = query_exec2($update_Name_lang, $connessione);
                                        $rs = query_exec2($update_Description_lang, $connessione);
                                    }
                                    //SALVO LA LINGUA
                                    ##### SONO PRONTO A SCRIVERE NEL DB
                                    $INSERT_INTO_Slot = "INSERT INTO Slot (name,slotType,value,parent) VALUES ('" . trim($DB_array_slot_attributes['name']) . "','" . trim($DB_array_slot_attributes['slotType']) . "','" . trim(adjustString($DB_array_slot_attributes['value'])) . "','" . trim($DB_array_slot_attributes['parent']) . "')";
                                    if (trim($DB_array_slot_attributes['name']) == 'sourcePatientInfo' && substr_count(trim(adjustString($DB_array_slot_attributes['value'])), 'PID-5') > 0) {
                                        $atna_patient_value = trim(adjustString($DB_array_slot_attributes['value']));
                                    }
                                    $ris = query_exec2($INSERT_INTO_Slot, $connessione);
                                    writeSQLQuery($ris . ": " . $INSERT_INTO_Slot);
                                }
                            }
                        }
                    }
                } else {
                    if ($ExtrinsicObject_child_node_tagname == 'Name') {
                        $name_node = $ExtrinsicObject_child_node;
                        $DB_array_name = array();
                        $LocalizedString_nodes = $name_node->child_nodes();
                        for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                            $LocalizedString_node = $LocalizedString_nodes[$p];
                            //->node_name();
                            $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                            if ($LocalizedString_node_tagname == 'LocalizedString') {
                                $LocalizedString_charset = $LocalizedString_node->get_attribute('charset');
                                if ($LocalizedString_charset == '') {
                                    $LocalizedString_charset = "UTF-8";
                                }
                                $LocalizedString_lang = $LocalizedString_node->get_attribute('lang');
                                if ($LocalizedString_lang == '') {
                                    $LocalizedString_lang = $lang;
                                }
                                $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                                if ($LocalizedString_value == '') {
                                    $LocalizedString_value = "NOT DECLARED";
                                }
                                $DB_array_name['charset'] = $LocalizedString_charset;
                                $DB_array_name['lang'] = $LocalizedString_lang;
                                $DB_array_name['value'] = $LocalizedString_value;
                            }
                            //END OF if($LocalizedString_node_tagname == 'LocalizedString')
                        }
                        //END OF for($p = 0;$p < count($val_list_node);$p++)
                        //$value_parent = $id;//ExtrinsicObject
                        $DB_array_name['parent'] = $value_parent;
                        //print_r($DB_array_name);
                        ##### SONO PRONTO A SCRIVERE NEL DB
                        $INSERT_INTO_Name = "INSERT INTO Name (charset,lang,value,parent) VALUES ('" . trim($DB_array_name['charset']) . "','" . trim($DB_array_name['lang']) . "','" . trim(adjustString($DB_array_name['value'])) . "','" . trim($DB_array_name['parent']) . "')";
                        $ris = query_exec2($INSERT_INTO_Name, $connessione);
                        writeSQLQuery($ris . ": " . $INSERT_INTO_Name);
                    } else {
                        if ($ExtrinsicObject_child_node_tagname == 'Description') {
                            $description_node = $ExtrinsicObject_child_node;
                            $DB_array_description = array();
                            $LocalizedString_nodes = $description_node->child_nodes();
                            if (count($LocalizedString_nodes) != 0) {
                                //print_r($LocalizedString_nodes);
                                for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                                    $LocalizedString_node = $LocalizedString_nodes[$p];
                                    $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                                    if ($LocalizedString_node_tagname == 'LocalizedString') {
                                        $LocalizedString_charset = $LocalizedString_node->get_attribute('charset');
                                        if ($LocalizedString_charset == '') {
                                            $LocalizedString_charset = "UTF-8";
                                        }
                                        $LocalizedString_lang = $LocalizedString_node->get_attribute('lang');
                                        if ($LocalizedString_lang == '') {
                                            $LocalizedString_lang = $lang;
                                        }
                                        $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                                        if ($LocalizedString_value == '') {
                                            $LocalizedString_value = "NOT DECLARED";
                                        }
                                        $DB_array_description['charset'] = $LocalizedString_charset;
                                        $DB_array_description['lang'] = $LocalizedString_lang;
                                        $DB_array_description['value'] = $LocalizedString_value;
                                    }
                                    //END OF if($LocalizedString_node_tagname == 'LocalizedString')
                                }
                                //END OF for($p = 0;$p < count($val_list_node);$p++)
                                //$value_parent = $id;//ExtrinsicObject
                                $DB_array_description['parent'] = $value_parent;
                            } else {
                                $DB_array_description['charset'] = "UTF-8";
                                $DB_array_description['lang'] = "it-it";
                                $DB_array_description['value'] = "NOT DECLARED";
                                $DB_array_description['parent'] = $value_parent;
                            }
                            ##### SONO PRONTO A SCRIVERE NEL DB
                            $INSERT_INTO_Description = "INSERT INTO Description (charset,lang,value,parent) VALUES ('" . trim($DB_array_description['charset']) . "','" . trim($DB_array_description['lang']) . "','" . trim(adjustString($DB_array_description['value'])) . "','" . trim($DB_array_description['parent']) . "')";
                            $ris = query_exec2($INSERT_INTO_Description, $connessione);
                            writeSQLQuery($ris . ": " . $INSERT_INTO_Description);
                        } else {
                            if ($ExtrinsicObject_child_node_tagname == 'Classification') {
                                $classification_node = $ExtrinsicObject_child_node;
                                $DB_array_classification_attributes = array();
                                $value_id = $classification_node->get_attribute('id');
                                if ($value_id == '' || isSimbolic($value_id)) {
                                    $value_id = "urn:uuid:" . idrandom();
                                }
                                $value_classifiedObject = $value_ExtrinsicObject_id;
                                $value_accessControlPolicy = $classification_node->get_attribute('accessControlPolicy');
                                if ($value_accessControlPolicy == '') {
                                    $value_accessControlPolicy = "NULL";
                                }
                                $value_objectType = $classification_node->get_attribute('objectType');
                                if ($value_objectType == '' || $value_objectType == 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification') {
                                    $value_objectType = "Classification";
                                }
                                // 			$value_classificationScheme= $classification_node->get_attribute('classificationScheme');
                                // 			if($value_classificationScheme == '')
                                // 			{
                                // 				$value_classificationScheme = "NOT DECLARED";
                                // 			}
                                // 			$value_classificationNode= $classification_node->get_attribute('classificationNode');
                                // 			if($value_classificationNode == '')
                                // 			{
                                // 				$value_classificationNode = "NOT DECLARED";
                                // 			}
                                $value_classificationNode = $classification_node->get_attribute('classificationNode');
                                $value_classificationScheme = $classification_node->get_attribute('classificationScheme');
                                if ($value_classificationNode == '') {
                                    $queryForName_value = "SELECT Name_value FROM ClassificationScheme WHERE ClassificationScheme.id = '{$value_classificationScheme}'";
                                    $risName_value = query_select2($queryForName_value, $connessione);
                                    writeSQLQuery($risName_value . ": " . $queryForName_value);
                                    $name_value = $risName_value[0][0];
                                    $name_value = substr($name_value, 0, strpos($name_value, '.'));
                                    $queryForClassificationNode = "SELECT id FROM ClassificationNode WHERE ClassificationNode.code = '{$name_value}'";
                                    $ris_code = query_select2($queryForClassificationNode, $connessione);
                                    writeSQLQuery($ris_code . ": " . $queryForClassificationNode);
                                    $value_classificationNode = $ris_code[0][0];
                                }
                                if ($value_classificationScheme == '') {
                                    $queryForClassificationNode = "SELECT code FROM ClassificationNode WHERE ClassificationNode.id = '{$value_classificationNode}'";
                                    $ris_classificationNode = query_select2($queryForClassificationNode, $connessione);
                                    writeSQLQuery($ris_classificationNode . ": " . $queryForClassificationNode);
                                    $code_classificationNode = $ris_classificationNode[0][0];
                                    #### FOLDER
                                    if ($code_classificationNode == "XDSFolder") {
                                        $queryForClassificationScheme = "SELECT id FROM ClassificationScheme WHERE ClassificationScheme.Name_value = 'XDSFolder.codeList'";
                                        $ris_ClassificationScheme = query_select2($queryForClassificationScheme, $connessione);
                                        writeSQLQuery($ris_ClassificationScheme . ": " . $queryForClassificationScheme);
                                        $value_classificationScheme = $ris_ClassificationScheme[0][0];
                                    } else {
                                        if ($code_classificationNode == "XDSSubmissionSet") {
                                            $queryForClassificationScheme = "SELECT id FROM ClassificationScheme WHERE ClassificationScheme.Name_value = 'XDSSubmissionSet.contentTypeCode'";
                                            $ris_ClassificationScheme = query_select2($queryForClassificationScheme, $connessione);
                                            writeSQLQuery($ris_ClassificationScheme . ": " . $queryForClassificationScheme);
                                            $value_classificationScheme = $ris_ClassificationScheme[0][0];
                                        }
                                    }
                                    //END OF if($code_classificationNode=="XDSSubmissionSet")
                                }
                                //END OF if($value_classificationScheme == '')
                                $value_nodeRepresentation = $classification_node->get_attribute('nodeRepresentation');
                                /*if($value_nodeRepresentation == '')
                                		{
                                			$value_nodeRepresentation = "NULL";
                                			//$value_nodeRepresentation = "default";
                                		}*/
                                $DB_array_classification_attributes['classificationScheme'] = $value_classificationScheme;
                                $DB_array_classification_attributes['accessControlPolicy'] = $value_accessControlPolicy;
                                $DB_array_classification_attributes['id'] = $value_id;
                                $DB_array_classification_attributes['objectType'] = $value_objectType;
                                $DB_array_classification_attributes['classifiedObject'] = $value_classifiedObject;
                                $DB_array_classification_attributes['classificationNode'] = $value_classificationNode;
                                $DB_array_classification_attributes['nodeRepresentation'] = $value_nodeRepresentation;
                                //print_r($DB_array_classification_attributes);
                                ##### SONO PRONTO A SCRIVERE NEL DB
                                $INSERT_INTO_Classification = "INSERT INTO Classification (id,accessControlPolicy,objectType,classificationNode,classificationScheme,classifiedObject,nodeRepresentation) VALUES ('" . trim($DB_array_classification_attributes['id']) . "','" . trim($DB_array_classification_attributes['accessControlPolicy']) . "','" . trim($DB_array_classification_attributes['objectType']) . "','" . trim($DB_array_classification_attributes['classificationNode']) . "','" . trim($DB_array_classification_attributes['classificationScheme']) . "','" . trim($DB_array_classification_attributes['classifiedObject']) . "','" . trim($DB_array_classification_attributes['nodeRepresentation']) . "')";
                                $ris = query_exec2($INSERT_INTO_Classification, $connessione);
                                writeSQLQuery($ris . ": " . $INSERT_INTO_Classification);
                                #### NODI FIGLI DI CLASSIFICATION
                                $classification_child_nodes = $classification_node->child_nodes();
                                for ($q = 0; $q < count($classification_child_nodes); $q++) {
                                    $classification_child_node = $classification_child_nodes[$q];
                                    $classification_child_node_tagname = $classification_child_node->node_name();
                                    if ($classification_child_node_tagname == 'Name') {
                                        $name_node = $classification_child_node;
                                        $DB_array_name = array();
                                        $LocalizedString_nodes = $name_node->child_nodes();
                                        //print_r($LocalizedString_nodes);
                                        for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                                            $LocalizedString_node = $LocalizedString_nodes[$p];
                                            //->node_name();
                                            $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                                            if ($LocalizedString_node_tagname == 'LocalizedString') {
                                                $LocalizedString_charset = $LocalizedString_node->get_attribute('charset');
                                                if ($LocalizedString_charset == '') {
                                                    $LocalizedString_charset = "UTF-8";
                                                }
                                                $LocalizedString_lang = $LocalizedString_node->get_attribute('lang');
                                                if ($LocalizedString_lang == '') {
                                                    $LocalizedString_lang = $lang;
                                                }
                                                $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                                                if ($LocalizedString_value == '') {
                                                    $LocalizedString_value = "NOT DECLARED";
                                                }
                                                $DB_array_name['charset'] = $LocalizedString_charset;
                                                $DB_array_name['lang'] = $LocalizedString_lang;
                                                $DB_array_name['value'] = $LocalizedString_value;
                                            }
                                            //END OF if($LocalizedString_node_tagname == 'LocalizedString')
                                        }
                                        //END OF for($p = 0;$p < count($val_list_node);$p++)
                                        //$value_parent = $id;//ExtrinsicObject
                                        $DB_array_name['parent'] = $value_id;
                                        //print_r($DB_array_name);
                                        ##### SONO PRONTO A SCRIVERE NEL DB
                                        $INSERT_INTO_Name = "INSERT INTO Name (charset,lang,value,parent) VALUES ('" . trim($DB_array_name['charset']) . "','" . trim($DB_array_name['lang']) . "','" . trim(adjustString($DB_array_name['value'])) . "','" . trim($DB_array_name['parent']) . "')";
                                        $ris = query_exec2($INSERT_INTO_Name, $connessione);
                                        writeSQLQuery($ris . ": " . $INSERT_INTO_Name);
                                    }
                                    //END OF if($classification_child_node_tagname=='Name')
                                }
                                //END of for child_nodes
                                //else
                                //{
                                //Slot di Classification
                                for ($sl = 0; $sl < count($classification_child_nodes); $sl++) {
                                    $classification_child_node = $classification_child_nodes[$sl];
                                    $classification_child_node_tagname = $classification_child_node->node_name();
                                    if ($classification_child_node_tagname == 'Slot') {
                                        $slot_node = $classification_child_node;
                                        $DB_array_slot_attributes = array();
                                        $value_name = $slot_node->get_attribute('name');
                                        if ($value_name == '') {
                                            $value_name = "NOT DECLARED";
                                        }
                                        $value_slotType = $slot_node->get_attribute('slotType');
                                        if ($value_slotType == '') {
                                            $value_slotType = "NULL";
                                        }
                                        $DB_array_slot_attributes['name'] = $value_name;
                                        $DB_array_slot_attributes['slotType'] = $value_slotType;
                                        $DB_array_slot_attributes['value'] = '';
                                        $DB_array_slot_attributes['parent'] = $value_id;
                                        $slot_child_nodes = $slot_node->child_nodes();
                                        for ($q = 0; $q < count($slot_child_nodes); $q++) {
                                            $slot_child_node = $slot_child_nodes[$q];
                                            $slot_child_node_tagname = $slot_child_node->node_name();
                                            if ($slot_child_node_tagname == 'ValueList') {
                                                $valuelist_node = $slot_child_node;
                                                $valuelist_child_nodes = $valuelist_node->child_nodes();
                                                for ($r = 0; $r < count($valuelist_child_nodes); $r++) {
                                                    $value_node = $valuelist_child_nodes[$r];
                                                    $value_node_tagname = $value_node->node_name();
                                                    if ($value_node_tagname == 'Value') {
                                                        $value_value = $value_node->get_content();
                                                        $DB_array_slot_attributes['value'] = $value_value;
                                                        ##### SONO PRONTO A SCRIVERE NEL DB
                                                        $INSERT_INTO_Slot = "INSERT INTO Slot (name,slotType,value,parent) VALUES ('" . trim($DB_array_slot_attributes['name']) . "','" . trim($DB_array_slot_attributes['slotType']) . "','" . trim(adjustString($DB_array_slot_attributes['value'])) . "','" . trim($DB_array_slot_attributes['parent']) . "')";
                                                        $ris = query_exec2($INSERT_INTO_Slot, $connessione);
                                                        writeSQLQuery($ris . ": " . $INSERT_INTO_Slot);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    //END OF if($classification_child_node_tagname=='Slot')
                                }
                                //Fine for per Slot
                                //}//Fine else per Slot
                            } else {
                                if ($ExtrinsicObject_child_node_tagname == 'ExternalIdentifier') {
                                    $externalidentifier_node = $ExtrinsicObject_child_node;
                                    $DB_array_externalidentifier_attributes = array();
                                    $value_accessControlPolicy = $externalidentifier_node->get_attribute('accessControlPolicy');
                                    if ($value_accessControlPolicy == '') {
                                        $value_accessControlPolicy = "NULL";
                                    }
                                    $value_id = $externalidentifier_node->get_attribute('id');
                                    if ($value_id == '' || isSimbolic($value_id)) {
                                        $value_id = "urn:uuid:" . idrandom();
                                    }
                                    $value_objectType = $externalidentifier_node->get_attribute('objectType');
                                    if ($value_objectType == '' || $value_objectType == 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier') {
                                        $value_objectType = "ExternalIdentifier";
                                    }
                                    $value_registryObject = $value_ExtrinsicObject_id;
                                    // 			$value_registryObject= $externalidentifier_node->get_attribute('registryObject');
                                    // 			if($value_registryObject == '')
                                    // 			{
                                    // 				$value_registryObject = "NOT DECLARED";
                                    // 			}
                                    $value_identificationScheme = $externalidentifier_node->get_attribute('identificationScheme');
                                    if ($value_identificationScheme == '') {
                                        $value_identificationScheme = "NOT DECLARED";
                                    }
                                    //$value_value= avoidHtmlEntitiesInterpretation($externalidentifier_node->get_attribute('value'));
                                    $value_value = $externalidentifier_node->get_attribute('value');
                                    if ($value_value == '') {
                                        $value_value = "NOT DECLARED";
                                    }
                                    $DB_array_externalidentifier_attributes['accessControlPolicy'] = $value_accessControlPolicy;
                                    $DB_array_externalidentifier_attributes['id'] = $value_id;
                                    $DB_array_externalidentifier_attributes['objectType'] = $value_objectType;
                                    $DB_array_externalidentifier_attributes['registryObject'] = $value_registryObject;
                                    $DB_array_externalidentifier_attributes['identificationScheme'] = $value_identificationScheme;
                                    $DB_array_externalidentifier_attributes['value'] = $value_value;
                                    //print_r($DB_array_externalidentifier_attributes);
                                    ##### SONO PRONTO A SCRIVERE NEL DB
                                    $INSERT_INTO_ExternalIdentifier = "INSERT INTO ExternalIdentifier (id,accessControlPolicy,objectType,registryObject,identificationScheme,value) VALUES ('" . trim($DB_array_externalidentifier_attributes['id']) . "','" . trim($DB_array_externalidentifier_attributes['accessControlPolicy']) . "','" . trim($DB_array_externalidentifier_attributes['objectType']) . "','" . trim($DB_array_externalidentifier_attributes['registryObject']) . "','" . trim($DB_array_externalidentifier_attributes['identificationScheme']) . "','" . trim(adjustString($DB_array_externalidentifier_attributes['value'])) . "')";
                                    $ris = query_exec2($INSERT_INTO_ExternalIdentifier, $connessione);
                                    writeSQLQuery($ris . ": " . $INSERT_INTO_ExternalIdentifier);
                                    #### NODI FIGLI DI EXTERNALIDENTIFIER
                                    $externalidentifier_child_nodes = $externalidentifier_node->child_nodes();
                                    //print_r($name_node);
                                    for ($q = 0; $q < count($externalidentifier_child_nodes); $q++) {
                                        $externalidentifier_child_node = $externalidentifier_child_nodes[$q];
                                        $externalidentifier_child_node_tagname = $externalidentifier_child_node->node_name();
                                        if ($externalidentifier_child_node_tagname == 'Name') {
                                            $name_node = $externalidentifier_child_node;
                                            $DB_array_name = array();
                                            $LocalizedString_nodes = $name_node->child_nodes();
                                            //print_r($LocalizedString_nodes);
                                            for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                                                $LocalizedString_node = $LocalizedString_nodes[$p];
                                                //->node_name();
                                                $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                                                if ($LocalizedString_node_tagname == 'LocalizedString') {
                                                    $LocalizedString_charset = $LocalizedString_node->get_attribute('charset');
                                                    if ($LocalizedString_charset == '') {
                                                        $LocalizedString_charset = "UTF-8";
                                                    }
                                                    $LocalizedString_lang = $LocalizedString_node->get_attribute('lang');
                                                    if ($LocalizedString_lang == '') {
                                                        $LocalizedString_lang = $lang;
                                                    }
                                                    $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                                                    if ($LocalizedString_value == '') {
                                                        $LocalizedString_value = "NOT DECLARED";
                                                    }
                                                    $DB_array_name['charset'] = $LocalizedString_charset;
                                                    $DB_array_name['lang'] = $LocalizedString_lang;
                                                    $DB_array_name['value'] = $LocalizedString_value;
                                                }
                                                //END OF if($LocalizedString_node_tagname == 'LocalizedString')
                                            }
                                            //END OF for($p = 0;$p < count($val_list_node);$p++)
                                            //$value_parent = $id;//ExtrinsicObject
                                            $DB_array_name['parent'] = $value_id;
                                        }
                                    }
                                    //print_r($DB_array_name);
                                    ##### SONO PRONTO A SCRIVERE NEL DB
                                    $INSERT_INTO_Name = "INSERT INTO Name (charset,lang,value,parent) VALUES ('" . trim($DB_array_name['charset']) . "','" . trim($DB_array_name['lang']) . "','" . trim(adjustString($DB_array_name['value'])) . "','" . trim($DB_array_name['parent']) . "')";
                                    $ris = query_exec2($INSERT_INTO_Name, $connessione);
                                    writeSQLQuery($ris . ": " . $INSERT_INTO_Name);
                                }
                            }
                        }
                    }
                }
                //END OF if($ExtrinsicObject_child_node_tagname=='ExternalIdentifier')
            }
            //END OF for($k=0;$k<count($ExtrinsicObject_child_nodes);$k++)
            ################# FINE PROCESSO TUTTI I NODI FIGLI DI EXTRINSICOBJECT
            ######## AGGIORNO IL CONTATORE
            $UPDATE_counters = "UPDATE Counters SET id = id + 1";
            $ris = query_exec2($UPDATE_counters, $connessione);
            writeSQLQuery($ris . ": " . $UPDATE_counters);
        }
        //END OF for($index=0;$index<(count($dom_ebXML_ExtrinsicObject_node_array));$index++)
    }
    ### COMPONGO L'ARRAY DA TORNARE
    $ret = array($ExtrinsicObject_id_array, $lang, $atna_patient_value, $simbolic_ExtrinsicObject_id_array);
    ### RETURN
    return $ret;
}
Beispiel #4
0
function fill_Association_tables($dom, $RegistryPackage_id_array, $ExtrinsicObject_id_array, $simbolic_RegistryPackage_FOL_id_array, $connessione)
{
    writeTimeFile("Registry: sono entrato in fill_Association_tables");
    ##### RADICE DEL DOCUMENTO ebXML
    $root_ebXML = $dom->document_element();
    ##### ARRAY DEI NODI LeafRegistryObjectList
    $dom_ebXML_LeafRegistryObjectList_node_array = $root_ebXML->get_elements_by_tagname("LeafRegistryObjectList");
    ##### NODO LeafRegistryObjectList
    $dom_ebXML_LeafRegistryObjectList_node = $dom_ebXML_LeafRegistryObjectList_node_array[0];
    ##### TUTTI I NODI FIGLI DI LeafRegistryObjectList
    $dom_ebXML_LeafRegistryObjectList_child_nodes = $dom_ebXML_LeafRegistryObjectList_node->child_nodes();
    for ($i = 0; $i < count($dom_ebXML_LeafRegistryObjectList_child_nodes); $i++) {
        #### SINGOLO NODO
        $dom_ebXML_LeafRegistryObjectList_child_node = $dom_ebXML_LeafRegistryObjectList_child_nodes[$i];
        ##### tagname
        $dom_ebXML_LeafRegistryObjectList_child_node_tagname = $dom_ebXML_LeafRegistryObjectList_child_node->node_name();
        #### SOLO I NODI ASSOCIATION
        if ($dom_ebXML_LeafRegistryObjectList_child_node_tagname == 'Association') {
            $association_node = $dom_ebXML_LeafRegistryObjectList_child_node;
            $DB_array_association_attributes = array();
            $value_id = $association_node->get_attribute('id');
            if ($value_id == '' || isSimbolic($value_id)) {
                $value_id = "urn:uuid:" . idrandom();
            }
            #### PARENT
            $value_parent = $value_id;
            $value_accessControlPolicy = $association_node->get_attribute('accessControlPolicy');
            if ($value_accessControlPolicy == '') {
                $value_accessControlPolicy = "NULL";
            }
            $value_objectType = $association_node->get_attribute('objectType');
            if ($value_objectType == '') {
                $value_objectType = "Association";
            }
            $value_associationType = $association_node->get_attribute('associationType');
            if ($value_associationType == '') {
                $value_associationType = "NOT DECLARED";
            }
            $value_sourceObject = $association_node->get_attribute('sourceObject');
            //writeSQLQuery('Valore fuori dall if '.$value_sourceObject);
            if ($value_sourceObject == "") {
                $errorcode[] = "XDSRegistryError";
                $error_message[] = "The sourceObject in Association is empty. ";
                $folder_response = makeSoapedFailureResponse($error_message, $errorcode);
                writeTimeFile($_SESSION['idfile'] . "--Registry: targetObject error");
                $file_input = $idfile . "-sourceObject_failure_response.xml";
                writeTmpFiles($folder_response, $file_input, true);
                SendResponseFile($_SESSION['tmp_path'] . $file_input);
                //SendResponse($folder_response,"application/soap+xml",filesize($tmp_path.$idfile."-folder_failure_response.xml"));
                exit;
            }
            if (isSimbolic($value_sourceObject)) {
                $value_sourceObject_1 = $ExtrinsicObject_id_array[$value_sourceObject];
                $value_sourceObject_2 = $RegistryPackage_id_array[$value_sourceObject];
                if ($value_sourceObject_1 != "") {
                    $value_sourceObject = $value_sourceObject_1;
                } else {
                    $value_sourceObject = $value_sourceObject_2;
                }
            }
            //END OF if(isSimbolic($value_sourceObject))
            $value_targetObject = $association_node->get_attribute('targetObject');
            if ($value_targetObject == "") {
                $errorcode[] = "XDSRegistryError";
                $error_message[] = "The targetObject in Association is empty. ";
                $folder_response = makeSoapedFailureResponse($error_message, $errorcode);
                writeTimeFile($_SESSION['idfile'] . "--Registry: targetObject error");
                $file_input = $idfile . "-targetObject_failure_response.xml";
                writeTmpFiles($folder_response, $file_input, true);
                SendResponseFile($_SESSION['tmp_path'] . $file_input);
                //SendResponse($folder_response,"application/soap+xml",filesize($tmp_path.$idfile."-folder_failure_response.xml"));
                exit;
            }
            $simbolic_value_targetObject = $association_node->get_attribute('targetObject');
            if (isSimbolic($value_targetObject)) {
                $value_targetObject_1 = $ExtrinsicObject_id_array[$value_targetObject];
                $value_targetObject_2 = $RegistryPackage_id_array[$value_targetObject];
                if ($value_targetObject_1 != "") {
                    $value_targetObject = $value_targetObject_1;
                } else {
                    $value_targetObject = $value_targetObject_2;
                }
            }
            //END OF if(isSimbolic($simbolic_value_targetObject))
            $value_isConfirmedBySourceOwner = $association_node->get_attribute('isConfirmedBySourceOwner');
            if ($value_isConfirmedBySourceOwner == '') {
                $value_isConfirmedBySourceOwner = "0";
            }
            $value_isConfirmedByTargetOwner = $association_node->get_attribute('isConfirmedByTargetOwner');
            if ($value_isConfirmedByTargetOwner == '') {
                $value_isConfirmedByTargetOwner = "0";
            }
            $DB_array_association_attributes['id'] = $value_id;
            $DB_array_association_attributes['accessControlPolicy'] = $value_accessControlPolicy;
            $DB_array_association_attributes['objectType'] = $value_objectType;
            $DB_array_association_attributes['associationType'] = $value_associationType;
            $DB_array_association_attributes['sourceObject'] = $value_sourceObject;
            $DB_array_association_attributes['targetObject'] = $value_targetObject;
            $DB_array_association_attributes['isConfirmedBySourceOwner'] = $value_isConfirmedBySourceOwner;
            $DB_array_association_attributes['isConfirmedByTargetOwner'] = $value_isConfirmedByTargetOwner;
            $Association_folder = in_array($simbolic_value_targetObject, $simbolic_RegistryPackage_FOL_id_array);
            if (!$Association_folder) {
                ####### QUI ORA POSSO RIEMPIRE IL DB
                $INSERT_INTO_Association = "INSERT INTO Association (id,accessControlPolicy,objectType,associationType,sourceObject,targetObject,isConfirmedBySourceOwner,isConfirmedByTargetOwner) VALUES ('" . $DB_array_association_attributes['id'] . "','" . $DB_array_association_attributes['accessControlPolicy'] . "','" . $DB_array_association_attributes['objectType'] . "','" . $DB_array_association_attributes['associationType'] . "','" . $DB_array_association_attributes['sourceObject'] . "','" . $DB_array_association_attributes['targetObject'] . "','" . $DB_array_association_attributes['isConfirmedBySourceOwner'] . "','" . $DB_array_association_attributes['isConfirmedByTargetOwner'] . "')";
                $ris = query_exec2($INSERT_INTO_Association, $connessione);
                writeSQLQuery($ris . ": " . $INSERT_INTO_Association);
                #### NODI FIGLI DI ASSOCIATION
                $association_child_nodes = $association_node->child_nodes();
                if (!empty($association_child_nodes)) {
                    for ($j = 0; $j < count($association_child_nodes); $j++) {
                        #### SINGOLO NODO
                        $association_child_node = $association_child_nodes[$j];
                        ##### tagname
                        $association_child_node_tagname = $association_child_node->node_name();
                        #### SOLO I NODI SLOT
                        if ($association_child_node_tagname == 'Slot') {
                            $slot_node = $association_child_node;
                            $DB_array_slot_attributes = array();
                            $value_name = $slot_node->get_attribute('name');
                            if ($value_name == '') {
                                $value_name = "NOT DECLARED";
                            }
                            $value_slotType = $slot_node->get_attribute('slotType');
                            if ($value_slotType == '') {
                                $value_slotType = "NULL";
                            }
                            $DB_array_slot_attributes['name'] = $value_name;
                            $DB_array_slot_attributes['slotType'] = $value_slotType;
                            $DB_array_slot_attributes['value'] = '';
                            $DB_array_slot_attributes['parent'] = $value_parent;
                            #### NODI FIGLI DI SLOT
                            $slot_child_nodes = $slot_node->child_nodes();
                            for ($q = 0; $q < count($slot_child_nodes); $q++) {
                                $slot_child_node = $slot_child_nodes[$q];
                                $slot_child_node_tagname = $slot_child_node->node_name();
                                if ($slot_child_node_tagname == 'ValueList') {
                                    $valuelist_node = $slot_child_node;
                                    $valuelist_child_nodes = $valuelist_node->child_nodes();
                                    ## UN SOLO VALUE
                                    for ($r = 0; $r < count($valuelist_child_nodes); $r++) {
                                        $value_node = $valuelist_child_nodes[$r];
                                        $value_node_tagname = $value_node->node_name();
                                        if ($value_node_tagname == 'Value') {
                                            $value_value = $value_node->get_content();
                                            $DB_array_slot_attributes['value'] = $value_value;
                                            ##### SONO PRONTO A SCRIVERE NEL DB
                                            $INSERT_INTO_Slot = "INSERT INTO Slot (name,slotType,value,parent) VALUES ('" . trim($DB_array_slot_attributes['name']) . "','" . trim($DB_array_slot_attributes['slotType']) . "','" . trim(adjustString($DB_array_slot_attributes['value'])) . "','" . trim($DB_array_slot_attributes['parent']) . "')";
                                            $ris = query_exec2($INSERT_INTO_Slot, $connessione);
                                            writeSQLQuery($ris . ": " . $INSERT_INTO_Slot);
                                        }
                                    }
                                }
                            }
                        }
                        //END OF if($association_child_node_tagname=='Slot')
                    }
                }
                //END OF if(!empty($association_child_nodes))
            } else {
            }
            ########### CASI DI REPLACEMENT + ADDENDUM + TRANSFORMATION
            ##### CASO RPLC Accept Document Replace
            if ($value_associationType == "RPLC") {
                // devo verificare se il documento da sostituire è dentro ad un folder, se è dentro ad un folder devo creare una association Folder Document.
                $query_SELECT_RegistryPackage = "SELECT id from RegistryPackage where id IN (SELECT sourceObject from Association where targetObject = '{$value_targetObject}') and objectType = 'urn:uuid:d9d542f3-6cc4-48b6-8870-ea235fbc94c2'";
                $Association_folder_array = query_select2($query_SELECT_RegistryPackage, $connessione);
                writeSQLQuery($Association_folder_array . ": " . $query_SELECT_RegistryPackage);
                //Se trovo qualche RegistryPackage di tipo folder
                $conta_Folder = count($Association_folder_array);
                for ($i_Folder = 0; $i_Folder < $conta_Folder; $i_Folder++) {
                    $insert_Association_folderDoc = "INSERT INTO Association (id,objectType,associationType,sourceObject,targetObject) VALUES ('urn:uuid:" . idrandom() . "','Association','HasMember','" . $Association_folder_array[$i_Folder][0] . "','" . $value_sourceObject . "')";
                    $res_insert_Association = query_exec2($insert_Association_folderDoc, $connessione);
                    writeSQLQuery($res_insert_Association . ": " . $insert_Association_folderDoc);
                }
                // devo cambiare lo stato del documento a Deprecated
                $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Deprecated' WHERE ExtrinsicObject.id = '{$value_targetObject}'";
                $ex = query_exec2($query_UPDATE_targetObject, $connessione);
                writeSQLQuery($ex . ": " . $query_UPDATE_targetObject);
            }
            //END OF if($value_associationType=="RPLC")
            ##### CASO XFRM_RPLC Accept Document Replace with Transformation
            if ($value_associationType == "XFRM_RPLC") {
                $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Deprecated' WHERE ExtrinsicObject.id = '{$value_targetObject}'";
                $ex = query_exec2($query_UPDATE_targetObject, $connessione);
                writeSQLQuery($ex . ": " . $query_UPDATE_targetObject);
            }
            //END OF if($value_associationType=="XFRM_RPLC")
            ##### CASO XFRM Accept Document Transformation
            if ($value_associationType == "XFRM") {
                $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Approved' WHERE ExtrinsicObject.id = '{$value_targetObject}'";
                $ex = query_exec2($query_UPDATE_targetObject, $connessione);
                writeSQLQuery($ex . ": " . $query_UPDATE_targetObject);
            }
            //END OF if($value_associationType=="XFRM")
            ##### CASO APND Accept Document Addendum
            if ($value_associationType == "APND") {
                $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Approved' WHERE ExtrinsicObject.id = '{$value_targetObject}'";
                $ex = query_exec2($query_UPDATE_targetObject, $connessione);
                writeTimeFile("Registry: update status" . $query_UPDATE_targetObject);
            }
            //END OF if($value_associationType=="APND")
            ########### CASI DI GESTIONE FOLDER + SUBMISSIONSET
            if ($value_associationType == "HasMember") {
                ##### FIGLI DI ASSOCIATION
                $association_node_childs = $association_node->child_nodes();
                #### AGGIUNTA DI UN DOCUMENTO A FOLDER GIA' ESISTENTE
                if (!isSimbolic($value_sourceObject) && empty($association_node_childs)) {
                    #### APPURIAMO DI ESSERE NEL CASO FOLDER
                    $query_folder = "SELECT * FROM Slot WHERE Slot.name = 'lastUpdateTime' AND Slot.parent = '{$value_sourceObject}'";
                    $ris_folder = query_select2($query_folder, $connessione);
                    writeSQLQuery($ris_folder . ": " . $query_folder);
                    if (!empty($ris_folder[0])) {
                        #### ricavo data-ora correnti
                        $today = date("Ymd");
                        $cur_hour = date("His");
                        $datetime = $today . $cur_hour;
                        //$datetime = "CURRENT_TIMESTAMP";
                        ####UPDATE DI lastUpdateTime
                        $update_lastUpdateTime = "UPDATE Slot SET Slot.value = '{$datetime}' WHERE Slot.name = 'lastUpdateTime' AND Slot.parent = '{$value_sourceObject}'";
                        $ex = query_exec2($update_lastUpdateTime, $connessione);
                        writeSQLQuery($ex . ": " . $update_lastUpdateTime);
                    }
                    //END OF if(!empty($ris_folder))
                } else {
                    if (!isSimbolic($value_sourceObject) && !empty($association_node_childs)) {
                        for ($y = 0; $y < count($association_node_childs); $y++) {
                            ##### NODO SLOT
                            $slot_node = $association_node_childs[$y];
                            ##### RECUPERO TAGNAME
                            $slot_node_tagname = $slot_node->node_name();
                            if ($slot_node_tagname == "Slot") {
                                #### NAME ATTRIBUTE FOR SLOT
                                $slot_node_name = $slot_node->get_attribute('name');
                                #### NODI FIGLI DI SLOT
                                $slot_node_childs = $slot_node->child_nodes();
                                for ($x = 0; $x < count($slot_node_childs); $x++) {
                                    $slot_node_child = $slot_node_childs[$x];
                                    $slot_node_child_tagname = $slot_node_child->node_name();
                                    if ($slot_node_child_tagname == "ValueList") {
                                        $slot_node_childs_2 = $slot_node_child->child_nodes();
                                        for ($z = 0; $z < count($slot_node_childs_2); $z++) {
                                            $slot_node_child_2 = $slot_node_childs_2[$z];
                                            $slot_node_child_2_tagname = $slot_node_child_2->node_name();
                                            if ($slot_node_child_2_tagname == "Value") {
                                                $update_value = $slot_node_child_2->get_content();
                                            }
                                            //END OF if($slot_node_child_2_tagname=="Value")
                                        }
                                    }
                                    //END OF if($slot_node_child_tagname=="ValueList")
                                }
                                ####UPDATE DI SubmissionSetStatus Non va fatta ????? Deve rimanere Approved
                                $update_RegistryPackageStatus = "UPDATE RegistryPackage SET RegistryPackage.status = '{$update_value}' WHERE  RegistryPackage.id = '{$value_sourceObject}'";
                                //writeSQLQuery($ris.": ".$update_RegistryPackageStatus);
                                $selectIdAssociation = "SELECT id FROM Association WHERE Association.sourceObject = '{$value_sourceObject}'";
                                $ris_selectIdAssociation = query_select2($selectIdAssociation, $connessione);
                                writeSQLQuery($ris_selectIdAssociation . ": " . $selectIdAssociation);
                                $countID = count($ris_selectIdAssociation);
                                for ($risId = 0; $risId < $countID; $risId++) {
                                    //$update_SubmissionSetStatus="UPDATE Slot SET Slot.value = '$update_value' WHERE name ='$slot_node_name' AND  Slot.parent IN (SELECT id FROM Association WHERE Association.sourceObject = '$value_sourceObject')";
                                    $update_SubmissionSetStatus = "UPDATE Slot SET Slot.value = '{$update_value}' WHERE name ='{$slot_node_name}' AND  Slot.parent ='" . $ris_selectIdAssociation[$risId][0] . "'";
                                    //writeTimeFile("Registry: update Slot  ".$update_SubmissionSetStatus);
                                    $ex = query_exec2($update_SubmissionSetStatus, $connessione);
                                    writeSQLQuery($ex . ": " . $update_SubmissionSetStatus);
                                }
                            }
                            //END OF if($slot_node_tagname=="Slot")
                        }
                        //END OF for($y=0;$y<count($association_node_childs);$y++)
                    }
                }
                //END OF else if(!isSimbolic($value_sourceObject))
            }
            //END OF if($value_associationType=="HasMember")
        } else {
            continue;
        }
    }
    //END OF for($i=0;$i<count($dom_ebXML_LeafRegistryObjectList_child_nodes);$i++)
    writeTimeFile("Registry: esco da fill_Association_tables");
}
Beispiel #5
0
function fill_RegistryPackage_tables($dom, $language, $connessione)
{
    #### LANGUAGECODE
    $lang = $language;
    ##### NODEREPRESENTATION
    $value_nodeRepresentation_assigned = '';
    ##### ARRAY DELL'ATTRIBUTO ID DI REGISTRYPACKAGE
    $RegistryPackage_id_array = array();
    $simbolic_RegistryPackage_id_array = array();
    #### FOLDERID DA NON INSERIRE
    $RegistryPackage_Fol_id_array = array();
    ##### ARRAY DEGLI ATTRIBUTI DEL NODO REGISTRYPACKAGE
    $DB_array_registrypackage_attributes = array();
    ##### RADICE DEL DOCUMENTO ebXML
    $root_ebXML = $dom->document_element();
    ##### ARRAY DEI NODI REGISTRYPACKAGE
    $dom_ebXML_RegistryPackage_node_array = $root_ebXML->get_elements_by_tagname("RegistryPackage");
    ##### ARRAY FOR ATNA
    $atna_value = array();
    #### CICLO SU OGNI RegistryPackage ####
    for ($index = 0; $index < count($dom_ebXML_RegistryPackage_node_array); $index++) {
        ##### NODO REGISTRYPACKAGE RELATIVO AL DOCUMENTO NUMERO $index
        $RegistryPackage_node = $dom_ebXML_RegistryPackage_node_array[$index];
        ### Setto di default che RegistryPackage non è un folder già presente
        $isEmpty_F = true;
        ##### NODO REGISTRYPACKAGE RELATIVO AL DOCUMENTO NUMERO $index
        $RegistryPackage_node = $dom_ebXML_RegistryPackage_node_array[$index];
        #### ARRAY DEI FIGLI DEL NODO REGISTRYPACKAGE ##############
        $RegistryPackage_child_nodes = $RegistryPackage_node->child_nodes();
        #################################################################
        ################# PROCESSO TUTTI I NODI FIGLI DI REGISTRYPACKAGE
        for ($k = 0; $k < count($RegistryPackage_child_nodes); $k++) {
            #### SINGOLO NODO FIGLIO DI REGISTRYPACKAGE
            $RegistryPackage_child_node = $RegistryPackage_child_nodes[$k];
            #### NOME DEL NODO
            $RegistryPackage_child_node_tagname = $RegistryPackage_child_node->node_name();
            ########## Versione 2.1 per gestione Folder.uniqueid #############
            if ($RegistryPackage_child_node_tagname == 'ExternalIdentifier') {
                $externalidentifier_node = $RegistryPackage_child_node;
                $value_value = avoidHtmlEntitiesInterpretation($externalidentifier_node->get_attribute('value'));
                #### NODI FIGLI DI EXTERNALIDENTIFIER
                $externalidentifier_child_nodes = $externalidentifier_node->child_nodes();
                for ($q = 0; $q < count($externalidentifier_child_nodes); $q++) {
                    $externalidentifier_child_node = $externalidentifier_child_nodes[$q];
                    $externalidentifier_child_node_tagname = $externalidentifier_child_node->node_name();
                    if ($externalidentifier_child_node_tagname == 'Name') {
                        $name_node = $externalidentifier_child_node;
                        $LocalizedString_nodes = $name_node->child_nodes();
                        for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                            $LocalizedString_node = $LocalizedString_nodes[$p];
                            //->node_name();
                            $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                            if ($LocalizedString_node_tagname == 'LocalizedString') {
                                $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                                if (strpos(strtolower(trim($LocalizedString_value)), strtolower('Folder.uniqueId'))) {
                                    $ebxml_value = $value_value;
                                    ### QUERY AL DB
                                    $query = "SELECT registryObject FROM ExternalIdentifier WHERE value = '{$ebxml_value}' and identificationScheme = 'urn:uuid:75df8f67-9973-4fbe-a900-df66cefecc5a'";
                                    $res = query_select2($query, $connessione);
                                    //array bidimensionale
                                    writeSQLQuery($res . ": " . $query);
                                    $isEmpty_F = empty($res);
                                    $value_RegistryPackage_id = $res[0][0];
                                    //$RegistryPackage_Fol_id_array[]=$simbolic_RegistryPackage_id_fol;
                                }
                            }
                        }
                    }
                }
            }
        }
        ###############################################################################
        if ($isEmpty_F) {
            ############## RECUPERO TUTTI GLI ATTRIBUTI DEL NODO REGISTRYPACKAGE
            $value_RegistryPackage_id = "urn:uuid:" . idrandom();
            $simbolic_RegistryPackage_id = $RegistryPackage_node->get_attribute('id');
            $simbolic_RegistryPackage_id_array[] = $RegistryPackage_node->get_attribute('id');
            #############################################################
            ####NOTA BENE NEL CASO NON SIMBOLICO(VEDI SOLINFO)
            if (!isSimbolic($simbolic_RegistryPackage_id)) {
                $value_RegistryPackage_id = $simbolic_RegistryPackage_id;
            }
            #############################################################
            $RegistryPackage_id_array[$simbolic_RegistryPackage_id] = $value_RegistryPackage_id;
            $value_accessControlPolicy = $RegistryPackage_node->get_attribute('accessControlPolicy');
            if ($value_accessControlPolicy == '') {
                $value_accessControlPolicy = "NULL";
            }
            $value_objectType = $RegistryPackage_node->get_attribute('objectType');
            if ($value_objectType == '' || $value_objectType == 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:RegistryPackage') {
                $value_objectType = "RegistryPackage";
            }
            $value_expiration = $RegistryPackage_node->get_attribute('expiration');
            if ($value_expiration == '') {
                $value_expiration = "CURRENT_TIMESTAMP";
            }
            $value_majorVersion = $RegistryPackage_node->get_attribute('majorVersion');
            if ($value_majorVersion == '') {
                $value_majorVersion = "0";
            }
            $value_minorVersion = $RegistryPackage_node->get_attribute('minorVersion');
            if ($value_minorVersion == '') {
                $value_minorVersion = "1";
            }
            $value_stability = $RegistryPackage_node->get_attribute('stability');
            if ($value_stability == '') {
                $value_stability = "NULL";
            }
            $value_status = $RegistryPackage_node->get_attribute('status');
            if ($value_status == '') {
                //$value_status = "Approved";
                $value_status = "NotCompleted";
            }
            $value_userVersion = $RegistryPackage_node->get_attribute('userVersion');
            if ($value_userVersion == '') {
                $value_userVersion = "NULL";
            }
            $DB_array_registrypackage_attributes['accessControlPolicy'] = $value_accessControlPolicy;
            $DB_array_registrypackage_attributes['id'] = $value_RegistryPackage_id;
            $DB_array_registrypackage_attributes['objectType'] = $value_objectType;
            $DB_array_registrypackage_attributes['expiration'] = $value_expiration;
            $DB_array_registrypackage_attributes['majorVersion'] = $value_majorVersion;
            $DB_array_registrypackage_attributes['minorVersion'] = $value_minorVersion;
            $DB_array_registrypackage_attributes['stability'] = $value_stability;
            $DB_array_registrypackage_attributes['status'] = $value_status;
            $DB_array_registrypackage_attributes['userVersion'] = $value_userVersion;
            ####### QUI ORA POSSO RIEMPIRE IL DB
            $INSERT_INTO_RegistryPackage = "INSERT INTO RegistryPackage (id,accessControlPolicy,objectType,expiration,majorVersion,minorVersion,stability,status,userVersion) VALUES\n('" . $DB_array_registrypackage_attributes['id'] . "','" . $DB_array_registrypackage_attributes['accessControlPolicy'] . "','" . $DB_array_registrypackage_attributes['objectType'] . "'," . $DB_array_registrypackage_attributes['expiration'] . ",'" . $DB_array_registrypackage_attributes['majorVersion'] . "','" . $DB_array_registrypackage_attributes['minorVersion'] . "','" . $DB_array_registrypackage_attributes['stability'] . "','" . $DB_array_registrypackage_attributes['status'] . "','" . $DB_array_registrypackage_attributes['userVersion'] . "')";
            $ris = query_exec2($INSERT_INTO_RegistryPackage, $connessione);
            writeSQLQuery($ris . ": " . $INSERT_INTO_RegistryPackage);
            ############## FINE RECUPERO TUTTI GLI ATTRIBUTI DEL NODO REGISTRYPACKAGE
            #### ARRAY DEI FIGLI DEL NODO REGISTRYPACKAGE ##############
            $RegistryPackage_child_nodes = $RegistryPackage_node->child_nodes();
            #################################################################
            ################# PROCESSO TUTTI I NODI FIGLI DI REGISTRYPACKAGE
            $value_parent = $value_RegistryPackage_id;
            for ($k = 0; $k < count($RegistryPackage_child_nodes); $k++) {
                #### SINGOLO NODO FIGLIO DI REGISTRYPACKAGE
                $RegistryPackage_child_node = $RegistryPackage_child_nodes[$k];
                #### NOME DEL NODO
                $RegistryPackage_child_node_tagname = $RegistryPackage_child_node->node_name();
                #### NODO NAME
                if ($RegistryPackage_child_node_tagname == 'Name') {
                    $name_node = $RegistryPackage_child_node;
                    $DB_array_name = array();
                    $LocalizedString_nodes = $name_node->child_nodes();
                    for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                        $LocalizedString_node = $LocalizedString_nodes[$p];
                        //->node_name();
                        $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                        if ($LocalizedString_node_tagname == 'LocalizedString') {
                            $LocalizedString_charset = $LocalizedString_node->get_attribute('charset');
                            if ($LocalizedString_charset == '') {
                                $LocalizedString_charset = "UTF-8";
                            }
                            $LocalizedString_lang = $LocalizedString_node->get_attribute('lang');
                            if ($LocalizedString_lang == '') {
                                $LocalizedString_lang = $lang;
                            }
                            $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                            if ($LocalizedString_value == '') {
                                $LocalizedString_value = "NOT DECLARED";
                            }
                            ### CASO DI FOLDER
                            $lastUpdateTime = true;
                            ###NON MODIFICARE!!!
                            $DB_array_name['charset'] = $LocalizedString_charset;
                            $DB_array_name['lang'] = $LocalizedString_lang;
                            $DB_array_name['value'] = $LocalizedString_value;
                        }
                        //END OF if($LocalizedString_node_tagname == 'LocalizedString')
                    }
                    //END OF for($p = 0;$p < count($val_list_node);$p++)
                    //$value_parent = $value_RegistryPackage_id;
                    $DB_array_name['parent'] = $value_parent;
                    //print_r($DB_array_name);
                    ##### SONO PRONTO A SCRIVERE NEL DB
                    $INSERT_INTO_Name = "INSERT INTO Name (charset,lang,value,parent) VALUES ('" . trim($DB_array_name['charset']) . "','" . trim($DB_array_name['lang']) . "','" . trim(adjustString($DB_array_name['value'])) . "','" . trim($DB_array_name['parent']) . "')";
                    $ris = query_exec2($INSERT_INTO_Name, $connessione);
                    writeSQLQuery($ris . ": " . $INSERT_INTO_Name);
                } else {
                    if ($RegistryPackage_child_node_tagname == 'Description') {
                        $description_node = $RegistryPackage_child_node;
                        $DB_array_description = array();
                        $LocalizedString_nodes = $description_node->child_nodes();
                        if (count($LocalizedString_nodes) != 0) {
                            //print_r($LocalizedString_nodes);
                            for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                                $LocalizedString_node = $LocalizedString_nodes[$p];
                                $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                                if ($LocalizedString_node_tagname == 'LocalizedString') {
                                    $LocalizedString_charset = $LocalizedString_node->get_attribute('charset');
                                    if ($LocalizedString_charset == '') {
                                        $LocalizedString_charset = "UTF-8";
                                    }
                                    $LocalizedString_lang = $LocalizedString_node->get_attribute('lang');
                                    if ($LocalizedString_lang == '') {
                                        $LocalizedString_lang = $lang;
                                    }
                                    $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                                    if ($LocalizedString_value == '') {
                                        $LocalizedString_value = "NOT DECLARED";
                                    }
                                    $DB_array_description['charset'] = $LocalizedString_charset;
                                    $DB_array_description['lang'] = $LocalizedString_lang;
                                    $DB_array_description['value'] = $LocalizedString_value;
                                }
                                //END OF if($LocalizedString_node_tagname == 'LocalizedString')
                            }
                            //END OF for($p = 0;$p < count($val_list_node);$p++)
                            //$value_parent = $id;
                            $DB_array_description['parent'] = $value_parent;
                        } else {
                            $DB_array_description['charset'] = "UTF-8";
                            $DB_array_description['lang'] = "it-it";
                            $DB_array_description['value'] = "NOT DECLARED";
                            $DB_array_description['parent'] = $value_parent;
                        }
                        ##### SONO PRONTO A SCRIVERE NEL DB
                        $INSERT_INTO_Description = "INSERT INTO Description (charset,lang,value,parent) VALUES ('" . trim($DB_array_description['charset']) . "','" . trim($DB_array_description['lang']) . "','" . trim(adjustString($DB_array_description['value'])) . "','" . trim($DB_array_description['parent']) . "')";
                        $ris = query_exec2($INSERT_INTO_Description, $connessione);
                        writeSQLQuery($ris . ": " . $INSERT_INTO_Description);
                    } else {
                        if ($RegistryPackage_child_node_tagname == 'Slot') {
                            $slot_node = $RegistryPackage_child_node;
                            $DB_array_slot_attributes = array();
                            $value_name = $slot_node->get_attribute('name');
                            if ($value_name == '') {
                                $value_name = "NOT DECLARED";
                            }
                            $value_slotType = $slot_node->get_attribute('slotType');
                            if ($value_slotType == '') {
                                $value_slotType = "NULL";
                            }
                            $DB_array_slot_attributes['name'] = $value_name;
                            $DB_array_slot_attributes['slotType'] = $value_slotType;
                            $DB_array_slot_attributes['value'] = '';
                            $DB_array_slot_attributes['parent'] = $value_parent;
                            #### NODI FIGLI DI SLOT
                            $slot_child_nodes = $slot_node->child_nodes();
                            for ($q = 0; $q < count($slot_child_nodes); $q++) {
                                $slot_child_node = $slot_child_nodes[$q];
                                $slot_child_node_tagname = $slot_child_node->node_name();
                                if ($slot_child_node_tagname == 'ValueList') {
                                    $valuelist_node = $slot_child_node;
                                    $valuelist_child_nodes = $valuelist_node->child_nodes();
                                    for ($r = 0; $r < count($valuelist_child_nodes); $r++) {
                                        $value_node = $valuelist_child_nodes[$r];
                                        $value_node_tagname = $value_node->node_name();
                                        if ($value_node_tagname == 'Value' && $value_name != "lastUpdateTime") {
                                            $value_value = $value_node->get_content();
                                            $DB_array_slot_attributes['value'] = $value_value;
                                            ##### SONO PRONTO A SCRIVERE NEL DB
                                            $INSERT_INTO_Slot = "INSERT INTO Slot (name,slotType,value,parent) VALUES ('" . trim($DB_array_slot_attributes['name']) . "','" . trim($DB_array_slot_attributes['slotType']) . "','" . trim(adjustString($DB_array_slot_attributes['value'])) . "','" . trim($DB_array_slot_attributes['parent']) . "')";
                                            $ris = query_exec2($INSERT_INTO_Slot, $connessione);
                                            writeSQLQuery($ris . ": " . $INSERT_INTO_Slot);
                                        }
                                    }
                                }
                            }
                        } else {
                            if ($RegistryPackage_child_node_tagname == 'Classification') {
                                $classification_node = $RegistryPackage_child_node;
                                $DB_array_classification_attributes = array();
                                $value_id = $classification_node->get_attribute('id');
                                if ($value_id == '' || isSimbolic($value_id)) {
                                    $value_id = "urn:uuid:" . idrandom();
                                }
                                $value_classifiedObject = $value_RegistryPackage_id;
                                $value_accessControlPolicy = $classification_node->get_attribute('accessControlPolicy');
                                if ($value_accessControlPolicy == '') {
                                    $value_accessControlPolicy = "NULL";
                                }
                                $value_objectType = $classification_node->get_attribute('objectType');
                                if ($value_objectType == '' || $value_objectType == 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification') {
                                    $value_objectType = "Classification";
                                }
                                $value_classificationNode = $classification_node->get_attribute('classificationNode');
                                $value_classificationScheme = $classification_node->get_attribute('classificationScheme');
                                if ($value_classificationNode == '') {
                                    $queryForName_value = "SELECT Name_value FROM ClassificationScheme WHERE ClassificationScheme.id = '{$value_classificationScheme}'";
                                    $risName_value = query_select2($queryForName_value, $connessione);
                                    writeSQLQuery($risName_value . ": " . $queryForName_value);
                                    $name_value = $risName_value[0][0];
                                    $name_value = substr($name_value, 0, strpos($name_value, '.'));
                                    $queryForClassificationNode = "SELECT id FROM ClassificationNode WHERE ClassificationNode.code = '{$name_value}'";
                                    $ris_code = query_select2($queryForClassificationNode, $connessione);
                                    writeSQLQuery($ris_code . ": " . $queryForClassificationNode);
                                    $value_classificationNode = $ris_code[0][0];
                                }
                                if ($value_classificationScheme == '') {
                                    $queryForClassificationNode = "SELECT code FROM ClassificationNode WHERE ClassificationNode.id = '{$value_classificationNode}'";
                                    $ris_classificationNode = query_select2($queryForClassificationNode, $connessione);
                                    writeSQLQuery($ris_classificationNode . ": " . $queryForClassificationNode);
                                    $code_classificationNode = $ris_classificationNode[0][0];
                                    #### FOLDER
                                    if ($code_classificationNode == "XDSFolder") {
                                        $queryForClassificationScheme = "SELECT id FROM ClassificationScheme WHERE ClassificationScheme. Name_value = 'XDSFolder.codeList'";
                                        $ris_ClassificationScheme = query_select2($queryForClassificationScheme, $connessione);
                                        writeSQLQuery($ris_ClassificationScheme . ": " . $queryForClassificationScheme);
                                        $value_classificationScheme = $ris_ClassificationScheme[0][0];
                                    } else {
                                        if ($code_classificationNode == "XDSSubmissionSet") {
                                            $queryForClassificationScheme = "SELECT id FROM ClassificationScheme WHERE ClassificationScheme. Name_value = 'XDSSubmissionSet.contentTypeCode'";
                                            $ris_ClassificationScheme = query_select2($queryForClassificationScheme, $connessione);
                                            writeSQLQuery($ris_ClassificationScheme . ": " . $queryForClassificationScheme);
                                            $value_classificationScheme = $ris_ClassificationScheme[0][0];
                                        }
                                    }
                                    //END OF if($code_classificationNode=="XDSSubmissionSet")
                                }
                                //END OF if($value_classificationScheme == '')
                                $value_nodeRepresentation = $classification_node->get_attribute('nodeRepresentation');
                                ## SALVO IL VALORE DI nodeRepresentation DICHIARATO NEL SUBMISSIONSET
                                if ($value_nodeRepresentation != '' && $value_classificationScheme == 'urn:uuid:aa543740-bdda-424e-8c96-df4873be8500') {
                                    $value_nodeRepresentation_assigned = $value_nodeRepresentation;
                                }
                                ## CASO DI nodeRepresentation NON DICHIARATO (ES. FOLDER)
                                if ($value_nodeRepresentation == '') {
                                    $value_nodeRepresentation = $value_nodeRepresentation_assigned;
                                }
                                $DB_array_classification_attributes['classificationScheme'] = $value_classificationScheme;
                                $DB_array_classification_attributes['accessControlPolicy'] = $value_accessControlPolicy;
                                $DB_array_classification_attributes['id'] = $value_id;
                                $DB_array_classification_attributes['objectType'] = $value_objectType;
                                $DB_array_classification_attributes['classifiedObject'] = $value_classifiedObject;
                                $DB_array_classification_attributes['classificationNode'] = $value_classificationNode;
                                $DB_array_classification_attributes['nodeRepresentation'] = $value_nodeRepresentation;
                                //print_r($DB_array_classification_attributes);
                                ##### SONO PRONTO A SCRIVERE NEL DB
                                $INSERT_INTO_Classification = "INSERT INTO Classification (id,accessControlPolicy,objectType,classificationNode,classificationScheme,classifiedObject,nodeRepresentation) VALUES ('" . trim($DB_array_classification_attributes['id']) . "','" . trim($DB_array_classification_attributes['accessControlPolicy']) . "','" . trim($DB_array_classification_attributes['objectType']) . "','" . trim($DB_array_classification_attributes['classificationNode']) . "','" . trim($DB_array_classification_attributes['classificationScheme']) . "','" . trim($DB_array_classification_attributes['classifiedObject']) . "','" . trim($DB_array_classification_attributes['nodeRepresentation']) . "')";
                                $ris = query_exec2($INSERT_INTO_Classification, $connessione);
                                writeSQLQuery($ris . ": " . $INSERT_INTO_Classification);
                                #### NODI FIGLI DI CLASSIFICATION
                                $classification_child_nodes = $classification_node->child_nodes();
                                for ($q = 0; $q < count($classification_child_nodes); $q++) {
                                    $classification_child_node = $classification_child_nodes[$q];
                                    $classification_child_node_tagname = $classification_child_node->node_name();
                                    if ($classification_child_node_tagname == 'Name') {
                                        $name_node = $classification_child_node;
                                        $DB_array_name = array();
                                        $LocalizedString_nodes = $name_node->child_nodes();
                                        //print_r($LocalizedString_nodes);
                                        for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                                            $LocalizedString_node = $LocalizedString_nodes[$p];
                                            //->node_name();
                                            $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                                            if ($LocalizedString_node_tagname == 'LocalizedString') {
                                                $LocalizedString_charset = $LocalizedString_node->get_attribute('charset');
                                                if ($LocalizedString_charset == '') {
                                                    $LocalizedString_charset = "UTF-8";
                                                }
                                                $LocalizedString_lang = $LocalizedString_node->get_attribute('lang');
                                                if ($LocalizedString_lang == '') {
                                                    $LocalizedString_lang = $lang;
                                                }
                                                $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                                                if ($LocalizedString_value == '') {
                                                    $LocalizedString_value = "NOT DECLARED";
                                                }
                                                $DB_array_name['charset'] = $LocalizedString_charset;
                                                $DB_array_name['lang'] = $LocalizedString_lang;
                                                $DB_array_name['value'] = $LocalizedString_value;
                                            }
                                            //END OF if($LocalizedString_node_tagname == 'LocalizedString')
                                        }
                                        //END OF for($p = 0;$p < count($val_list_node);$p++)
                                        //$value_parent = $id;
                                        $DB_array_name['parent'] = $value_id;
                                        //print_r($DB_array_name);
                                        ##### SONO PRONTO A SCRIVERE NEL DB
                                        $INSERT_INTO_Name = "INSERT INTO Name (charset,lang,value,parent) VALUES ('" . trim($DB_array_name['charset']) . "','" . trim($DB_array_name['lang']) . "','" . trim(adjustString($DB_array_name['value'])) . "','" . trim($DB_array_name['parent']) . "')";
                                        $ris = query_exec2($INSERT_INTO_Name, $connessione);
                                        writeSQLQuery($ris . ": " . $INSERT_INTO_Name);
                                    }
                                    //END OF if($classification_child_node_tagname=='Name')
                                }
                                for ($rs = 0; $rs < count($classification_child_nodes); $rs++) {
                                    $classification_child_node = $classification_child_nodes[$rs];
                                    $classification_child_node_tagname = $classification_child_node->node_name();
                                    if ($classification_child_node_tagname == 'Slot') {
                                        $slot_node = $classification_child_node;
                                        $DB_array_slot_attributes = array();
                                        $value_name = $slot_node->get_attribute('name');
                                        if ($value_name == '') {
                                            $value_name = "NOT DECLARED";
                                        }
                                        $value_slotType = $slot_node->get_attribute('slotType');
                                        if ($value_slotType == '') {
                                            $value_slotType = "NULL";
                                        }
                                        $DB_array_slot_attributes['name'] = $value_name;
                                        $DB_array_slot_attributes['slotType'] = $value_slotType;
                                        $DB_array_slot_attributes['value'] = '';
                                        $DB_array_slot_attributes['parent'] = $value_id;
                                        $slot_child_nodes = $slot_node->child_nodes();
                                        for ($q = 0; $q < count($slot_child_nodes); $q++) {
                                            $slot_child_node = $slot_child_nodes[$q];
                                            $slot_child_node_tagname = $slot_child_node->node_name();
                                            if ($slot_child_node_tagname == 'ValueList') {
                                                $valuelist_node = $slot_child_node;
                                                $valuelist_child_nodes = $valuelist_node->child_nodes();
                                                for ($r = 0; $r < count($valuelist_child_nodes); $r++) {
                                                    $value_node = $valuelist_child_nodes[$r];
                                                    $value_node_tagname = $value_node->node_name();
                                                    if ($value_node_tagname == 'Value') {
                                                        $value_value = $value_node->get_content();
                                                        $DB_array_slot_attributes['value'] = $value_value;
                                                        ##### SONO PRONTO A SCRIVERE NEL DB
                                                        $INSERT_INTO_Slot = "INSERT INTO Slot (name,slotType,value,parent) VALUES ('" . trim($DB_array_slot_attributes['name']) . "','" . trim($DB_array_slot_attributes['slotType']) . "','" . trim(adjustString($DB_array_slot_attributes['value'])) . "','" . trim($DB_array_slot_attributes['parent']) . "')";
                                                        $ris = query_exec2($INSERT_INTO_Slot, $connessione);
                                                        writeSQLQuery($ris . ": " . $INSERT_INTO_Slot);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    //END OF if($classification_child_node_tagname=='Slot')
                                }
                            } else {
                                if ($RegistryPackage_child_node_tagname == 'ExternalIdentifier') {
                                    //$ExternalIdentifier_count++;
                                    $externalidentifier_node = $RegistryPackage_child_node;
                                    $DB_array_externalidentifier_attributes = array();
                                    $value_accessControlPolicy = $externalidentifier_node->get_attribute('accessControlPolicy');
                                    if ($value_accessControlPolicy == '') {
                                        $value_accessControlPolicy = "NULL";
                                    }
                                    $value_id = $externalidentifier_node->get_attribute('id');
                                    if ($value_id == '' || isSimbolic($value_id)) {
                                        $value_id = "urn:uuid:" . idrandom();
                                    }
                                    $value_objectType = $externalidentifier_node->get_attribute('objectType');
                                    if ($value_objectType == '' || $value_objectType == 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier') {
                                        $value_objectType = "ExternalIdentifier";
                                    }
                                    $value_registryObject = $value_RegistryPackage_id;
                                    // 			$value_registryObject= $externalidentifier_node->get_attribute('registryObject');
                                    // 			if($value_registryObject == '')
                                    // 			{
                                    // 				$value_registryObject = "NOT DECLARED";
                                    // 			}
                                    $value_identificationScheme = $externalidentifier_node->get_attribute('identificationScheme');
                                    #### DALL'identificationScheme RICONOSCO IL TIPO DI REGISTRYPACKAGE
                                    $queryForName_value = "SELECT Name_value FROM ClassificationScheme WHERE ClassificationScheme.id = '{$value_identificationScheme}'";
                                    $risName_value = query_select2($queryForName_value, $connessione);
                                    $name_value = $risName_value[0][0];
                                    $name_value = substr($name_value, 0, strpos($name_value, '.'));
                                    $query_for_objectType = "SELECT id FROM ClassificationNode WHERE ClassificationNode.code = '{$name_value}'";
                                    $objectType_arr = query_select2($query_for_objectType, $connessione);
                                    writeSQLQuery($objectType_arr . ": " . $query_for_objectType);
                                    $objectType = $objectType_arr[0][0];
                                    #### CASO DI FOLDER
                                    if ($name_value == 'XDSFolder' && $lastUpdateTime) {
                                        //$datetime="00000000000000";
                                        $today = date("Ymd");
                                        $cur_hour = date("His");
                                        $datetime = $today . $cur_hour;
                                        $insert_lastUpdateTime_Slot = "INSERT INTO Slot (name,slotType,value,parent) VALUES ('lastUpdateTime','NULL','{$datetime}','{$value_parent}')";
                                        $ris = query_exec2($insert_lastUpdateTime_Slot, $connessione);
                                        writeSQLQuery($ris . ": " . $insert_lastUpdateTime_Slot);
                                        $lastUpdateTime = false;
                                    }
                                    //END OF if($name_value=='XDSFolder')
                                    ####UPDATE DELL'OBJECTTYPE
                                    $update_objectType = "UPDATE RegistryPackage SET RegistryPackage.objectType = '{$objectType}' WHERE RegistryPackage.id = '{$value_RegistryPackage_id}'";
                                    $ris = query_exec2($update_objectType, $connessione);
                                    writeSQLQuery($ris . ": " . $update_objectType);
                                    //$value_value= avoidHtmlEntitiesInterpretation($externalidentifier_node->get_attribute('value'));
                                    $value_value = $externalidentifier_node->get_attribute('value');
                                    if ($value_value == '') {
                                        $value_value = "NOT DECLARED";
                                    }
                                    $DB_array_externalidentifier_attributes['accessControlPolicy'] = $value_accessControlPolicy;
                                    $DB_array_externalidentifier_attributes['id'] = $value_id;
                                    $DB_array_externalidentifier_attributes['objectType'] = $value_objectType;
                                    $DB_array_externalidentifier_attributes['registryObject'] = $value_registryObject;
                                    $DB_array_externalidentifier_attributes['identificationScheme'] = $value_identificationScheme;
                                    $DB_array_externalidentifier_attributes['value'] = $value_value;
                                    //print_r($DB_array_externalidentifier_attributes);
                                    ##### SONO PRONTO A SCRIVERE NEL DB
                                    $INSERT_INTO_ExternalIdentifier = "INSERT INTO ExternalIdentifier (id,accessControlPolicy,objectType,registryObject,identificationScheme,value) VALUES ('" . trim($DB_array_externalidentifier_attributes['id']) . "','" . trim($DB_array_externalidentifier_attributes['accessControlPolicy']) . "','" . trim($DB_array_externalidentifier_attributes['objectType']) . "','" . trim($DB_array_externalidentifier_attributes['registryObject']) . "','" . trim($DB_array_externalidentifier_attributes['identificationScheme']) . "','" . trim(adjustString($DB_array_externalidentifier_attributes['value'])) . "')";
                                    $ris = query_exec2($INSERT_INTO_ExternalIdentifier, $connessione);
                                    writeSQLQuery($ris . ": " . $INSERT_INTO_ExternalIdentifier);
                                    $atna_value_index = trim($DB_array_externalidentifier_attributes['identificationScheme']);
                                    $atna_value[$atna_value_index] = trim(adjustString($DB_array_externalidentifier_attributes['value']));
                                    #### NODI FIGLI DI EXTERNALIDENTIFIER
                                    $externalidentifier_child_nodes = $externalidentifier_node->child_nodes();
                                    //print_r($name_node);
                                    for ($q = 0; $q < count($externalidentifier_child_nodes); $q++) {
                                        $externalidentifier_child_node = $externalidentifier_child_nodes[$q];
                                        $externalidentifier_child_node_tagname = $externalidentifier_child_node->node_name();
                                        if ($externalidentifier_child_node_tagname == 'Name') {
                                            $name_node = $externalidentifier_child_node;
                                            $DB_array_name = array();
                                            $LocalizedString_nodes = $name_node->child_nodes();
                                            //print_r($LocalizedString_nodes);
                                            for ($p = 0; $p < count($LocalizedString_nodes); $p++) {
                                                $LocalizedString_node = $LocalizedString_nodes[$p];
                                                //->node_name();
                                                $LocalizedString_node_tagname = $LocalizedString_node->node_name();
                                                if ($LocalizedString_node_tagname == 'LocalizedString') {
                                                    $LocalizedString_charset = $LocalizedString_node->get_attribute('charset');
                                                    if ($LocalizedString_charset == '') {
                                                        $LocalizedString_charset = "UTF-8";
                                                    }
                                                    $LocalizedString_lang = $LocalizedString_node->get_attribute('lang');
                                                    if ($LocalizedString_lang == '') {
                                                        $LocalizedString_lang = $lang;
                                                    }
                                                    $LocalizedString_value = $LocalizedString_node->get_attribute('value');
                                                    if ($LocalizedString_value == '') {
                                                        $LocalizedString_value = "NOT DECLARED";
                                                    }
                                                    $DB_array_name['charset'] = $LocalizedString_charset;
                                                    $DB_array_name['lang'] = $LocalizedString_lang;
                                                    $DB_array_name['value'] = $LocalizedString_value;
                                                }
                                                //END OF if($LocalizedString_node_tagname == 'LocalizedString')
                                            }
                                            //END OF for($p = 0;$p < count($val_list_node);$p++)
                                            //$value_parent = $id;
                                            $DB_array_name['parent'] = $value_id;
                                        }
                                    }
                                    //print_r($DB_array_name);
                                    ##### SONO PRONTO A SCRIVERE NEL DB
                                    $INSERT_INTO_Name = "INSERT INTO Name (charset,lang,value,parent) VALUES ('" . trim($DB_array_name['charset']) . "','" . trim($DB_array_name['lang']) . "','" . trim(adjustString($DB_array_name['value'])) . "','" . trim($DB_array_name['parent']) . "')";
                                    $ris = query_exec2($INSERT_INTO_Name, $connessione);
                                    writeSQLQuery($ris . ": " . $INSERT_INTO_Name);
                                }
                            }
                        }
                    }
                }
                //END OF if($RegistryPackage_child_node_tagname=='ExternalIdentifier')
            }
            //END OF for($k=0;$k<count($RegistryPackage_child_nodes);$k++)
            ################# FINE PROCESSO TUTTI I NODI FIGLI DI REGISTRYPACKAGE
        } else {
            $simbolic_RegistryPackage_id_fol = $RegistryPackage_node->get_attribute('id');
            $RegistryPackage_Fol_id_array[] = $simbolic_RegistryPackage_id_fol;
            $RegistryPackage_id_array[$simbolic_RegistryPackage_id_fol] = $value_RegistryPackage_id;
        }
    }
    //END OF for($index=0;$index<(count($dom_ebXML_RegistryPackage_node_array));$index++)
    $RegistryPackage_id_array['nodeRepresentation'] = $value_nodeRepresentation_assigned;
    //return $RegistryPackage_id_array;
    return array($RegistryPackage_id_array, $atna_value, $simbolic_RegistryPackage_id_array, $RegistryPackage_Fol_id_array);
}
Beispiel #6
0
function fill_Classification_tables($dom, $RegistryPackage_id_array, $simbolic_RegistryPackage_FOL_id_array, $connessione)
{
    ##### NODEREPRESENTATION
    $value_nodeRepresentation_assigned = '';
    ##### RADICE DEL DOCUMENTO ebXML
    $root_ebXML = $dom->document_element();
    ##### ARRAY DEI NODI RegistryObjectList
    $dom_ebXML_RegistryObjectList_node_array = $root_ebXML->get_elements_by_tagname("RegistryObjectList");
    ##### NODO RegistryObjectList
    $dom_ebXML_RegistryObjectList_node = $dom_ebXML_RegistryObjectList_node_array[0];
    ##### TUTTI I NODI FIGLI DI RegistryObjectList
    $dom_ebXML_RegistryObjectList_child_nodes = $dom_ebXML_RegistryObjectList_node->child_nodes();
    for ($i = 0; $i < count($dom_ebXML_RegistryObjectList_child_nodes); $i++) {
        #### SINGOLO NODO
        $dom_ebXML_RegistryObjectList_child_node = $dom_ebXML_RegistryObjectList_child_nodes[$i];
        ##### tagname
        $dom_ebXML_RegistryObjectList_child_node_tagname = $dom_ebXML_RegistryObjectList_child_node->node_name();
        #### SOLO I NODI CLASSIFICATION
        if ($dom_ebXML_RegistryObjectList_child_node_tagname == 'Classification') {
            $classification_node = $dom_ebXML_RegistryObjectList_child_node;
            $value_id = "urn:uuid:" . idrandom();
            $simbolic_Classification_id = $classification_node->get_attribute('id');
            #############################################################
            ####NOTA BENE NEL CASO NON SIMBOLICO(VEDI SOLINFO)
            if (!isSimbolic($simbolic_Classification_id)) {
                $value_id = $simbolic_Classification_id;
            }
            #############################################################
            $value_accessControlPolicy = $classification_node->get_attribute('accessControlPolicy');
            if ($value_accessControlPolicy == '') {
                $value_accessControlPolicy = "NULL";
            }
            $value_objectType = $classification_node->get_attribute('objectType');
            if ($value_objectType == '' || $value_objectType == 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification') {
                $value_objectType = "Classification";
            }
            $value_classificationNode = $classification_node->get_attribute('classificationNode');
            $value_classificationScheme = $classification_node->get_attribute('classificationScheme');
            $value_nodeRepresentation = $classification_node->get_attribute('nodeRepresentation');
            if ($value_nodeRepresentation == '' && $value_classificationNode == 'urn:uuid:d9d542f3-6cc4-48b6-8870-ea235fbc94c2') {
                ##### VALORE DI DEFAULT CASO DI CLASSIFICATION
                ##### NON FIGLIE DI EXTRINSICOBJECT E/O REGISTRYPACKAGE
                //$value_nodeRepresentation = "NULL";
                $value_nodeRepresentation = $RegistryPackage_id_array['nodeRepresentation'];
            }
            if ($value_classificationNode == '') {
                $queryForName_value = "SELECT Name_value FROM ClassificationScheme WHERE ClassificationScheme.id = '{$value_classificationScheme}'";
                $risName_value = query_select2($queryForName_value, $connessione);
                writeSQLQuery($risName_value . ": " . $queryForName_value);
                $name_value = $risName_value[0][0];
                $name_value = substr($name_value, 0, strpos($name_value, '.'));
                $queryForClassificationNode = "SELECT id FROM ClassificationNode WHERE ClassificationNode.code = '{$name_value}'";
                $ris_code = query_select2($queryForClassificationNode, $connessione);
                writeSQLQuery($ris_code . ": " . $queryForClassificationNode);
                $value_classificationNode = $ris_code[0][0];
            }
            if ($value_classificationScheme == '') {
                $queryForClassificationNode = "SELECT code FROM ClassificationNode WHERE ClassificationNode.id = '{$value_classificationNode}'";
                $ris_classificationNode = query_select2($queryForClassificationNode, $connessione);
                writeSQLQuery($ris_classificationNode . ": " . $queryForClassificationNode);
                $code_classificationNode = $ris_classificationNode[0][0];
                #### FOLDER
                if ($code_classificationNode == "XDSFolder") {
                    $queryForClassificationScheme = "SELECT id FROM ClassificationScheme WHERE ClassificationScheme.Name_value = 'XDSFolder.codeList'";
                    $ris_ClassificationScheme = query_select2($queryForClassificationScheme, $connessione);
                    writeSQLQuery($ris_ClassificationScheme . ": " . $queryForClassificationScheme);
                    $value_classificationScheme = $ris_ClassificationScheme[0][0];
                    //$value_nodeRepresentation = "Radiology";
                } else {
                    if ($code_classificationNode == "XDSSubmissionSet") {
                        $queryForClassificationScheme = "SELECT id FROM ClassificationScheme WHERE ClassificationScheme.Name_value = 'XDSSubmissionSet.contentTypeCode'";
                        $ris_ClassificationScheme = query_select2($queryForClassificationScheme, $connessione);
                        writeSQLQuery($ris_ClassificationScheme . ": " . $queryForClassificationScheme);
                        $value_classificationScheme = $ris_ClassificationScheme[0][0];
                    }
                }
                //END OF if($code_classificationNode=="XDSSubmissionSet")
            }
            //END OF if($value_classificationScheme == '')
            $simbolic_value_classifiedObject = $classification_node->get_attribute('classifiedObject');
            $Classification_folder = in_array($simbolic_value_classifiedObject, $simbolic_RegistryPackage_FOL_id_array);
            if (!$Classification_folder) {
                $value_classifiedObject = $RegistryPackage_id_array[$simbolic_value_classifiedObject];
                // 			if($value_classifiedObject == '')
                // 			{
                // 				$value_classifiedObject = "NOT DECLARED";
                // 			}
                $DB_array_classification_attributes['id'] = $value_id;
                $DB_array_classification_attributes['classificationScheme'] = $value_classificationScheme;
                $DB_array_classification_attributes['accessControlPolicy'] = $value_accessControlPolicy;
                $DB_array_classification_attributes['objectType'] = $value_objectType;
                $DB_array_classification_attributes['classifiedObject'] = $value_classifiedObject;
                $DB_array_classification_attributes['classificationNode'] = $value_classificationNode;
                $DB_array_classification_attributes['nodeRepresentation'] = $value_nodeRepresentation;
                if ($value_classificationNode != 'urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd' && $value_classificationNode != 'urn:uuid:d9d542f3-6cc4-48b6-8870-ea235fbc94c2') {
                    ##### SONO PRONTO A SCRIVERE NEL DB
                    $INSERT_INTO_Classification = "INSERT INTO Classification (id,accessControlPolicy,objectType,classificationNode,classificationScheme,classifiedObject,nodeRepresentation) VALUES ('" . trim($DB_array_classification_attributes['id']) . "','" . trim($DB_array_classification_attributes['accessControlPolicy']) . "','" . trim($DB_array_classification_attributes['objectType']) . "','" . trim($DB_array_classification_attributes['classificationNode']) . "','" . trim($DB_array_classification_attributes['classificationScheme']) . "','" . trim($DB_array_classification_attributes['classifiedObject']) . "','" . trim($DB_array_classification_attributes['nodeRepresentation']) . "')";
                    $ris = query_exec2($INSERT_INTO_Classification, $connessione);
                    writeSQLQuery($ris . ": " . $INSERT_INTO_Classification);
                }
            }
            //Fine if(!$Classification_folder)
        }
        //END OF if($dom_ebXML_RegistryObjectList_child_node_tagname=='Classification')
    }
    //END OF for($i=0;$i<count($dom_ebXML_RegistryObjectList_child_nodes);$i++)
}