Example #1
0
 private static function addVAppliance($researcher, $vo, $vappversion)
 {
     if ($vappversion->isExpired()) {
         return "Virtual appliance version is expired";
     }
     $imagelists = $vappversion->getVappLists();
     if (count($imagelists) === 0) {
         return "No vappliance image instances to include in vo image list";
     }
     $voimglist = self::getDraftVoImageList($researcher, $vo, true);
     if ($voimglist === null) {
         return "Could not retrieve draft VO wide image list";
     }
     //Clearing draft from current vappliance images lists
     $result = self::clearDraftImages($researcher, $vo, $vappversion);
     if ($result !== true) {
         if ($result === false) {
             return "Could not clear draft vo image list for given virtual appliance";
         } else {
             return $result;
         }
     }
     foreach ($imagelists as $imglst) {
         $voimglstimg = new Default_Model_VOWideImageListImage();
         $voimglstimg->vowideImageListID = $voimglist->id;
         $voimglstimg->vapplistid = $imglst->id;
         $voimglstimg->state = "draft";
         $voimglstimg->save();
     }
     return true;
 }
 public function save(Default_Model_VOWideImageListImage $value)
 {
     global $application;
     $data = array();
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getVowideImageListID())) {
         $data['vowide_image_list_id'] = $value->getVowideImageListID();
     }
     if (!isnull($value->getVappListID())) {
         $data['vapplistid'] = $value->getVappListID();
     }
     if (!isnull($value->getGuid())) {
         $data['guid'] = $value->getGuid();
     }
     if (!isnull($value->getState())) {
         $data['state'] = $value->getState();
     }
     $q1 = 'id = ?';
     $q2 = $value->id;
     if (null === ($id = $value->id)) {
         unset($data['id']);
         $value->id = $this->getDbTable()->insert($data);
     } else {
         $s = $this->getDbTable()->getAdapter()->quoteInto($q1, $q2);
         $this->getDbTable()->update($data, $s);
     }
 }