예제 #1
0
 def get(self, task,environment):
   session_id = get_session_id(session, request)
   dao = TaskDAO(session_id)
   cmLoad = dao.task_hindrance_by_name_environment(task,environment)
   dao.close()
   resp = make_response(json_serialize(cmLoad, session_id=session_id), httplib.OK)
   return resp
예제 #2
0
 def get(self, task,environment):
   session_id = get_session_id(session, request)
   dao = TaskDAO(session_id)
   taskLoad = dao.task_load_by_name_environment(task,environment)
   dao.close()
   resp = make_response(json_serialize(taskLoad, session_id=session_id), OK)
   return resp
예제 #3
0
 def get(self, task, environment):
     session_id = get_session_id(session, request)
     dao = TaskDAO(session_id)
     cmLoad = dao.task_hindrance_by_name_environment(task, environment)
     dao.close()
     resp = make_response(json_serialize(cmLoad, session_id=session_id), OK)
     return resp
예제 #4
0
 def get(self, task,environment):
   session_id = get_session_id(session, request)
   dao = TaskDAO(session_id)
   taskScore = dao.task_score_by_name_environment(task,environment)
   dao.close()
   resp = make_response(json_serialize(taskScore, session_id=session_id), httplib.OK)
   return resp
예제 #5
0
 def get(self, task, environment):
     session_id = get_session_id(session, request)
     dao = TaskDAO(session_id)
     taskLoad = dao.task_load_by_name_environment(task, environment)
     dao.close()
     resp = make_response(json_serialize(taskLoad, session_id=session_id),
                          httplib.OK)
     return resp
예제 #6
0
 def get(self, task, environment):
     session_id = get_session_id(session, request)
     dao = TaskDAO(session_id)
     taskScore = dao.task_score_by_name_environment(task, environment)
     dao.close()
     resp = make_response(json_serialize(taskScore, session_id=session_id),
                          OK)
     return resp
예제 #7
0
    def get(self, name):
        session_id = get_session_id(session, request)

        dao = TaskDAO(session_id)
        task = dao.get_task_by_name(name=name)
        dao.close()

        resp = make_response(json_serialize(task, session_id=session_id), OK)
        resp.headers['Content-type'] = 'application/json'
        return resp
예제 #8
0
  def get(self, name):
    session_id = get_session_id(session, request)

    dao = TaskDAO(session_id)
    task = dao.get_task_by_name(name=name)
    dao.close()

    resp = make_response(json_serialize(task, session_id=session_id), httplib.OK)
    resp.headers['Content-type'] = 'application/json'
    return resp
예제 #9
0
  def get(self):
    session_id = get_session_id(session, request)
    constraint_id = request.args.get('constraint_id', -1)

    dao = TaskDAO(session_id)
    tasks = dao.get_tasks(constraint_id=constraint_id)
    dao.close()

    resp = make_response(json_serialize(tasks, session_id=session_id), httplib.OK)
    resp.contenttype = 'application/json'
    return resp
예제 #10
0
    def get(self):
        session_id = get_session_id(session, request)
        constraint_id = request.args.get('constraint_id', -1)

        dao = TaskDAO(session_id)
        tasks = dao.get_tasks(constraint_id=constraint_id)
        dao.close()

        resp = make_response(json_serialize(tasks, session_id=session_id), OK)
        resp.contenttype = 'application/json'
        return resp
예제 #11
0
  def delete(self, name):
    session_id = get_session_id(session, request)

    dao = TaskDAO(session_id)
    dao.delete_task(name=name)
    dao.close()

    resp_dict = {'message': 'Task successfully deleted'}
    resp = make_response(json_serialize(resp_dict), httplib.OK)
    resp.headers['Content-type'] = 'application/json'
    return resp
예제 #12
0
  def post(self):
    session_id = get_session_id(session, request)

    dao = TaskDAO(session_id)
    new_task = dao.from_json(request)
    task_id = dao.add_task(new_task)
    dao.close()

    resp_dict = {'message': 'Task successfully added', 'task_id': task_id}
    resp = make_response(json_serialize(resp_dict), httplib.OK)
    resp.contenttype = 'application/json'
    return resp
예제 #13
0
  def get(self, environment):
    session_id = get_session_id(session, request)
    model_generator = get_model_generator()

    dao = TaskDAO(session_id)
    dot_code = dao.get_task_model(environment)
    dao.close()

    resp = make_response(model_generator.generate(dot_code, model_type='task'), httplib.OK)

    accept_header = request.headers.get('Accept', 'image/svg+xml')
    if accept_header.find('text/plain') > -1:
      resp.headers['Content-type'] = 'text/plain'
    else:
      resp.headers['Content-type'] = 'image/svg+xml'
    return resp
예제 #14
0
  def get(self, mc_name,tc_name):
    session_id = get_session_id(session, request)
    model_generator = get_model_generator()

    dao = TaskDAO(session_id)
    if tc_name == 'all':  tc_name = ''

    dot_code = dao.get_misusability_model(mc_name,tc_name)
    dao.close()

    resp = make_response(model_generator.generate(dot_code, model_type='misusability',renderer='dot'), OK)

    accept_header = request.headers.get('Accept', 'image/svg+xml')
    if accept_header.find('text/plain') > -1:
      resp.headers['Content-type'] = 'text/plain'
    else:
      resp.headers['Content-type'] = 'image/svg+xml'
    return resp
예제 #15
0
  def get(self, environment,task,misusecase):
    session_id = get_session_id(session, request)
    model_generator = get_model_generator()

    dao = TaskDAO(session_id)
    if task == 'all':  task = ''
    if misusecase == 'all': misusecase = ''

    dot_code = dao.get_task_model(environment,task,misusecase)
    dao.close()

    resp = make_response(model_generator.generate(dot_code, model_type='task',renderer='dot'), OK)

    accept_header = request.headers.get('Accept', 'image/svg+xml')
    if accept_header.find('text/plain') > -1:
      resp.headers['Content-type'] = 'text/plain'
    else:
      resp.headers['Content-type'] = 'image/svg+xml'
    return resp
예제 #16
0
    def get(self, mc_name, tc_name):
        session_id = get_session_id(session, request)
        model_generator = get_model_generator()

        dao = TaskDAO(session_id)
        if tc_name == 'all': tc_name = ''

        dot_code = dao.get_misusability_model(mc_name, tc_name)
        dao.close()

        resp = make_response(
            model_generator.generate(dot_code,
                                     model_type='misusability',
                                     renderer='dot'), OK)

        accept_header = request.headers.get('Accept', 'image/svg+xml')
        if accept_header.find('text/plain') > -1:
            resp.headers['Content-type'] = 'text/plain'
        else:
            resp.headers['Content-type'] = 'image/svg+xml'
        return resp
예제 #17
0
    def get(self, environment, task, misusecase):
        session_id = get_session_id(session, request)
        model_generator = get_model_generator()

        dao = TaskDAO(session_id)
        if task == 'all': task = ''
        if misusecase == 'all': misusecase = ''

        dot_code = dao.get_task_model(environment, task, misusecase)
        dao.close()

        resp = make_response(
            model_generator.generate(dot_code,
                                     model_type='task',
                                     renderer='dot'), OK)

        accept_header = request.headers.get('Accept', 'image/svg+xml')
        if accept_header.find('text/plain') > -1:
            resp.headers['Content-type'] = 'text/plain'
        else:
            resp.headers['Content-type'] = 'image/svg+xml'
        return resp
예제 #18
0
    def put(self, name):
        session_id = get_session_id(session, request)

        dao = TaskDAO(session_id)
        req = dao.from_json(request)
        dao.update_task(req, name=name)
        dao.close()

        resp_dict = {'message': 'Task successfully updated'}
        resp = make_response(json_serialize(resp_dict), OK)
        resp.headers['Content-type'] = 'application/json'
        return resp
예제 #19
0
    def delete(self, name):
        session_id = get_session_id(session, request)

        dao = TaskDAO(session_id)
        dao.delete_task(name=name)
        dao.close()

        resp_dict = {'message': 'Task successfully deleted'}
        resp = make_response(json_serialize(resp_dict), httplib.OK)
        resp.headers['Content-type'] = 'application/json'
        return resp
예제 #20
0
    def post(self):
        session_id = get_session_id(session, request)

        dao = TaskDAO(session_id)
        new_task = dao.from_json(request)
        task_id = dao.add_task(new_task)
        dao.close()

        resp_dict = {'message': new_task.name() + ' created'}
        resp = make_response(json_serialize(resp_dict), OK)
        resp.contenttype = 'application/json'
        return resp
예제 #21
0
    def post(self):
        session_id = get_session_id(session, request)

        dao = TaskDAO(session_id)
        new_task = dao.from_json(request)
        task_id = dao.add_task(new_task)
        dao.close()

        resp_dict = {'message': 'Task successfully added', 'task_id': task_id}
        resp = make_response(json_serialize(resp_dict), OK)
        resp.contenttype = 'application/json'
        return resp
예제 #22
0
  def put(self, name):
    session_id = get_session_id(session, request)

    dao = TaskDAO(session_id)
    req = dao.from_json(request)
    dao.update_task(req, name=name)
    dao.close()

    resp_dict = {'message': 'Task successfully updated'}
    resp = make_response(json_serialize(resp_dict), OK)
    resp.headers['Content-type'] = 'application/json'
    return resp