Ahenk/opt/ahenk/base/model/Task.py

50 lines
1 KiB
Python
Raw Normal View History

2016-03-02 11:33:48 +02:00
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
2016-03-21 12:02:15 +02:00
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
from base.model.Plugin import Plugin
2016-03-07 17:13:03 +02:00
import json
2016-03-02 11:33:48 +02:00
class Task(object):
"""docstring for Task"""
def __init__(self,message):
2016-03-21 12:02:15 +02:00
self.task = message['task']
2016-03-02 11:33:48 +02:00
2016-03-07 17:13:03 +02:00
@property
2016-03-21 12:02:15 +02:00
def id(self):
return self.task['id']
2016-03-14 10:55:28 +02:00
@property
2016-03-21 12:02:15 +02:00
def create_date(self):
return self.task['createdate']
@property
def modify_date(self):
return self.task['modifydate']
@property
def command_cls_id(self):
return self.task['commandclsid']
@property
def parameter_map(self):
return self.task['parametermap']
@property
def deleted(self):
return self.task['deleted']
@property
def plugin(self):
return Plugin(self.task['plugin'])
def to_string(self):
return str(self.task)
def to_json(self):
return json.load(self.task)