src/snac/server/ServerExecutor.php
/**
     * Read Constellation From Database
     *
     * Asks the Constellation Store (DBUtil) for the constellation requested, and returns it if it exists.
     *
     * If given a constellationid, it reads the constellation from the database.  If trying to read a constellation
     * without a published version, an exception is thrown.
     *
     * @param string[] $input Input array from the Server object
     * @param boolean $includeMaintenanceHistory optional True will include maintenance history, false (default) will not
     * @param boolean $flags optional Flags to set for the read.  If left at 0, the full constellation will be read.
     * @throws \snac\exceptions\SNACInputException
     * @return null|\snac\data\Constellation[] A list of constellation objects (or null)
     */
Read Constellation From Database
Asks the Constellation Store (DBUtil) for the constellation requested, and returns it if it exists.

If given a constellationid, it reads the constellation from the database.  If trying to read a constellation
without a published version, an exception is thrown.

@param string[] $input Input array from the Server object
@param boolean $includeMaintenanceHistory optional True will include maintenance history, false (default) will not
@param boolean $flags optional Flags to set for the read.  If left at 0, the full constellation will be read.
Read Constellation From Database Asks the Constellation Store ( DBUtil ) for the constellation requested and returns it if it exists . If given a constellationid it reads the constellation from the database . If trying to read a constellation without a published version an exception is thrown . @param string [] $input Input array from the Server object @param boolean $includeMaintenanceHistory optional True will include maintenance history false ( default ) will not @param boolean $flags optional Flags to set for the read . If left at 0 the full constellation will be read .
public function readConstellationFromDatabase(&$input,  $includeMaintenanceHistory=false, $flags = 0) {
        $constellation = null;
        $readFlags = \snac\server\database\DBUtil::$FULL_CONSTELLATION;
        if ($flags !== 0)
            $readFlags = $flags;
        if ($includeMaintenanceHistory) {
            $readFlags = $readFlags | \snac\server\database\DBUtil::$READ_MAINTENANCE_INFORMATION;
        }
        $this->logger->addDebug("Getting the current ICIDs for the requested constellation");
        $constellations = array();
        $icids = array();
        if (isset($input["arkid"])) {
            $icids = $this->cStore->getCurrentIDsForARK($input["arkid"]);
            if (empty($icids)) {
                throw new \snac\exceptions\SNACInputException("Constellation with ark " .
                        $input["arkid"] . " does not have a published version.", 404);
            }
        } else if (isset($input["constellationid"])) {
            if (isset($input["version"])) {
                $this->logger->addDebug("Reading specific constellation from the database, flags=$readFlags");
                $constellation = $this->cStore->readConstellation(
                        $input["constellationid"],
                        $input["version"],
                        $readFlags);
                if ($constellation === false) {
                    throw new \snac\exceptions\SNACInputException("Constellation with id " .
                            $input["constellationid"] . " does not have version" .
                            $input["version"] . ".", 404);
                }
                $this->logger->addDebug("Finished reading constellation from the database");
                return array($constellation);
            }
            $icids = $this->cStore->getCurrentIDsForID($input["constellationid"]);
            if (empty($icids)) {
                throw new \snac\exceptions\SNACInputException("Constellation with id " .
                        $input["constellationid"] . " does not have a published version.", 404);
            }
        } else if (isset($input["sameas"])) {
            $icids = $this->cStore->getCurrentIDsForOtherID($input["sameas"]);
            if (empty($icids)) {
                throw new \snac\exceptions\SNACInputException("Constellation with sameas ID " .
                        $input["sameas"] . " does not have a published version.", 404);
            }
        }
        $this->logger->addDebug("Reading constellation(s) from the database, flags=$readFlags");
        foreach ($icids as $icid) {
            $constellation = $this->cStore->readPublishedConstellationByID($icid, $readFlags);
            if ($constellation !== false) {
                array_push($constellations, $constellation);
            }
        }
        if (count($constellations) == 0) {
            throw new \snac\exceptions\SNACInputException("Constellation does not exist.", 404);
        }
        $this->logger->addDebug("Finished reading constellation from the database");
        return $constellations;
    }
public function readConstellationFromDatabase ( & $ input , $ includeMaintenanceHistory = false , $ flags = 0 ) { $ constellation = null ; $ readFlags = \ snac \ server \ database \ DBUtil :: $ FULL_CONSTELLATION ; if ( $ flags !== 0 ) $ readFlags = $ flags ; if ( $ includeMaintenanceHistory ) { $ readFlags = $ readFlags | \ snac \ server \ database \ DBUtil :: $ READ_MAINTENANCE_INFORMATION ; } $ this -> logger -> addDebug ( " Getting the current ICIDs for the requested constellation " ) ; $ constellations = array ( ) ; $ icids = array ( ) ; if ( isset ( $ input [ " arkid " ] ) ) { $ icids = $ this -> cStore -> getCurrentIDsForARK ( $ input [ " arkid " ] ) ; if ( empty ( $ icids ) ) { throw new \ snac \ exceptions \ SNACInputException ( " Constellation with ark  " . $ input [ " arkid " ] . "  does not have a published version. " , 404 ) ; } } else if ( isset ( $ input [ " constellationid " ] ) ) { if ( isset ( $ input [ " version " ] ) ) { $ this -> logger -> addDebug ( " Reading specific constellation from the database, flags= $ readFlags " ) ; $ constellation = $ this -> cStore -> readConstellation ( $ input [ " constellationid " ] , $ input [ " version " ] , $ readFlags ) ; if ( $ constellation === false ) { throw new \ snac \ exceptions \ SNACInputException ( " Constellation with id  " . $ input [ " constellationid " ] . "  does not have version " . $ input [ " version " ] . " . " , 404 ) ; } $ this -> logger -> addDebug ( " Finished reading constellation from the database " ) ; return array ( $ constellation ) ; } $ icids = $ this -> cStore -> getCurrentIDsForID ( $ input [ " constellationid " ] ) ; if ( empty ( $ icids ) ) { throw new \ snac \ exceptions \ SNACInputException ( " Constellation with id  " . $ input [ " constellationid " ] . "  does not have a published version. " , 404 ) ; } } else if ( isset ( $ input [ " sameas " ] ) ) { $ icids = $ this -> cStore -> getCurrentIDsForOtherID ( $ input [ " sameas " ] ) ; if ( empty ( $ icids ) ) { throw new \ snac \ exceptions \ SNACInputException ( " Constellation with sameas ID  " . $ input [ " sameas " ] . "  does not have a published version. " , 404 ) ; } } $ this -> logger -> addDebug ( " Reading constellation(s) from the database, flags= $ readFlags " ) ; foreach ( $ icids as $ icid ) { $ constellation = $ this -> cStore -> readPublishedConstellationByID ( $ icid , $ readFlags ) ; if ( $ constellation !== false ) { array_push ( $ constellations , $ constellation ) ; } } if ( count ( $ constellations ) == 0 ) { throw new \ snac \ exceptions \ SNACInputException ( " Constellation does not exist. " , 404 ) ; } $ this -> logger -> addDebug ( " Finished reading constellation from the database " ) ; return $ constellations ; }
Read Constellation From Database
 Asks the Constellation Store (DBUtil) for the constellation requested, and returns it if it exists.
Read Constellation From Database Asks the Constellation Store ( DBUtil ) for the constellation requested and returns it if it exists .
// get icids for the given ark id // This means that the Constellation doesn't have a published version! // if asking for a specific version, then just try to read this // id and version number. // This means that the Constellation doesn't have a published version! // get icids for the given ark id // This means that the Constellation doesn't have a published version! // If we have gotten here, we have a list of icids to read.  It is probably just one, // but may be multiple.