src/snac/server/ServerExecutor.php
/**
     * Delete Constellation
     *
     * Updates the status of the given input's constellation to "deleted."  On successful delete, this method
     * also updates the Elastic Search indices to remove this Constellation, if ES is being used
     * in this install.
     *
     * @param string[] $input Input array from the Server object
     * @throws \Exception
     * @return string[] The response to send to the client
     */
Delete Constellation
Updates the status of the given input's constellation to "deleted."  On successful delete, this method
also updates the Elastic Search indices to remove this Constellation, if ES is being used
in this install.

@param string[] $input Input array from the Server object
@throws \Exception
@return string[] The response to send to the client
Delete Constellation Updates the status of the given input ' s constellation to " deleted . " On successful delete this method also updates the Elastic Search indices to remove this Constellation if ES is being used in this install . @param string [] $input Input array from the Server object @throws \ Exception @return string [] The response to send to the client
public function deleteConstellation(&$input) {
        $response = array();
        try {
            $this->logger->addDebug("Deleting constellation");
            if (isset($input["constellation"])) {
                $constellation = new \snac\data\Constellation($input["constellation"]);
                $current = $this->cStore->readConstellation($constellation->getID(), null, DBUtil::$READ_NRD);
                $info = $this->cStore->readConstellationUserStatus($constellation->getID());
                if ($info === null) {
                    throw new \snac\exceptions\SNACDatabaseException("The current constellation did not have a valid status", 403);
                }
                $currentStatus = $info["status"];
                $currentUserID = $info["userid"];
                $currentNote = $info["note"];
                $inList = false;
                if ($currentUserID == $this->user->getUserID() &&
                    ($currentStatus == 'currently editing' || $currentStatus == 'locked editing')) {
                        $inList = true;
                    }
                $result = false;
                if ($current->getVersion() == $constellation->getVersion() && $inList) {
                    $result = $this->cStore->writeConstellationStatus($this->user, $constellation->getID(),
                                                                        "deleted", "User deleted constellation");
                }
                if (isset($result) && $result !== false) {
                    $this->logger->addDebug("successfully published constellation");
                    $constellation->setVersion($result);
                    $response["constellation"] = $constellation->toArray();
                    $response["result"] = "success";
                    $this->elasticSearch->deleteFromNameIndices($constellation);
                    $this->cStore->deleteFromNameIndex($constellation);
                    $this->neo4J->deleteConstellation($constellation);
                } else {
                    $this->logger->addDebug("could not delete the constellation");
                    $response["result"] = "failure";
                    $response["error"] = "cannot delete an out-of-date copy of the constellation";
                }
            } else {
                $this->logger->addDebug("no constellation given to delete");
                $response["result"] = "failure";
                $response["error"] = "missing constellation information";
            }
        } catch (\Exception $e) {
            $this->logger->addError("deleting constellation threw an exception");
            $response["result"] = "failure";
            throw $e;
        }
        return $response;
    }
public function deleteConstellation ( & $ input ) { $ response = array ( ) ; try { $ this -> logger -> addDebug ( " Deleting constellation " ) ; if ( isset ( $ input [ " constellation " ] ) ) { $ constellation = new \ snac \ data \ Constellation ( $ input [ " constellation " ] ) ; $ current = $ this -> cStore -> readConstellation ( $ constellation -> getID ( ) , null , DBUtil :: $ READ_NRD ) ; $ info = $ this -> cStore -> readConstellationUserStatus ( $ constellation -> getID ( ) ) ; if ( $ info === null ) { throw new \ snac \ exceptions \ SNACDatabaseException ( " The current constellation did not have a valid status " , 403 ) ; } $ currentStatus = $ info [ " status " ] ; $ currentUserID = $ info [ " userid " ] ; $ currentNote = $ info [ " note " ] ; $ inList = false ; if ( $ currentUserID == $ this -> user -> getUserID ( ) && ( $ currentStatus == 'currently editing' || $ currentStatus == 'locked editing' ) ) { $ inList = true ; } $ result = false ; if ( $ current -> getVersion ( ) == $ constellation -> getVersion ( ) && $ inList ) { $ result = $ this -> cStore -> writeConstellationStatus ( $ this -> user , $ constellation -> getID ( ) , " deleted " , " User deleted constellation " ) ; } if ( isset ( $ result ) && $ result !== false ) { $ this -> logger -> addDebug ( " successfully published constellation " ) ; $ constellation -> setVersion ( $ result ) ; $ response [ " constellation " ] = $ constellation -> toArray ( ) ; $ response [ " result " ] = " success " ; $ this -> elasticSearch -> deleteFromNameIndices ( $ constellation ) ; $ this -> cStore -> deleteFromNameIndex ( $ constellation ) ; $ this -> neo4J -> deleteConstellation ( $ constellation ) ; } else { $ this -> logger -> addDebug ( " could not delete the constellation " ) ; $ response [ " result " ] = " failure " ; $ response [ " error " ] = " cannot delete an out-of-date copy of the constellation " ; } } else { $ this -> logger -> addDebug ( " no constellation given to delete " ) ; $ response [ " result " ] = " failure " ; $ response [ " error " ] = " missing constellation information " ; } } catch ( \ Exception $ e ) { $ this -> logger -> addError ( " deleting constellation threw an exception " ) ; $ response [ " result " ] = " failure " ; throw $ e ; } return $ response ; }
Delete Constellation
 Updates the status of the given input's constellation to "deleted."
Delete Constellation Updates the status of the given input ' s constellation to " deleted . "
// Check the status of the constellation.  Make sure the input has the old version number (read the summary) // and then only publish if the user has permission (it was locked to them, etc). // If this constellation is the correct version, and the user was editing it, then delete it // Update the constellation status to deleted // If the update worked, then finish out the delete // Return the passed-in constellation from the user, with the new version number // Delete from Elastic Search Indices // Delete from Postgres Indices // Delete from Neo4J Indices // Since the Constellation still "exists" we should leave it in the DAG table