static function apply($query)
 {
     // check for platform name
     //
     $platformName = Input::get('platform_name');
     if ($platformName != '') {
         $query = $query->where('platform_name', '=', $platformName);
     }
     // check for platform uuid
     //
     $platformUuid = Input::get('platform_uuid');
     if ($platformUuid != '') {
         $platformVersions = PlatformVersion::where('platform_uuid', '=', $platformUuid)->get();
         $query = $query->where(function ($query) use($platformVersions) {
             for ($i = 0; $i < sizeof($platformVersions); $i++) {
                 if ($i == 0) {
                     $query->where('platform_version_uuid', '=', $platformVersions[$i]->platform_version_uuid);
                 } else {
                     $query->orWhere('platform_version_uuid', '=', $platformVersions[$i]->platform_version_uuid);
                 }
             }
         });
     }
     // check for platform version
     //
     $platformVersion = Input::get('platform_version');
     if ($platformVersion == 'latest') {
         $platform = Platform::where('platform_uuid', '=', $platformUuid)->first();
         if ($platform) {
             $latestVersion = $platform->getLatestVersion();
             $query = $query->where('platform_version_uuid', '=', $latestVersion->platform_version_uuid);
         }
     } else {
         if ($platformVersion != '') {
             $query = $query->where('platform_version_uuid', '=', $platformVersion);
         }
     }
     // check for platform version uuid
     //
     $platformVersionUuid = Input::get('platform_version_uuid');
     if ($platformVersionUuid == 'latest') {
         $platform = Platform::where('platform_uuid', '=', $platformUuid)->first();
         if ($platform) {
             $latestVersion = $platform->getLatestVersion();
             $query = $query->where('platform_version_uuid', '=', $latestVersion->platform_version_uuid);
         }
     } else {
         if ($platformVersionUuid != '') {
             $query = $query->where('platform_version_uuid', '=', $platformVersionUuid);
         }
     }
     return $query;
 }
 public function getPlatformAttribute()
 {
     $platformVersion = PlatformVersion::where('platform_version_uuid', '=', $this->platform_version_uuid)->first();
     if ($platformVersion != null) {
         $platform = Platform::where('platform_uuid', '=', $platformVersion->platform_uuid)->first();
     } else {
         $platform = null;
     }
     // get platform info from results
     //
     if (!$platform || !$platformVersion) {
         $assessmentResult = AssessmentResult::where('execution_record_uuid', '=', $this->execution_record_uuid)->first();
     }
     return array('name' => $platform ? $platform->name : ($assessmentResult ? $assessmentResult->platform_name : ''), 'version_string' => $platformVersion ? $platformVersion->version_string : ($assessmentResult ? $assessmentResult->platform_version : ''), 'platform_uuid' => $platform ? $platform->platform_uuid : '', 'platform_version_uuid' => $platformVersion ? $platformVersion->platform_version_uuid : '');
 }
Example #3
0
 public function getDefaultPlatformVersion()
 {
     $platformVersion = NULL;
     // select platform version based upon package type
     //
     switch ($this->package_type) {
         case 'Java Source Code':
         case 'Java Bytecode':
             $platformName = 'Red Hat Enterprise Linux 64-bit';
             $versionString = 'RHEL6.4 64-bit';
             break;
         case 'Python2':
         case 'Python3':
             $platformName = 'Scientific Linux 64-bit';
             $versionString = '6.4 64-bit';
             break;
         case 'Android Java Source Code':
             $platformName = 'Android';
             $versionString = 'Android on Ubuntu 12.04 64-bit';
             break;
     }
     if ($platformName) {
         // find desired platform version
         //
         $platform = Platform::where('name', '=', $platformName)->first();
         if ($platform) {
             // find desired platform version
             //
             $platformVersion = PlatformVersion::where('platform_uuid', '=', $platform->platform_uuid)->where('version_string', '=', $versionString)->first();
         }
     }
     return $platformVersion;
 }
 public function getVersions($platformUuid)
 {
     $platformVersions = PlatformVersion::where('platform_uuid', '=', $platformUuid)->get();
     foreach ($platformVersions as $p) {
         unset($p->create_user);
         unset($p->update_user);
         unset($p->create_date);
         unset($p->update_date);
         unset($p->release_date);
         unset($p->retire_date);
         unset($p->notes);
         unset($p->platform_path);
         unset($p->checksum);
         unset($p->invocation_cmd);
         unset($p->deployment_cmd);
     }
     return $platformVersions;
 }
Example #5
0
 public function getLatestVersion()
 {
     return PlatformVersion::where('platform_uuid', '=', $this->platform_uuid)->orderBy('version_no', 'DESC')->first();
 }
Example #6
0
 public function getPlatformVersionStringAttribute()
 {
     $platformVersion = PlatformVersion::where('platform_version_uuid', '=', $this->platform_version_uuid)->first();
     return $platformVersion != null ? $platformVersion->version_string : 'latest';
 }
 public function deleteIndex($platformVersionUuid)
 {
     $platformVersion = PlatformVersion::where('platform_version_uuid', '=', $platformVersionUuid)->first();
     $platformVersion->delete();
     return $platformVersion;
 }