Ejemplo n.º 1
0
 /**
  * @covers AppSolr::synchronizePendingApplications
  *
  * @depends testApplicationChangedUpdateSolrQueue
  */
 public function testSynchronizePendingApplications()
 {
     //count number of indexed applications
     $count = $this->object->getCountApplicationsSearchIndex();
     print "Total applications:" . $count;
     //delete application marked in previous test
     $this->object->synchronizePendingApplications();
     $count2 = $this->object->getCountApplicationsSearchIndex();
     print "Total applications deleted record:" . $count2;
     $this->assertEquals($count, $count2 + 1, 'Error synchronizing applications in search index');
     //leave index as in the beginning
     $this->object->reindexAllApplications();
     $count3 = $this->object->getCountApplicationsSearchIndex();
     $this->assertEquals($count, $count3, 'Error restoring deleted application in search index');
 }
Ejemplo n.º 2
0
    /**

     * Get case list

     *

     * @param string $userId

     * @return $result will return an object

     */

    public function caseList($userUid)

    {

        try {

            $solrEnabled = 0;



            if (($solrEnv = System::solrEnv()) !== false) {

                G::LoadClass("AppSolr");



                $appSolr = new AppSolr(

                    $solrEnv["solr_enabled"],

                    $solrEnv["solr_host"],

                    $solrEnv["solr_instance"]

                );



                if ($appSolr->isSolrEnabled() && $solrEnv["solr_enabled"] == true) {

                    //Check if there are missing records to reindex and reindex them

                    $appSolr->synchronizePendingApplications();



                    $solrEnabled = 1;

                }

            }



            if ($solrEnabled == 1) {

                try {

                    G::LoadClass("searchIndex");



                    $arrayData = array();



                    $delegationIndexes = array();

                    $columsToInclude = array("APP_UID");

                    $solrSearchText = null;



                    //Todo

                    $solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:TO_DO AND APP_ASSIGNED_USERS:" . $userUid . ")";

                    $delegationIndexes[] = "APP_ASSIGNED_USER_DEL_INDEX_" . $userUid . "_txt";



                    //Draft

                    $solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:DRAFT AND APP_DRAFT_USER:"******")";

                    //Index is allways 1



                    $solrSearchText = "($solrSearchText)";



                    //Add del_index dynamic fields to list of resulting columns

                    $columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);



                    $solrRequestData = Entity_SolrRequestData::createForRequestPagination(

                        array(

                            "workspace"  => $solrEnv["solr_instance"],

                            "startAfter" => 0,

                            "pageSize"   => 1000,

                            "searchText" => $solrSearchText,

                            "numSortingCols" => 1,

                            "sortCols" => array("APP_NUMBER"),

                            "sortDir"  => array(strtolower("DESC")),

                            "includeCols"  => $columsToIncludeFinal,

                            "resultFormat" => "json"

                        )

                    );



                    //Use search index to return list of cases

                    $searchIndex = new BpmnEngine_Services_SearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);



                    //Execute query

                    $solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);



                    //$rows = array();



                    //Number of found records

                    //$numRecTotal = $solrQueryResult->iTotalDisplayRecords;



                    //print_r($solrQueryResult->aaData); exit(0);



                    //Get the missing data from database

                    $arrayApplicationUid = array();



                    foreach ($solrQueryResult->aaData as $i => $data) {

                        $arrayApplicationUid[] = $data["APP_UID"];

                    }



                    $aaappsDBData = $appSolr->getListApplicationDelegationData($arrayApplicationUid);



                    foreach ($solrQueryResult->aaData as $i => $data) {

                        //Initialize array

                        $delIndexes = array(); //Store all the delegation indexes



                        //Complete empty values

                        $applicationUid = $data["APP_UID"]; //APP_UID



                        //Get all the indexes returned by Solr as columns

                        for($i = count($columsToInclude); $i <= count($data) - 1; $i++) {

                            if (is_array($data[$columsToIncludeFinal[$i]])) {

                                foreach ($data[$columsToIncludeFinal[$i]] as $delIndex) {

                                    $delIndexes[] = $delIndex;

                                }

                            }

                        }



                        //Verify if the delindex is an array

                        //if is not check different types of repositories

                        //the delegation index must always be defined.

                        if (count($delIndexes) == 0) {

                            ////if is draft

                            //if ($action == "draft") {

                                $delIndexes[] = 1; // the first default index

                            //} else {

                            //    //error an index must always be defined

                            //    print date("Y-m-d H:i:s:u") . " Delegation not defined\n";

                            //}

                        }



                        //Remove duplicated

                        $delIndexes = array_unique($delIndexes);



                        //Get records

                        foreach ($delIndexes as $delIndex) {

                            $aRow = array();



                            //Copy result values to new row from Solr server

                            $aRow["APP_UID"] = $data["APP_UID"];



                            //Get delegation data from DB

                            //Filter data from db

                            $indexes = $appSolr->aaSearchRecords($aaappsDBData, array(

                                "APP_UID" => $applicationUid,

                                "DEL_INDEX" => $delIndex

                            ));



                            foreach ($indexes as $index) {

                                $row = $aaappsDBData[$index];

                            }



                            if(!isset($row))

                            {

                                //$fh = fopen("SolrAppWithoutDelIndex.txt", "a") or die("can't open file to store Solr search time.");

                                //fwrite($fh, sprintf("Solr AppUid: %s DelIndex: %s not found.\r\n", $applicationUid, $delIndex));

                                //fclose($fh);

                                continue;

                            }



                            $aRow["APP_NUMBER"] = $row["APP_NUMBER"];

                            $aRow["APP_STATUS"] = $row["APP_STATUS"];

                            $aRow["PRO_UID"]    = $row["PRO_UID"];

                            $aRow["DEL_INDEX"]  = $row["DEL_INDEX"];



                            //$rows[] = $aRow;



                            $arrayData[] = array(

                                "guid" => $aRow["APP_UID"],

                                "name" => $aRow["APP_NUMBER"],

                                "status" => $aRow["APP_STATUS"],

                                "delIndex" => $aRow["DEL_INDEX"],

                                "processId" => $aRow["PRO_UID"]

                            );

                        }

                    }



                    return $arrayData;

                } catch (InvalidIndexSearchTextException $e) {

                    $arrayData = array();



                    $arrayData[] = array (

                        "guid" => $e->getMessage(),

                        "name" => $e->getMessage(),

                        "status" => $e->getMessage(),

                        "delIndex" => $e->getMessage(),

                        "processId" => $e->getMessage()

                    );



                    return $arrayData;

                }

            } else {

                $arrayData = array();



                $criteria = new Criteria("workflow");



                $criteria->addSelectColumn(AppCacheViewPeer::APP_UID);

                $criteria->addSelectColumn(AppCacheViewPeer::DEL_INDEX);

                $criteria->addSelectColumn(AppCacheViewPeer::APP_NUMBER);

                $criteria->addSelectColumn(AppCacheViewPeer::APP_STATUS);

                $criteria->addSelectColumn(AppCacheViewPeer::PRO_UID);



                $criteria->add(AppCacheViewPeer::USR_UID, $userUid);



                $criteria->add(

                    //ToDo - getToDo()

                    $criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "TO_DO", CRITERIA::EQUAL)->addAnd(

                    $criteria->getNewCriterion(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL))->addAnd(

                    $criteria->getNewCriterion(AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(

                    $criteria->getNewCriterion(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))

                )->addOr(

                    //Draft - getDraft()

                    $criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "DRAFT", CRITERIA::EQUAL)->addAnd(

                    $criteria->getNewCriterion(AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(

                    $criteria->getNewCriterion(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))

                );



                $criteria->addDescendingOrderByColumn(AppCacheViewPeer::APP_NUMBER);



                $rsCriteria = AppCacheViewPeer::doSelectRS($criteria);

                $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);



                while ($rsCriteria->next()) {

                    $row = $rsCriteria->getRow();



                    $arrayData[] = array(

                        "guid" => $row["APP_UID"],

                        "name" => $row["APP_NUMBER"],

                        "status" => $row["APP_STATUS"],

                        "delIndex" => $row["DEL_INDEX"],

                        "processId" => $row["PRO_UID"]

                    );

                }



                return $arrayData;

            }

        } catch (Exception $e) {

            $arrayData = array();



            $arrayData[] = array (

                "guid" => $e->getMessage(),

                "name" => $e->getMessage(),

                "status" => $e->getMessage(),

                "delIndex" => $e->getMessage(),

                "processId" => $e->getMessage()

            );



            return $arrayData;

        }

    }
Ejemplo n.º 3
0
function processWorkspace()
{
    global $sLastExecution;
    global $ScriptAction;
    global $SkipRecords;
    global $TrunkSize;
    global $appUid;
    try {
        if (($solrConf = System::solrEnv(SYS_SYS)) !== false) {
            G::LoadClass('AppSolr');
            print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
            print "solr_enabled: " . $solrConf['solr_enabled'] . "\n";
            print "solr_host: " . $solrConf['solr_host'] . "\n";
            print "solr_instance: " . $solrConf['solr_instance'] . "\n";
            $oAppSolr = new AppSolr($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
            if ($ScriptAction == "reindexall") {
                $oAppSolr->reindexAllApplications($SkipRecords, $TrunkSize);
            }
            if ($ScriptAction == "reindexmissing") {
                $oAppSolr->synchronizePendingApplications();
            }
            if ($ScriptAction == "optimizeindex") {
                $oAppSolr->optimizeSearchIndex();
            }
            if ($ScriptAction == "reindexone") {
                if ($appUid == "") {
                    print "Missing -appuid parameter. please complete it with this option.\n";
                }
                $oAppSolr->updateApplicationSearchIndex($appUid);
            }
        } else {
            print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
        }
    } catch (Exception $oError) {
        saveLog("main", "error", "Error processing workspace : " . $oError->getMessage() . "\n");
    }
}
Ejemplo n.º 4
0
function processWorkspace()
{
    global $sLastExecution;
    global $ScriptAction;
    try {
        if (($solrConf = System::solrEnv(SYS_SYS)) !== false) {
            G::LoadClass('AppSolr');
            print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
            print "solr_enabled: " . $solrConf['solr_enabled'] . "\n";
            print "solr_host: " . $solrConf['solr_host'] . "\n";
            print "solr_instance: " . $solrConf['solr_instance'] . "\n";
            $oAppSolr = new AppSolr($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
            if ($ScriptAction == "reindexall") {
                $oAppSolr->reindexAllApplications();
            }
            if ($ScriptAction == "reindexmissing") {
                $oAppSolr->synchronizePendingApplications();
            }
        } else {
            print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
        }
    } catch (Exception $oError) {
        saveLog("main", "error", "Error processing workspace : " . $oError->getMessage() . "\n");
    }
}
Ejemplo n.º 5
0
    public function getAppsData (
        $type,
        $start = null,
        $limit = null,
        $user = null,
        $filter = null,
        $search = null,
        $process = null,
        $status = null,
        $dateFrom = null,
        $dateTo = null,
        $callback = null,
        $dir = null,
        $sort = "APP_CACHE_VIEW.APP_NUMBER",
        $category = null)
    {
        require_once ("classes/model/AppNotes.php");

        $appNotes = new AppNotes();

        $start = empty( $start ) ? $this->appListStart : $start;
        $limit = empty( $limit ) ? $this->appListLimit : $limit;

        $notesStart = 0;
        $notesLimit = 4;
        switch ($user) {
            case 'CURRENT_USER':
                $user = $this->userID;
                break;
            case 'ALL':
                $user = null;
                break;
            case null:
                $user = $this->userID;
                break;
            default:
                //$user = $this->userID;
                break;
        }

        $solrEnabled = false;

        if ((
            $type == "todo" || $type == "draft" || $type == "paused" || $type == "sent" ||
            $type == "selfservice" || $type == "unassigned" || $type == "search"
        ) &&
        (($solrConf = System::solrEnv()) !== false)
        ) {
            G::LoadClass("AppSolr");

            $ApplicationSolrIndex = new AppSolr(
                $solrConf["solr_enabled"],
                $solrConf["solr_host"],
                $solrConf["solr_instance"]
            );

            if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) {
                //Check if there are missing records to reindex and reindex them
                $ApplicationSolrIndex->synchronizePendingApplications();
                $solrEnabled = true;
            } else{
                $solrEnabled = false;
            }
        }

        if ($solrEnabled) {
            $cases = $ApplicationSolrIndex->getAppGridData(
                $user,
                $start,
                $limit,
                $type,
                $filter,
                $search,
                $process,
                $status,
                '',
                $dateFrom,
                $dateTo,
                $callback,
                $dir,
                $sort,
                $category
            );
        } else {
            G::LoadClass( 'applications' );

            $apps = new Applications();

            $cases = $apps->getAll(
                $user,
                $start,
                $limit,
                $type,
                $filter,
                $search,
                $process,
                $status,
                '',
                $dateFrom,
                $dateTo,
                $callback,
                $dir,
                $sort,
                $category,
                false
            );
        }

        // formating & complitting apps data with 'Notes'
        foreach ($cases['data'] as $i => $row) {
            // Formatting
            $appTitle = str_replace( '#', '', $row['APP_TITLE'] );

            if (is_numeric( $appTitle )) {
                $cases['data'][$i]['APP_TITLE'] = G::LoadTranslation( 'ID_CASE' ) . ' ' . $appTitle;
            }

            if (isset( $row['DEL_DELEGATE_DATE'] )) {
                G::LoadClass( "configuration" );
                $conf = new Configurations();
                $generalConfCasesList = $conf->getConfiguration( 'ENVIRONMENT_SETTINGS', '' );
                $cases['data'][$i]['DEL_DELEGATE_DATE'] = '';
                if (defined('SYS_SYS')) {
                    if (isset( $generalConfCasesList['casesListDateFormat'] ) && ! empty( $generalConfCasesList['casesListDateFormat'] )) {
                        $cases['data'][$i]['DEL_DELEGATE_DATE'] = $conf->getSystemDate($row['DEL_DELEGATE_DATE'], 'casesListDateFormat');
                    }
                }
                if ($cases['data'][$i]['DEL_DELEGATE_DATE'] == '') {
                    $cases['data'][$i]['DEL_DELEGATE_DATE'] = $conf->getSystemDate($row['DEL_DELEGATE_DATE']);
                }
            }
            if (isset( $row['APP_DEL_PREVIOUS_USER'] )) {
                $cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords( $row['APP_DEL_PREVIOUS_USER'] );
            }
            // Completting with Notes
            $notes = $appNotes->getNotesList( $row['APP_UID'], '', $notesStart, $notesLimit );
            $notes = $notes['array'];

            $cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount'];
            $cases['data'][$i]['NOTES_LIST'] = $notes['notes'];
        }
        return $cases;
    }
Ejemplo n.º 6
0
        $action == "todo" || $action == "draft" || $action == "paused" || $action == "sent" ||
        $action == "selfservice" || $action == "unassigned" || $action == "search"
        ) &&
        (($solrConf = System::solrEnv()) !== false)
    ) {
        G::LoadClass("AppSolr");

        $ApplicationSolrIndex = new AppSolr(
            $solrConf["solr_enabled"],
            $solrConf["solr_host"],
            $solrConf["solr_instance"]
        );

        if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) {
            //Check if there are missing records to reindex and reindex them
            $ApplicationSolrIndex->synchronizePendingApplications();
            $solrEnabled = true;
        } else{
            $solrEnabled = false;
        }
    }

    if ($solrEnabled) {
        $data = $ApplicationSolrIndex->getAppGridData(
            $userUid,
            $start,
            $limit,
            $action,
            $filter,
            $search,
            $process,
Ejemplo n.º 7
0
    /**
     * Get data of a Case
     *
     * @param string $applicationUid Unique id of Case
     * @param string $userUid Unique id of User
     *
     * return array Return an array with data of Case Info
     */
    public function getCaseInfo($applicationUid, $userUid)
    {
        try {
            $solrEnabled = 0;
            if (($solrEnv = \System::solrEnv()) !== false) {
                \G::LoadClass("AppSolr");
                $appSolr = new \AppSolr(
                    $solrEnv["solr_enabled"],
                    $solrEnv["solr_host"],
                    $solrEnv["solr_instance"]
                );
                if ($appSolr->isSolrEnabled() && $solrEnv["solr_enabled"] == true) {
                    //Check if there are missing records to reindex and reindex them
                    $appSolr->synchronizePendingApplications();
                    $solrEnabled = 1;
                }
            }
            if ($solrEnabled == 1) {
                try {
                    \G::LoadClass("searchIndex");
                    $arrayData = array();
                    $delegationIndexes = array();
                    $columsToInclude = array("APP_UID");
                    $solrSearchText = null;
                    //Todo
                    $solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:TO_DO AND APP_ASSIGNED_USERS:" . $userUid . ")";
                    $delegationIndexes[] = "APP_ASSIGNED_USER_DEL_INDEX_" . $userUid . "_txt";
                    //Draft
                    $solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:DRAFT AND APP_DRAFT_USER:"******")";
                    //Index is allways 1
                    $solrSearchText = "($solrSearchText)";
                    //Add del_index dynamic fields to list of resulting columns
                    $columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
                    $solrRequestData = \Entity_SolrRequestData::createForRequestPagination(
                        array(
                            "workspace"  => $solrEnv["solr_instance"],
                            "startAfter" => 0,
                            "pageSize"   => 1000,
                            "searchText" => $solrSearchText,
                            "numSortingCols" => 1,
                            "sortCols" => array("APP_NUMBER"),
                            "sortDir"  => array(strtolower("DESC")),
                            "includeCols"  => $columsToIncludeFinal,
                            "resultFormat" => "json"
                        )
                    );
                    //Use search index to return list of cases
                    $searchIndex = new \BpmnEngine_Services_SearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
                    //Execute query
                    $solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
                    //Get the missing data from database
                    $arrayApplicationUid = array();
                    foreach ($solrQueryResult->aaData as $i => $data) {
                        $arrayApplicationUid[] = $data["APP_UID"];
                    }
                    $aaappsDBData = $appSolr->getListApplicationDelegationData($arrayApplicationUid);
                    foreach ($solrQueryResult->aaData as $i => $data) {
                        //Initialize array
                        $delIndexes = array(); //Store all the delegation indexes
                        //Complete empty values
                        $applicationUid = $data["APP_UID"]; //APP_UID
                        //Get all the indexes returned by Solr as columns
                        for ($i = count($columsToInclude); $i <= count($data) - 1; $i++) {
                            if (is_array($data[$columsToIncludeFinal[$i]])) {
                                foreach ($data[$columsToIncludeFinal[$i]] as $delIndex) {
                                    $delIndexes[] = $delIndex;
                                }
                            }
                        }
                        //Verify if the delindex is an array
                        //if is not check different types of repositories
                        //the delegation index must always be defined.
                        if (count($delIndexes) == 0) {
                            $delIndexes[] = 1; // the first default index
                        }
                        //Remove duplicated
                        $delIndexes = array_unique($delIndexes);
                        //Get records
                        foreach ($delIndexes as $delIndex) {
                            $aRow = array();
                            //Copy result values to new row from Solr server
                            $aRow["APP_UID"] = $data["APP_UID"];
                            //Get delegation data from DB
                            //Filter data from db
                            $indexes = $appSolr->aaSearchRecords($aaappsDBData, array(
                                "APP_UID" => $applicationUid,
                                "DEL_INDEX" => $delIndex
                            ));
                            foreach ($indexes as $index) {
                                $row = $aaappsDBData[$index];
                            }
                            if (!isset($row)) {
                                continue;
                            }
                            \G::LoadClass('wsBase');
                            $ws = new \wsBase();
                            $fields = $ws->getCaseInfo($applicationUid, $row["DEL_INDEX"]);
                            $array = json_decode(json_encode($fields), true);
                            if ($array ["status_code"] != 0) {
                                throw (new \Exception($array ["message"]));
                            } else {
                                $array['app_uid'] = $array['caseId'];
                                $array['app_number'] = $array['caseNumber'];
                                $array['app_name'] = $array['caseName'];
                                $array['app_status'] = $array['caseStatus'];
                                $array['app_init_usr_uid'] = $array['caseCreatorUser'];
                                $array['app_init_usr_username'] = trim($array['caseCreatorUserName']);
                                $array['pro_uid'] = $array['processId'];
                                $array['pro_name'] = $array['processName'];
                                $array['app_create_date'] = $array['createDate'];
                                $array['app_update_date'] = $array['updateDate'];
                                $array['current_task'] = $array['currentUsers'];
                                for ($i = 0; $i<=count($array['current_task'])-1; $i++) {
                                    $current_task = $array['current_task'][$i];
                                    $current_task['usr_uid'] = $current_task['userId'];
                                    $current_task['usr_name'] = trim($current_task['userName']);
                                    $current_task['tas_uid'] = $current_task['taskId'];
                                    $current_task['tas_title'] = $current_task['taskName'];
                                    $current_task['del_index'] = $current_task['delIndex'];
                                    $current_task['del_thread'] = $current_task['delThread'];
                                    $current_task['del_thread_status'] = $current_task['delThreadStatus'];
                                    unset($current_task['userId']);
                                    unset($current_task['userName']);
                                    unset($current_task['taskId']);
                                    unset($current_task['taskName']);
                                    unset($current_task['delIndex']);
                                    unset($current_task['delThread']);
                                    unset($current_task['delThreadStatus']);
                                    $aCurrent_task[] = $current_task;
                                }
                                unset($array['status_code']);
                                unset($array['message']);
                                unset($array['timestamp']);
                                unset($array['caseParalell']);
                                unset($array['caseId']);
                                unset($array['caseNumber']);
                                unset($array['caseName']);
                                unset($array['caseStatus']);
                                unset($array['caseCreatorUser']);
                                unset($array['caseCreatorUserName']);
                                unset($array['processId']);
                                unset($array['processName']);
                                unset($array['createDate']);
                                unset($array['updateDate']);
                                unset($array['currentUsers']);
                                $current_task = json_decode(json_encode($aCurrent_task), false);
                                $oResponse = json_decode(json_encode($array), false);
                                $oResponse->current_task = $current_task;
                            }
                            //Return
                            return $oResponse;
                        }
                    }
                } catch (\InvalidIndexSearchTextException $e) {
                    $arrayData = array();
                    $arrayData[] = array ("app_uid" => $e->getMessage(),
                                          "app_name" => $e->getMessage(),
                                          "del_index" => $e->getMessage(),
                                          "pro_uid" => $e->getMessage());
                    throw (new \Exception($arrayData));
                }
            } else {
                \G::LoadClass("wsBase");

                //Verify data
                $this->throwExceptionIfNotExistsCase($applicationUid, 0, $this->getFieldNameByFormatFieldName("APP_UID"));

                $criteria = new \Criteria("workflow");

                $criteria->addSelectColumn(\AppDelegationPeer::APP_UID);
                $criteria->add(\AppDelegationPeer::APP_UID, $applicationUid);
                $criteria->add(\AppDelegationPeer::USR_UID, $userUid);

                $rsCriteria = \AppDelegationPeer::doSelectRS($criteria);

                if (!$rsCriteria->next()) {
                    throw new \Exception(\G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
                }

                //Get data
                $ws = new \wsBase();

                $fields = $ws->getCaseInfo($applicationUid, 0);
                $array = json_decode(json_encode($fields), true);

                if ($array ["status_code"] != 0) {
                    throw (new \Exception($array ["message"]));
                } else {
                    $array['app_uid'] = $array['caseId'];
                    $array['app_number'] = $array['caseNumber'];
                    $array['app_name'] = $array['caseName'];
                    $array["app_status"] = $array["caseStatus"];
                    $array['app_init_usr_uid'] = $array['caseCreatorUser'];
                    $array['app_init_usr_username'] = trim($array['caseCreatorUserName']);
                    $array['pro_uid'] = $array['processId'];
                    $array['pro_name'] = $array['processName'];
                    $array['app_create_date'] = $array['createDate'];
                    $array['app_update_date'] = $array['updateDate'];
                    $array['current_task'] = $array['currentUsers'];

                    $aCurrent_task = array();

                    for ($i = 0; $i<=count($array['current_task'])-1; $i++) {
                        $current_task = $array['current_task'][$i];
                        $current_task['usr_uid'] = $current_task['userId'];
                        $current_task['usr_name'] = trim($current_task['userName']);
                        $current_task['tas_uid'] = $current_task['taskId'];
                        $current_task['tas_title'] = $current_task['taskName'];
                        $current_task['del_index'] = $current_task['delIndex'];
                        $current_task['del_thread'] = $current_task['delThread'];
                        $current_task['del_thread_status'] = $current_task['delThreadStatus'];
                        $current_task["del_init_date"] = $current_task["delInitDate"] . "";
                        $current_task["del_task_due_date"] = $current_task["delTaskDueDate"];
                        unset($current_task['userId']);
                        unset($current_task['userName']);
                        unset($current_task['taskId']);
                        unset($current_task['taskName']);
                        unset($current_task['delIndex']);
                        unset($current_task['delThread']);
                        unset($current_task['delThreadStatus']);
                        $aCurrent_task[] = $current_task;
                    }
                    unset($array['status_code']);
                    unset($array['message']);
                    unset($array['timestamp']);
                    unset($array['caseParalell']);
                    unset($array['caseId']);
                    unset($array['caseNumber']);
                    unset($array['caseName']);
                    unset($array['caseStatus']);
                    unset($array['caseCreatorUser']);
                    unset($array['caseCreatorUserName']);
                    unset($array['processId']);
                    unset($array['processName']);
                    unset($array['createDate']);
                    unset($array['updateDate']);
                    unset($array['currentUsers']);
                }
                $current_task = json_decode(json_encode($aCurrent_task), false);
                $oResponse = json_decode(json_encode($array), false);
                $oResponse->current_task = $current_task;
                //Return
                return $oResponse;
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }