def get(self): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) objts = dao.get_usecases_summary() dao.close() resp = make_response(json_serialize(objts, session_id=session_id)) resp.headers['Content-Type'] = "application/json" return resp
def get(self, name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) usecase = dao.get_usecase_by_name(name=name) dao.close() resp = make_response(json_serialize(usecase, session_id=session_id), OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self, usecase_name,environment_name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) goals = dao.get_usecase_goals(usecase_name,environment_name) dao.close() resp = make_response(json_serialize(goals, session_id=session_id), OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self, name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) usecase = dao.get_usecase_by_name(name=name) dao.close() resp = make_response(json_serialize(usecase, session_id=session_id), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def delete(self, name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) dao.delete_usecase(name=name) dao.close() resp_dict = {'message': 'UseCase successfully deleted'} resp = make_response(json_serialize(resp_dict), OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self): session_id = get_session_id(session, request) constraint_id = request.args.get('constraint_id', -1) dao = UseCaseDAO(session_id) usecases = dao.get_usecases(constraint_id=constraint_id) dao.close() resp = make_response(json_serialize(usecases, session_id=session_id), OK) resp.contenttype = 'application/json' return resp
def get(self): session_id = get_session_id(session, request) constraint_id = request.args.get('constraint_id', -1) dao = UseCaseDAO(session_id) usecases = dao.get_usecases(constraint_id=constraint_id) dao.close() resp = make_response(json_serialize(usecases, session_id=session_id), httplib.OK) resp.contenttype = 'application/json' return resp
def delete(self, name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) dao.delete_usecase(name=name) dao.close() resp_dict = {'message': 'UseCase successfully deleted'} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self, usecase_name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) reqs = dao.get_usecase_requirements(usecase_name) dao.close() resp = make_response(json_serialize(reqs, session_id=session_id), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def post(self,environment_name,step_name,exception_name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) uc,ucContribs = dao.from_json(request) dao.generate_obstacle_from_usecase(uc,environment_name,step_name,exception_name) dao.close() resp_dict = {'message': 'Obstacle generated from exception'} resp = make_response(json_serialize(resp_dict), OK) resp.contenttype = 'application/json' return resp
def post(self): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) new_usecase = dao.from_json(request) usecase_id = dao.add_usecase(new_usecase) dao.close() resp_dict = {'message': 'UseCase successfully added', 'usecase_id': usecase_id} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.contenttype = 'application/json' return resp
def put(self, name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) req = dao.from_json(request) dao.update_usecase(req, name=name) dao.close() resp_dict = {'message': 'UseCase successfully updated'} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def post(self): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) new_usecase,ucContribs = dao.from_json(request) usecase_id = dao.add_usecase(new_usecase) for rc in ucContribs: dao.assign_usecase_contribution(rc) dao.close() resp_dict = {'message': 'UseCase successfully added', 'usecase_id': usecase_id} resp = make_response(json_serialize(resp_dict), OK) resp.contenttype = 'application/json' return resp
def put(self, name): session_id = get_session_id(session, request) dao = UseCaseDAO(session_id) uc, ucContribs = dao.from_json(request) dao.update_usecase(uc, name=name) dao.remove_usecase_contributions(uc) if (len(ucContribs) > 0): for rc in ucContribs: dao.assign_usecase_contribution(rc) dao.close() resp_dict = {'message': 'UseCase successfully updated'} resp = make_response(json_serialize(resp_dict), OK) resp.headers['Content-type'] = 'application/json' return resp