/**
 * 
 * 
 * @return be_vse_data
 */
function execute()
{
    $entries = new be_vse_data();
    try {
        $access = "RO";
        include './inc/incWebServiceAPIKeyValidation.php';
        $parameters = collectParameters();
        if (validate($parameters)) {
            $entries = da_vse_data::GetEntries($parameters->app_id, $parameters->optional_label, $parameters->optional_last_limit);
        } else {
            die("Parámetros Inválidos");
        }
    } catch (Exception $ex) {
        die("EXCEPTION " . $ex->getCode());
    }
    return $entries;
}
 public static function GenerateCSV()
 {
     try {
         $app_id = 0;
         //THIS WILL BE OVERRIDEN BY THE INCLUDE
         $account_id = 0;
         //THIS WILL BE OVERRIDEN BY THE INCLUDE
         $access = "RO";
         include './inc/incWebServiceAPIKeyValidation.php';
         $parameters = CSVWebService::collectParameters();
         $parameters->app_id = $app_id;
         $parameters->account_id = $account_id;
         $entries = da_vse_data::GetEntries($parameters->app_id, $parameters->value_label, $parameters->count_limit);
         $csv = CSVWebService::generateCSVContent($entries);
         return $csv;
     } catch (Exception $ex) {
         return $ex;
     }
     return null;
 }
/**
 * 
 * 
 * @return be_vse_data
 */
function execute()
{
    $response = new simpleResponse();
    $entries = null;
    try {
        $access = "RO";
        include './inc/incWebServiceAPIKeyValidation.php';
        $parameters = collectParameters();
        if (validate($parameters)) {
            $entries = da_vse_data::GetEntries($parameters->app_id, $parameters->optional_label, $parameters->optional_last_limit);
            $response->status = "OK";
            $response->message = "SUCCESS";
            $response->data = $entries;
        } else {
            $response->status = "ERROR";
            //die("Parámetros Inválidos");
        }
    } catch (Exception $ex) {
        $response->status = "EXCEPTION";
        $response->message = $ex->getMessage();
        //die("EXCEPTION " . $ex->getCode());
    }
    return $response;
    // $response = new simpleResponse();
    // try {
    //     $account_id = 0;
    //     include './inc/incWebServiceSessionValidation.php';
    //     if ($account_id > 0) {
    //         $apps = da_apps_registry::GetListOfApps($account_id);
    //         $response->status = "OK";
    //         $response->message = "SUCCESS";
    //         $response->data = $apps;
    //     } else {
    //         $response->status = "ERROR";
    //     }
    // } catch (Exception $ex) {
    //     $response->status = "EXCEPTION";
    //     $response->message = $ex->getMessage();
    // }
    // return $response;
}
Exemple #4
0
 private static function testClearEntries($uuid)
 {
     ReportInfo("Testing Clearing Entries");
     ReportInfo("Clearing All");
     $result = da_vse_data::ClearEntries(1, "");
     ReportInfo("Result:");
     print_r($result);
     for ($i = 1; $i <= 10; $i++) {
         $entry = new be_vse_data();
         $entry->app_id = 1;
         $entry->vse_label = "TEST FOR CLEARING_01";
         $entry->vse_value = $i . "OK";
         $entry->vse_type = "ANY";
         $entry->vse_annotations = "Testing for clearing methods";
         $entry->captured_datetime = date("Y-m-d H:i:s");
         da_vse_data::AddEntry($entry);
     }
     for ($i = 1; $i <= 10; $i++) {
         $entry = new be_vse_data();
         $entry->app_id = 1;
         $entry->vse_label = "TEST FOR CLEARING_02";
         $entry->vse_value = $i . "OK";
         $entry->vse_type = "ANY";
         $entry->vse_annotations = "Testing for clearing methods";
         $entry->captured_datetime = date("Y-m-d H:i:s");
         da_vse_data::AddEntry($entry);
     }
     ReportInfo("Getting all entries...");
     $allrecords = da_vse_data::GetEntries(1, '', 0);
     print_r($allrecords);
     ReportInfo("Clearing TEST_FOR_CLEARING_02");
     $check01 = da_vse_data::ClearEntries(1, 'TEST FOR CLEARING_02');
     print_r($check01);
     ReportInfo("Getting all entries again...");
     $allrecords = da_vse_data::GetEntries(1, '', 0);
     print_r($allrecords);
     ReportInfo("Clearing TEST_FOR_CLEARING_01");
     $check02 = da_vse_data::ClearEntries(1, 'TEST FOR CLEARING_01');
     print_r($check02);
     ReportInfo("At this point all should be clear for app 1");
     $allrecords = da_vse_data::GetEntries(1, '', 0);
     print_r($allrecords);
 }
 /**
  * 
  * @param type $app_id
  * @param type $optional_label Use it to clear entries of an specific label for the provided app.
  * @return boolean
  */
 public static function ClearEntries($app_id, $optional_label)
 {
     $sqlCommand = "DELETE FROM vse_data " . " WHERE app_id = ? AND (vse_label = ? OR ? = '') ";
     $paramTypeSpec = "iss";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, $app_id, $optional_label, $optional_label)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $stmt->close();
     $retrievedEntries = da_vse_data::GetEntries($app_id, $optional_label, 0);
     return $retrievedEntries;
 }