def endElement(self, name): if name == 'internal_document': p = InternalDocumentParameters(self.theName, self.theDescription, self.theContent, [], []) self.theInternalDocuments.append(p) self.resetInternalDocumentAttributes() elif name == 'code': p = CodeParameters(self.theName, self.theType, self.theDescription, self.theInclusionCriteria, self.theExample) self.theCodes.append(p) self.resetCodeAttributes() elif name == 'memo': p = MemoParameters(self.theName, self.theDescription) self.theMemos.append(p) self.resetMemoAttributes() elif name == 'implied_process': p = ImpliedProcessParameters(self.theName, self.theDescription, self.thePersona, self.theProcessNetwork, self.theSpecification, self.theChannels) self.theProcesses.append(p) self.resetProcessAttributes() elif name == 'quotation': self.theQuotations.append( (self.theType, self.theCode, self.theArtifactType, self.theArtifactName, self.theEnvironment, self.theSection, self.theStartIndex, self.theEndIndex, self.theLabel, self.theSynopsis)) self.resetQuotationAttributes() elif name == 'implied_characteristic': p = ImpliedCharacteristicParameters( self.thePersona, self.theFromCode, self.theToCode, self.theRelationshipType, self.theImpliedCharacteristicName, self.theImpliedCharacteristicQualifier, self.theFromLabels, self.theToLabels, self.theImpliedCharacteristicType) self.theImpliedCharacteristics.append(p) self.resetImpliedCharacteristicAttributes() elif name == 'description': self.inDescription = 0 elif name == 'inclusion_criteria': self.inInclusionCriteria = 0 elif name == 'example': self.inExample = 0 elif name == 'specification': self.inSpecification = 0 elif name == 'content': self.inContent = 0 elif name == 'label': self.inLabel = 0 elif name == 'synopsis': self.inSynopsis = 0
def displayMemo(self,fromIdx,toIdx): try: cmValue = self.theMemos[(fromIdx,toIdx)] b = Borg() cmObjt = b.dbProxy.dimensionObject(cmValue[0],'memo') dlg = MemoDialog(self,DialogClassParameters(MEMO_ID,'View Memo')) dlg.load(cmObjt) if (dlg.ShowModal() == MEMO_BUTTONCOMMIT_ID): memoName = dlg.name() memoTxt = dlg.memo() self.theMemos[(fromIdx,toIdx)] = (memoName,memoTxt) b = Borg() p = MemoParameters(memoName,memoTxt) p.setId(cmObjt.id()) b.dbProxy.updateMemo(p) dlg.Destroy() except KeyError: return
def testAddUpdateMemo(self): i = MemoParameters(self.iMemos[0]["theName"], self.iMemos[0]["theDescription"]) b = Borg() b.dbProxy.addMemo(i) oms = b.dbProxy.getMemos() o = oms[self.iMemos[0]["theName"]] self.assertEqual(i.name(), o.name()) self.assertEqual(i.description(),o.description()) o.theDescription = 'Updated description' b.dbProxy.updateMemo(o) oms2 = b.dbProxy.getMemos(o.id()) o2 = oms2[self.iMemos[0]["theName"]] self.assertEqual(i.name(), o2.name()) self.assertEqual('Updated description',o2.description()) b.dbProxy.deleteMemo(o.id())
def parameters(self): parameters = MemoParameters(self.theName,self.theDescription) parameters.setId(self.theId) return parameters