src/snac/server/database/DBUtil.php
/**
     * Populate Mainenance History
     *
     * Populates the Maintenance History of the given $cObj with the published version updates and adds
     * the original maintenance stataus if the CPF was ingested.
     *
     * @param integer[] $vhInfo associative list with keys 'version' and 'ic_id'.
     * @param \snac\data\Constellation $cObj Constellation passed by reference, and changed in place
     */
Populate Mainenance History
Populates the Maintenance History of the given $cObj with the published version updates and adds
the original maintenance stataus if the CPF was ingested.

@param integer[] $vhInfo associative list with keys 'version' and 'ic_id'.
@param \snac\data\Constellation $cObj Constellation passed by reference, and changed in place
Populate Mainenance History Populates the Maintenance History of the given $cObj with the published version updates and adds the original maintenance stataus if the CPF was ingested . @param integer [] $vhInfo associative list with keys ' version ' and ' ic_id ' . @param \ snac \ data \ Constellation $cObj Constellation passed by reference and changed in place
public function populateMaintenanceInformation($vhInfo, &$cObj) {
        $searchResult = $this->searchVocabulary("event_type", "revised");
        if (count($searchResult) != 1) {
            return; 
        }
        $revisedTerm = $searchResult[0];
        $searchResult = $this->searchVocabulary("agent_type", "human");
        if (count($searchResult) != 1) {
            return; 
        }
        $humanTerm = $searchResult[0];
        $searchResult = $this->searchVocabulary("agent_type", "machine");
        if (count($searchResult) != 1) {
            return; 
        }
        $machineTerm = $searchResult[0];
        $history = $this->sql->selectVersionHistory($vhInfo);
        foreach ($history as $event) {
            if ($event["status"] == 'ingest cpf') {
                $preSnac = json_decode($event["note"], true);
                $this->logger->addDebug("Got the following pre-snac history", array($preSnac));
                if (isset($preSnac["maintenanceEvents"])) {
                    foreach ($preSnac["maintenanceEvents"] as $oldEvent) {
                        $cObj->addMaintenanceEvent(new \snac\data\MaintenanceEvent($oldEvent));
                    }
                }
                $newEvent = new \snac\data\MaintenanceEvent();
                $newEvent->setEventDateTime($event["update_date"]);
                $newEvent->setStandardDateTime($event["update_date"]);
                $newEvent->setAgentType($machineTerm);
                $newEvent->setAgent("SNAC EAC-CPF Parser");
                $newEvent->setEventDescription("Bulk ingest into SNAC Database");
                $newEvent->setEventType($revisedTerm);
                $cObj->addMaintenanceEvent($newEvent);
            } else {
                $newEvent = new \snac\data\MaintenanceEvent();
                $newEvent->setEventDateTime($event["update_date"]);
                $newEvent->setStandardDateTime($event["update_date"]);
                $newEvent->setAgentType($humanTerm);
                $newEvent->setAgent($event["fullname"] . " (".$event["username"].")");
                $newEvent->setEventDescription($event["note"]);
                $newEvent->setEventType($revisedTerm);
                $cObj->addMaintenanceEvent($newEvent);
            }
        }
    }
public function populateMaintenanceInformation ( $ vhInfo , & $ cObj ) { $ searchResult = $ this -> searchVocabulary ( " event_type " , " revised " ) ; if ( count ( $ searchResult ) != 1 ) { return ; } $ revisedTerm = $ searchResult [ 0 ] ; $ searchResult = $ this -> searchVocabulary ( " agent_type " , " human " ) ; if ( count ( $ searchResult ) != 1 ) { return ; } $ humanTerm = $ searchResult [ 0 ] ; $ searchResult = $ this -> searchVocabulary ( " agent_type " , " machine " ) ; if ( count ( $ searchResult ) != 1 ) { return ; } $ machineTerm = $ searchResult [ 0 ] ; $ history = $ this -> sql -> selectVersionHistory ( $ vhInfo ) ; foreach ( $ history as $ event ) { if ( $ event [ " status " ] == 'ingest cpf' ) { $ preSnac = json_decode ( $ event [ " note " ] , true ) ; $ this -> logger -> addDebug ( " Got the following pre-snac history " , array ( $ preSnac ) ) ; if ( isset ( $ preSnac [ " maintenanceEvents " ] ) ) { foreach ( $ preSnac [ " maintenanceEvents " ] as $ oldEvent ) { $ cObj -> addMaintenanceEvent ( new \ snac \ data \ MaintenanceEvent ( $ oldEvent ) ) ; } } $ newEvent = new \ snac \ data \ MaintenanceEvent ( ) ; $ newEvent -> setEventDateTime ( $ event [ " update_date " ] ) ; $ newEvent -> setStandardDateTime ( $ event [ " update_date " ] ) ; $ newEvent -> setAgentType ( $ machineTerm ) ; $ newEvent -> setAgent ( " SNAC EAC-CPF Parser " ) ; $ newEvent -> setEventDescription ( " Bulk ingest into SNAC Database " ) ; $ newEvent -> setEventType ( $ revisedTerm ) ; $ cObj -> addMaintenanceEvent ( $ newEvent ) ; } else { $ newEvent = new \ snac \ data \ MaintenanceEvent ( ) ; $ newEvent -> setEventDateTime ( $ event [ " update_date " ] ) ; $ newEvent -> setStandardDateTime ( $ event [ " update_date " ] ) ; $ newEvent -> setAgentType ( $ humanTerm ) ; $ newEvent -> setAgent ( $ event [ " fullname " ] . "  ( " . $ event [ " username " ] . " ) " ) ; $ newEvent -> setEventDescription ( $ event [ " note " ] ) ; $ newEvent -> setEventType ( $ revisedTerm ) ; $ cObj -> addMaintenanceEvent ( $ newEvent ) ; } } }
Populate Mainenance History
 Populates the Maintenance History of the given $cObj with the published version updates and adds
 the original maintenance stataus if the CPF was ingested.
Populate Mainenance History Populates the Maintenance History of the given $cObj with the published version updates and adds the original maintenance stataus if the CPF was ingested .
// Need some terms // could not work with the vocabulary to put in maintenance information // could not work with the vocabulary to put in maintenance information // could not work with the vocabulary to put in maintenance information // Fill in the Maintenance History Events // If the event was an ingest, then grab any pre-snac history and add it to the Constellation, // then create an event in the constellation detailing the ingest step by the parser // Put all the previous snac information in // Put in the ingest record from our database // If it was any other kind of revision, then just state which user made the change