def update_entity_by_id(self,entityId,name=None,parent=None,new_entityId=None): try: entity=self.get_entity(entityId) self.update_entity(entity,name=name,parent=parent,new_entityId=new_entityId) gc=GenericCache() gc.on_add_entity(entity.type.name) except Exception, e: raise e
def remove_entity(self,entity): try: self.delete_relations(entity) gc=GenericCache() gc.on_delete_entity(entity.entity_id, entity.type.name) DBHelper().delete(entity) except Exception, e: raise e
def remove_entity_by_id(self,entityId,entityType=None,parent=None): try: entity=self.get_entity(entityId, entityType,parent) self.delete_relations(entity) gc=GenericCache() gc.on_delete_entity(entityId, entity.type.name) DBHelper().delete(entity) except Exception, e: raise e
def get_cache_details(self): try: self.authenticate() gc = GenericCache() cache_info = gc.get_cache_details() return dict(success=True, cache_info=cache_info) except Exception, ex: print_traceback() return dict(success=False, msg=to_str(ex).replace("'", " "))
def get_cache_details(self): try: self.authenticate() gc=GenericCache() cache_info = gc.get_cache_details() return dict(success=True,cache_info=cache_info) except Exception, ex: print_traceback() return dict(success=False,msg=to_str(ex).replace("'", " "))
def add_entity(self,name,entity_id,entityType,parent): try: type=DBHelper().find_by_name(EntityType,entityType) e=Entity() e.name=name e.type=type e.entity_id=entity_id #e.parent=parent DBHelper().add(e) DBHelper().add(EntityRelation(parent.entity_id,entity_id,u'Children')) ###Added to remove the referential integrity error due to transaction ###that SA/MySQL innodb is supposed to take care gc=GenericCache() gc.on_add_entity(e.type.name) DBSession.flush() except Exception, e: raise e