def parameters(self): parameters = SecurityPatternParameters(self.thePatternName, self.thePatternContext, self.thePatternProblem, self.thePatternSolution, self.theRequirements, self.theConcernAssociations) parameters.setId(self.thePatternId) return parameters
def endElement(self,name): if name == 'asset': spDict = {} spDict['confidentiality'] = (0,'None') spDict['integrity'] = (0,'None') spDict['availability'] = (0,'None') spDict['accountability'] = (0,'None') spDict['anonymity'] = (0,'None') spDict['pseudonymity'] = (0,'None') spDict['unlinkability'] = (0,'None') spDict['unobservability'] = (0,'None') for sp in self.theSecurityProperties: spName = sp[0] spValue = a2i(sp[1]) spRationale = sp[2] if spName in spDict: spDict[spName] = (spValue,spRationale) spValues = [] spValues.append(spDict['confidentiality']) spValues.append(spDict['integrity']) spValues.append(spDict['availability']) spValues.append(spDict['accountability']) spValues.append(spDict['anonymity']) spValues.append(spDict['pseudonymity']) spValues.append(spDict['unlinkability']) spValues.append(spDict['unobservability']) p = TemplateAssetParameters(self.theName,self.theShortCode,self.theDescription,self.theSignificance,self.theAssetType,spValues,self.theTags,self.theInterfaces) self.theAssets.append(p) self.resetAssetAttributes() elif name == 'security_property': self.theSecurityProperties.append((self.thePropertyName,self.thePropertyValue,self.theRationale)) self.resetSecurityPropertyAttributes() elif name == 'pattern': p = SecurityPatternParameters(self.theName,self.theContext,self.theProblem,self.theSolution,self.theRequirements,self.theStructure) self.theSecurityPatterns.append(p) self.resetPatternAttributes() elif name == 'structure': self.theStructure.append((self.theHeadName,self.theHeadAdornment,self.theHeadNry,self.theHeadRole,self.theTailRole,self.theTailNry,self.theTailAdornment,self.theTailName)) self.resetStructure() elif name == 'requirement': self.theRequirements.append((self.theReqName,self.theDescription,self.theType,self.theRationale,self.theFitCriterion,self.theAsset)) self.resetRequirement() elif name == 'description': self.inDescription = 0 elif name == 'rationale': self.inRationale = 0 elif name == 'significance': self.inSignificance = 0 elif name == 'context': self.inContext = 0 elif name == 'problem': self.inProblem = 0 elif name == 'solution': self.inSolution = 0 elif name == 'fit_criterion': self.inFitCriterion = 0
def fakeToRealSP(self,sp): spName = sp["theName"] spContext = sp["theContext"] spProb = sp["theProblem"] spSol = sp["theSolution"] spReqs = [] for freq in sp["theRequirements"]: spReqs.append(TemplateRequirementParameters(freq["theName"],freq["theAsset"],freq["theType"],freq["theDescription"],freq["theRationale"],freq["theFitCriterion"])) spAssocs = [] for cs in sp["theConcernAssociations"]: spAssocs.append((cs["theHeadAsset"],cs["theHeadAdornment"],cs["theHeadNry"],cs["theHeadRole"],cs["theTailRole"],cs["theTailNry"],cs["theTailAdornment"],cs["theTailAsset"])) spParams = SecurityPatternParameters(spName,spContext,spProb,spSol,spReqs,spAssocs) return spParams
def parameters(self): parameters = SecurityPatternParameters(self.thePatternName,self.thePatternContext,self.thePatternProblem,self.thePatternSolution,self.theRequirements,self.theConcernAssociations) parameters.setId(self.thePatternId) return parameters