def PUT(self,**kwargs): try: error_message=None data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['source','stimulus','artifact','enviroment','response','response_measure','quality_scenario_name','quality_atribute','quality_atribute_node','project_name']) if error_message: raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.quality_requirements.find_one(dict(quality_atribute=data['quality_atribute'],quality_atribute_node=data['quality_atribute_node'])) if result: for quality_scenario in result['quality_scenarios']: if quality_scenario['name'] == data['quality_scenario_name']: quality_scenario['name'] = data['quality_scenario_name'] quality_scenario['source'] = data['source'] quality_scenario['stimulus'] = data['stimulus'] quality_scenario['artifact'] = data['artifact'] quality_scenario['enviroment'] = data['enviroment'] quality_scenario['response'] = data['response'] quality_scenario['response_measure'] = data['response_measure'] db.quality_requirements.update({"_id": result['_id']}, {"$set": dict(quality_scenarios=result['quality_scenarios'])}) else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'quality_scenario') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def POST(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data( data=data, attrs=['stakeholder_type', 'project_name', 'concerns', 'name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'stakeholder') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.stakeholders.find_one({"name": data['name']}) if not result: try: db.stakeholders.insert( dict(name=data['name'], stakeholder_type=data['stakeholder_type'].replace( "_", " "), concerns=data['concerns'])) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_stakeholder') raise Exception else: error_message = format(EXCEPTION_DATA_ALREADY_EXISTS % 'stakeholder') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message, token=None)
def POST(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['name', 'description']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'team') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client.teams result = db.teams.find_one({"name": data['name']}) if not result: try: db.teams.insert( dict(name=data['name'], description=data['description'])) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_team') raise Exception else: error_message = format(EXCEPTION_DATA_ALREADY_EXISTS % 'team') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message, token=None)
def POST(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['background','purpose_scope','overview','project_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'overview') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.overview.find_one() if not result: try: db.overview.insert(dict(background=data['background'],purpose_scope=data['purpose_scope'],overview=data['overview'])) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_overview') raise Exception else: db.overview.update({"_id": result['_id']}, {"$set": dict(background=data['background'],purpose_scope=data['purpose_scope'],overview=data['overview'])}) return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def PUT(self, **kwargs): try: error_message = None data = cherrypy.request.json error_message = verify_in_data( data=data, attrs=[ 'source', 'stimulus', 'artifact', 'enviroment', 'response', 'response_measure', 'quality_scenario_name', 'quality_atribute', 'quality_atribute_node', 'project_name' ]) if error_message: raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.quality_requirements.find_one( dict(quality_atribute=data['quality_atribute'], quality_atribute_node=data['quality_atribute_node'])) if result: for quality_scenario in result['quality_scenarios']: if quality_scenario['name'] == data[ 'quality_scenario_name']: quality_scenario['name'] = data[ 'quality_scenario_name'] quality_scenario['source'] = data['source'] quality_scenario['stimulus'] = data['stimulus'] quality_scenario['artifact'] = data['artifact'] quality_scenario['enviroment'] = data['enviroment'] quality_scenario['response'] = data['response'] quality_scenario['response_measure'] = data[ 'response_measure'] db.quality_requirements.update({"_id": result['_id']}, { "$set": dict(quality_scenarios=result['quality_scenarios']) }) else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'quality_scenario') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message, token=None)
def PUT(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data( data=data, attrs=[ 'name', 'goal_description', 'objective', 'driver', 'stakeholders', 'quality_atributes', 'measure', 'project_name', 'chart_min', 'chart_med', 'chart_max', 'range_min', 'range_max' ]) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS, 'business_goal') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.business_goals.find_one({"name": data['name']}) if result: try: db.business_goals.update({"_id": result['_id']}, { "$set": dict(name=data['name'], goal_description=data['goal_description'], objective=data['objective'], driver=data['driver'], stakeholders=data['stakeholders'], quality_atributes=data['quality_atributes'], measure=data['measure'].replace("_", " "), chart_min=data['chart_min'], chart_med=data['chart_med'], chart_max=data['chart_max'], range_min=data['range_min'], range_max=data['range_max']) }) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'update_business_goal') raise Exception else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'business_goal') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message, token=None)
def PUT(self,**kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['name','inputs','stakeholder','context_description','functionality_description','functionality','context','outputs','stakeholder_description','project_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'operational_scenario') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.operational_scenarios.find_one({"name": data['name'].replace("_", " ")}) if result: try: db.operational_scenarios.update({"_id": result['_id']}, {"$set": dict(name=data['name'].replace("_", " "),inputs=data['inputs'],stakeholder=data['stakeholder'],context_description=data['context_description'],functionality_description=data['functionality_description'],functionality=data['functionality'],context=data['context'],outputs=data['outputs'],stakeholder_description=data['stakeholder_description'])}) except Exception,e: error_message = format(EXCEPTION_PROCESSING_ERROR % 'operational_scenario') raise Exception else:
def POST(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['project_name', 'name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS, 'business_goal') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.business_goals.find_one({"name": data['name']}) if not result: try: db.business_goals.insert( dict(name=data['name'], goal_description=str(), objective=str(), driver=str(), stakeholders=list(), quality_atributes=list(), measure=str(), chart_min=str('33'), chart_med=str('33'), chart_max=str('33'), range_min=str('0'), range_max=str('100'))) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_business_goal') raise Exception else: error_message = format(EXCEPTION_DATA_ALREADY_EXISTS % 'business_goal') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message, token=None)
def POST(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['project_name','description','stakeholder','alternatives','constaint_type','name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS,'constraint') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.constraints.find_one({"name": data['name']}) if not result: try: db.constraints.insert(dict(name=data['name'],stakeholder=data['stakeholder'].replace ("_", " "),description=data['description'],alternatives=data['alternatives'],constaint_type=data['constaint_type'])) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_constraint') raise Exception else: error_message = format(EXCEPTION_DATA_ALREADY_EXISTS % 'constraint') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def PUT(self,**kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['project_name','description','stakeholder','alternatives','constaint_type','name','old_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS,'constraint') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.constraints.find_one({"name": data['old_name']}) if result: try: db.constraints.update({"_id": result['_id']}, {"$set": dict(name=data['name'],stakeholder=data['stakeholder'].replace ("_", " "),description=data['description'],alternatives=data['alternatives'],constaint_type=data['constaint_type'])}) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'update_constraint') raise Exception else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'constraint') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def PUT(self,**kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['stakeholder_type','project_name','concerns','name','old_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'stakeholder') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.stakeholders.find_one({"name": data['old_name']}) if result: try: db.stakeholders.update({"_id": result['_id']}, {"$set": dict(name=data['name'],stakeholder_type=data['stakeholder_type'].replace ("_", " "),concerns=data['concerns'])}) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_stakeholder') raise Exception else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'stakeholder') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def POST(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['project_name','name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS,'business_goal') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.business_goals.find_one({"name": data['name']}) if not result: try: db.business_goals.insert(dict(name=data['name'],goal_description=str(),objective=str(),driver=str(),stakeholders=list(),quality_atributes=list(),measure=str(),chart_min=str('33'),chart_med=str('33'),chart_max=str('33'),range_min=str('0'),range_max=str('100'))) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_business_goal') raise Exception else: error_message = format(EXCEPTION_DATA_ALREADY_EXISTS % 'business_goal') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def PUT(self,**kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['name','goal_description','objective','driver','stakeholders','quality_atributes','measure','project_name','chart_min','chart_med','chart_max','range_min','range_max']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS,'business_goal') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.business_goals.find_one({"name": data['name']}) if result: try: db.business_goals.update({"_id": result['_id']}, {"$set": dict(name=data['name'],goal_description=data['goal_description'],objective=data['objective'],driver=data['driver'],stakeholders=data['stakeholders'],quality_atributes=data['quality_atributes'],measure=data['measure'].replace("_", " "),chart_min=data['chart_min'],chart_med=data['chart_med'],chart_max=data['chart_max'],range_min=data['range_min'],range_max=data['range_max'])}) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'update_business_goal') raise Exception else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'business_goal') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def POST(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['project_name','name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS,'operational_scenario') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.operational_scenarios.find_one({"name": data['name']}) if not result: try: db.operational_scenarios.insert(dict(name=data['name'],inputs=list(),stakeholder=str(),context_description=str(),functionality_description=str(),functionality=str(),context=str(),outputs=list(),stakeholder_description=str())) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_operational_scenario') raise Exception else: error_message = format(EXCEPTION_DATA_ALREADY_EXISTS % 'operational_scenario') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def POST(self, **kwargs): try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['utility_tree_type','project_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception utility_tree = list() if data['utility_tree_type'] == 'ISO': dicts = dict() dicts['name']='functionality' dicts['nodes']=list() dicts['nodes'].append(dict(node='interoperability',score='M L')) dicts['nodes'].append(dict(node='security',score='H L')) dicts['nodes'].append(dict(node='compliance',score='H L')) utility_tree.append(dicts) dicts = dict() dicts['name']='reliability' dicts['nodes']=list() dicts['nodes'].append(dict(node='maturity',score='M M')) dicts['nodes'].append(dict(node='recoverability',score='L L')) utility_tree.append(dicts) dicts = dict() dicts['name']='usability' dicts['nodes']=list() dicts['nodes'].append(dict(node='learnability',score='M H')) dicts['nodes'].append(dict(node='operability',score='M L')) utility_tree.append(dicts) dicts = dict() dicts['name']='efficiency' dicts['nodes']=list() dicts['nodes'].append(dict(node='time',score='L L')) dicts['nodes'].append(dict(node='resource',score='M L')) utility_tree.append(dicts) dicts = dict() dicts['name']='maintainability' dicts['nodes']=list() dicts['nodes'].append(dict(node='extensibility',score='L L')) utility_tree.append(dicts) elif data['utility_tree_type'] == 'SEI': dicts = dict() dicts['name']='performance' dicts['nodes']=list() dicts['nodes'].append(dict(node='latency',score='M L')) dicts['nodes'].append(dict(node='throughput',score='H L')) utility_tree.append(dicts) dicts = dict() dicts['name']='modifiability' dicts['nodes']=list() dicts['nodes'].append(dict(node='change-COTS',score='L L')) utility_tree.append(dicts) dicts = dict() dicts['name']='availability' dicts['nodes']=list() dicts['nodes'].append(dict(node='HW-failures',score='M H')) dicts['nodes'].append(dict(node='SW-failures',score='M L')) utility_tree.append(dicts) dicts = dict() dicts['name']='security' dicts['nodes']=list() dicts['nodes'].append(dict(node='confident',score='L L')) dicts['nodes'].append(dict(node='integrity',score='M L')) utility_tree.append(dicts) client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] try: db.utility_tree.insert(dict(utility_tree=utility_tree)) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_utility_tree') raise Exception try: for quality_atribute in utility_tree: for node in quality_atribute['nodes']: db.quality_requirements.insert(dict(quality_atribute=quality_atribute['name'],quality_atribute_node=node['node'],quality_atribute_score=node['score'],quality_scenarios=list())) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'new_utility_tree') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)
def PUT(self,**kwargs): error_message = None try: data = cherrypy.request.json error_message = verify_in_data(data=data, attrs=['update_type','project_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'update_type') raise Exception if data['update_type']=='qa_node_score': error_message = verify_in_data(data=data, attrs=['qa_name','qa_node_name','qa_node_old_score','qa_node_score']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.utility_tree.find_one() if result: try: for quality_atribute in result['utility_tree']: if quality_atribute['name'] == data['qa_name']: for node in quality_atribute['nodes']: if node['node'] == data['qa_node_name']: node['score'] = data['qa_node_score'] db.quality_requirements.update({"quality_atribute_node": data['qa_node_name']}, {"$set":{"quality_atribute_score":data['qa_node_score']}}) db.utility_tree.update({"_id": result['_id']}, {"$set": dict(utility_tree=result['utility_tree'])}) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'update_utility_tree') raise Exception return build_response(token=None) else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception elif data['update_type']=='qa_node': error_message = verify_in_data(data=data, attrs=['qa_name','qa_node_name','qa_old_node_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.utility_tree.find_one() if result: try: for quality_atribute in result['utility_tree']: if quality_atribute['name'] == data['qa_name']: for node in quality_atribute['nodes']: if node['node'] == data['qa_old_node_name']: node['node'] = data['qa_node_name'] db.quality_requirements.update({"quality_atribute_node": data['qa_old_node_name']}, {"$set":{"quality_atribute_node":data['qa_node_name']}}) db.utility_tree.update({"_id": result['_id']}, {"$set": dict(utility_tree=result['utility_tree'])}) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'update_utility_tree') raise Exception return build_response(token=None) else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception elif data['update_type']=='qa_name': error_message = verify_in_data(data=data, attrs=['qa_name','qa_old_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.utility_tree.find_one() if result: try: for quality_atribute in result['utility_tree']: if quality_atribute['name'] == data['qa_old_name']: quality_atribute['name'] = data['qa_name'] db.quality_requirements.update( {"quality_atribute": data['qa_old_name']}, {"$set":{"quality_atribute":data['qa_name']}}, **{ "upsert":True, "multi":True }) db.utility_tree.update({"_id": result['_id']}, {"$set": dict(utility_tree=result['utility_tree'])}) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'update_utility_tree') raise Exception return build_response(token=None) else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception elif data['update_type']=='add_qa_node': error_message = verify_in_data(data=data, attrs=['qa_name','qa_node_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.utility_tree.find_one() if result: try: for quality_atribute in result['utility_tree']: if quality_atribute['name'] == data['qa_name']: quality_atribute['nodes'].append(dict(node=data['qa_node_name'],score='L L')) db.quality_requirements.insert(dict(quality_atribute=data['qa_name'],quality_atribute_node=data['qa_node_name'],quality_atribute_score='L L',quality_scenarios=list())) db.utility_tree.update({"_id": result['_id']}, {"$set": dict(utility_tree=result['utility_tree'])}) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'update_utility_tree') raise Exception return build_response(token=None) else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception elif data['update_type']=='add_qa_name': error_message = verify_in_data(data=data, attrs=['qa_name']) if error_message: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception client = MongoClient(DATABASE_ADDRESS, DATABASE_PORT) db = client[data['project_name']] result = db.utility_tree.find_one() if result: try: dicts = dict() dicts['name']=data['qa_name'] dicts['nodes']=list() dicts['nodes'].append(dict(node=data['qa_name'],score='L L')) result['utility_tree'].append(dicts) db.quality_requirements.insert(dict(quality_atribute=data['qa_name'],quality_atribute_node=data['qa_name'],quality_atribute_score='L L',quality_scenarios=list())) db.utility_tree.update({"_id": result['_id']}, {"$set": dict(utility_tree=result['utility_tree'])}) except Exception: error_message = format(EXCEPTION_PROCESSING_ERROR % 'update_utility_tree') raise Exception return build_response(token=None) else: error_message = format(EXCEPTION_DATA_NOT_EXISTS % 'utility_tree') raise Exception return build_response(token=None) except Exception: if not error_message: error_message = EXCEPTION_PROCESSING_ERROR return build_response(error_message=error_message,token=None)