src/snac/server/ServerExecutor.php
/**
     * Edit Constellation
     *
     * Similar to readConstellation, this method returns a Constellation on the response.  If the client provided
     * an ark id, this constellation is generated by using the EAC-CPF parser.  If the client provided a
     * constellation id, it upgrades the status to "currently editing" and then returns the constellation in the response.
     *
     * @param string[] $input Input array from the Server object
     * @throws \snac\exceptions\SNACPermissionException
     * @return string[] The response to send to the client
     */
Edit Constellation
Similar to readConstellation, this method returns a Constellation on the response.  If the client provided
an ark id, this constellation is generated by using the EAC-CPF parser.  If the client provided a
constellation id, it upgrades the status to "currently editing" and then returns the constellation in the response.

@param string[] $input Input array from the Server object
@throws \snac\exceptions\SNACPermissionException
@return string[] The response to send to the client
Edit Constellation Similar to readConstellation this method returns a Constellation on the response . If the client provided an ark id this constellation is generated by using the EAC - CPF parser . If the client provided a constellation id it upgrades the status to " currently editing " and then returns the constellation in the response . @param string [] $input Input array from the Server object @throws \ snac \ exceptions \ SNACPermissionException @return string [] The response to send to the client
public function editConstellation(&$input) {
        $this->logger->addDebug("Editing Constellation");
        $response = array();
        if (isset($input["arkid"])) {
            throw new \snac\exceptions\SNACInputException("Please provide a Constellation ID for editing.  Arks are not supported.", 400);
        } else if (isset($input["constellationid"])) {
            try {
                $this->logger->addDebug("Reading constellation from the database");
                $cId = $input["constellationid"];
                $info = $this->cStore->readConstellationUserStatus($cId);
                if (!is_array($info)) {
                    throw new \snac\exceptions\SNACInputException("Constellation does not have a current version", 404);
                }
                $status = $info["status"];
                if ($info["userid"] === $this->user->getUserID() && $status === "currently editing") {
                    throw new \snac\exceptions\SNACConcurrentEditException("Constellation currently opened in another window", 403);
                }
                $current = $this->cStore->readConstellation($cId, null, DBUtil::$READ_NRD);
                $inList = false;
                $userList = $this->cStore->listConstellationsWithStatusForUser($this->user, "locked editing");
                foreach ($userList as $item) {
                    if ($item->getID() == $current->getID()) {
                        $inList = true;
                        break;
                    }
                }
                if ( $status == "published" || $inList || ($status == "needs review" && $this->hasPermission("Change Locks"))) {
                    $success = $this->cStore->writeConstellationStatus($this->user, $cId, "currently editing");
                    if ($success === false) {
                        $this->logger->addError("Writing Constellation Status failed", array("user"=>$this->user, "id"=>$cId));
                    }
                    $reviewNote = $this->cStore->readLastReviewStatusForConstellation($cId);
                    if ($reviewNote != null)
                        $response["review_note"] = $reviewNote;
                    $constellation = $this->cStore->readConstellation($cId);
                    $this->logger->addDebug("Finished reading constellation from the database");
                    $response["constellation"] = $constellation->toArray();
                    $this->logger->addDebug("Serialized constellation for output to client");
                } else {
                    throw new \snac\exceptions\SNACPermissionException("Constellation is currently locked to another user.", 403);
                }
            } catch (\Exception $e) {
                throw $e;
            }
        }
        return $response;
    }
public function editConstellation ( & $ input ) { $ this -> logger -> addDebug ( " Editing Constellation " ) ; $ response = array ( ) ; if ( isset ( $ input [ " arkid " ] ) ) { throw new \ snac \ exceptions \ SNACInputException ( " Please provide a Constellation ID for editing.  Arks are not supported. " , 400 ) ; } else if ( isset ( $ input [ " constellationid " ] ) ) { try { $ this -> logger -> addDebug ( " Reading constellation from the database " ) ; $ cId = $ input [ " constellationid " ] ; $ info = $ this -> cStore -> readConstellationUserStatus ( $ cId ) ; if ( ! is_array ( $ info ) ) { throw new \ snac \ exceptions \ SNACInputException ( " Constellation does not have a current version " , 404 ) ; } $ status = $ info [ " status " ] ; if ( $ info [ " userid " ] === $ this -> user -> getUserID ( ) && $ status === " currently editing " ) { throw new \ snac \ exceptions \ SNACConcurrentEditException ( " Constellation currently opened in another window " , 403 ) ; } $ current = $ this -> cStore -> readConstellation ( $ cId , null , DBUtil :: $ READ_NRD ) ; $ inList = false ; $ userList = $ this -> cStore -> listConstellationsWithStatusForUser ( $ this -> user , " locked editing " ) ; foreach ( $ userList as $ item ) { if ( $ item -> getID ( ) == $ current -> getID ( ) ) { $ inList = true ; break ; } } if ( $ status == " published " || $ inList || ( $ status == " needs review " && $ this -> hasPermission ( " Change Locks " ) ) ) { $ success = $ this -> cStore -> writeConstellationStatus ( $ this -> user , $ cId , " currently editing " ) ; if ( $ success === false ) { $ this -> logger -> addError ( " Writing Constellation Status failed " , array ( " user " => $ this -> user , " id " => $ cId ) ) ; } $ reviewNote = $ this -> cStore -> readLastReviewStatusForConstellation ( $ cId ) ; if ( $ reviewNote != null ) $ response [ " review_note " ] = $ reviewNote ; $ constellation = $ this -> cStore -> readConstellation ( $ cId ) ; $ this -> logger -> addDebug ( " Finished reading constellation from the database " ) ; $ response [ " constellation " ] = $ constellation -> toArray ( ) ; $ this -> logger -> addDebug ( " Serialized constellation for output to client " ) ; } else { throw new \ snac \ exceptions \ SNACPermissionException ( " Constellation is currently locked to another user. " , 403 ) ; } } catch ( \ Exception $ e ) { throw $ e ; } } return $ response ; }
Edit Constellation
 Similar to readConstellation, this method returns a Constellation on the response.
Edit Constellation Similar to readConstellation this method returns a Constellation on the response .
// Editing the given ark id by reading querying the current HRT // Editing the given constellation id by reading the database // Read the constellation // Should check the list of constellations for the user and only allow editing a "locked editing" constellation // if that constellation is attached to that user.  So, need to loop through the constellations for that user // Read the current summary // If the current status is published OR the user has that constellation locked editing (checked out to them), // OR the constellation needs review and the user has permission to review (TODO) // then the user is allowed to edit. // Can edit this! // lock the constellation to the user as currently editing // read the constellation into response // Leaving a catch block for logging purposes