}
/**
- * Get job records with objects in one of the two flavours: normal or overview.
+ * Get job records with objects.
*
* @param array $criteria SQL criteria to get job list
* @param mixed $limit_val result limit value
* @param int $offset_val result offset value
- * @param string $sort_col sort by selected SQL column (default: JobId)
- * @param string $sort_order sort order:'ASC' or 'DESC' (default: ASC, ascending)
- * @param mixed $object_limit limit for object results
- * @param bool $overview if true, results are displayed in overview mode, otherwise normal mode
* @param string $view job records view (basic, full)
* @return array job record list with objects or empty list if no job found
*/
- public function getJobsObjectsOverview($criteria = array(), $limit_val = null, $offset_val = 0, $sort_col = 'Job.JobId', $sort_order = 'ASC', $object_limit = null, $overview = false, $view = self::JOB_RESULT_VIEW_FULL) {
+ public function getJobsObjectsOverview($criteria = array(), $limit_val = null, $offset_val = 0, $view = self::JOB_RESULT_VIEW_FULL) {
$connection = JobRecord::finder()->getDbConnection();
$connection->setActive(true);
// get all objects
$jlimit = is_int($limit_val) && $limit_val > 0 ? ' LIMIT ' . $limit_val : '';
- $olimit = is_int($object_limit) && $object_limit > 0 ? ' LIMIT ' . $object_limit : '';
$offset = is_int($offset_val) && $offset_val > 0 ? ' OFFSET ' . $offset_val : '';
$job_record = 'Job.*';
$obj_record = 'Object.*';
$jobids = $this->Request->contains('jobids') && $misc->isValidIdsList($this->Request['jobids']) ? $this->Request['jobids'] : '';
$afterjobid = $this->Request->contains('afterjobid') && $misc->isValidInteger($this->Request['afterjobid']) ? $this->Request['afterjobid'] : 0;
$limit = $this->Request->contains('limit') && $misc->isValidInteger($this->Request['limit']) ? (int)$this->Request['limit'] : 0;
- $object_limit = $this->Request->contains('object_limit') && $misc->isValidInteger($this->Request['object_limit']) ? (int)$this->Request['object_limit'] : 0;
$offset = $this->Request->contains('offset') && $misc->isValidInteger($this->Request['offset']) ? (int)$this->Request['offset'] : 0;
$jobstatus = $this->Request->contains('jobstatus') ? $this->Request['jobstatus'] : '';
$level = $this->Request->contains('level') && $misc->isValidJobLevel($this->Request['level']) ? $this->Request['level'] : '';
$realendtime_from = $this->Request->contains('realendtime_from') && $misc->isValidInteger($this->Request['realendtime_from']) ? (int)$this->Request['realendtime_from'] : null;
$realendtime_to = $this->Request->contains('realendtime_to') && $misc->isValidInteger($this->Request['realendtime_to']) ? (int)$this->Request['realendtime_to'] : null;
$age = $this->Request->contains('age') && $misc->isValidInteger($this->Request['age']) ? (int)$this->Request['age'] : null;
- $order_by = $this->Request->contains('order_by') && $misc->isValidColumn($this->Request['order_by']) ? $this->Request['order_by']: 'JobId';
- $order_direction = $this->Request->contains('order_direction') && $misc->isValidOrderDirection($this->Request['order_direction']) ? $this->Request['order_direction']: 'DESC';
- $overview = ($this->Request->contains('overview') && $misc->isValidBooleanTrue($this->Request['overview']));
$view = ($this->Request->contains('view') && $misc->isValidResultView($this->Request['view'])) ? $this->Request['view'] : JobManager::JOB_RESULT_VIEW_FULL;
if (!empty($jobids)) {
$params,
null,
0,
- $order_by,
- $order_direction,
- $object_limit,
- $overview,
$view
);
$this->output = $result;
$this->error = JobError::ERROR_CLIENT_DOES_NOT_EXISTS;
return;
}
- $jr = new \ReflectionClass('Baculum\API\Modules\JobRecord');
- $sort_cols = $jr->getProperties();
- if (strpos($order_by, '.') !== false) {
- $order_by_ex = explode('.', $order_by);
- $order_by = array_shift($order_by_ex);
-
- }
- $order_by_lc = strtolower($order_by);
- $cols_excl = ['client', 'fileset', 'pool'];
- $columns = [];
- foreach ($sort_cols as $cols) {
- $name = $cols->getName();
- // skip columns not existing in the catalog
- if (in_array($name, $cols_excl)) {
- continue;
- }
- $columns[] = $name;
- }
- if (!in_array($order_by_lc, $columns)) {
- $this->output = JobError::MSG_ERROR_INVALID_PROPERTY;
- $this->error = JobError::ERROR_INVALID_PROPERTY;
- return;
- }
-
$params = [];
$params,
$limit,
$offset,
- $order_by,
- $order_direction,
- $object_limit,
- $overview,
$view
);
$this->output = $result;
$this->error = $result->exitcode;
}
}
-}
\ No newline at end of file
+}
{
"$ref": "#/components/parameters/Offset"
},
- {
- "name": "object_limit",
- "in": "query",
- "description": "Object item limit",
- "required": false,
- "schema": {
- "type": "integer"
- }
- },
{
"name": "name",
"in": "query",
"type": "integer"
}
},
- {
- "name": "order_by",
- "in": "query",
- "required": false,
- "description": "Sort by selected job property (default jobid). There can be any job property (jobid, job, clientid ...etc.) except client, fileset and pool.",
- "schema": {
- "type": "string"
- }
- },
- {
- "name": "order_direction",
- "in": "query",
- "required": false,
- "description": "Order direction. It can be 'asc' (ascending order) or 'desc' (descending order - default)",
- "schema": {
- "type": "string",
- "enum": ["asc", "desc"]
- }
- },
- {
- "name": "overview",
- "in": "query",
- "required": false,
- "description": "If set, it puts jobs (and objects) in job status groups (successful, unsuccessful, running, all). NOTE: Offset and limit parameters do not apply to overview counts.",
- "schema": {
- "type": "boolean"
- }
- },
{
"name": "view",
"in": "query",