Example #1
0
 def parameters(self):
     parameters = TemplateAssetParameters(
         self.theAssetName, self.theShortCode, self.theAssetDescription,
         self.theAssetSignificance, self.theType, self.theSurfaceType,
         self.theAccessRight, self.theSecurityProperties, self.theTags,
         self.theInterfaces)
     parameters.setId(self.theAssetId)
     return parameters
Example #2
0
    def testTemplateAsset(self):
        spValues = [0, 0, 0, 0, 0, 0, 0, 0]
        spRat = [
            'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None'
        ]
        iTap = TemplateAssetParameters(
            self.iTemplateAssets[0]["theName"],
            self.iTemplateAssets[0]["theShortCode"],
            self.iTemplateAssets[0]["theDescription"],
            self.iTemplateAssets[0]["theSignificance"],
            self.iTemplateAssets[0]["theType"],
            self.iTemplateAssets[0]["theSurfaceType"],
            self.iTemplateAssets[0]["theAccessRight"], spValues, spRat, [],
            [("anInterface", "provided", "trusted", "privileged")])
        b = Borg()
        b.dbProxy.addTemplateAsset(iTap)
        oTaps = b.dbProxy.getTemplateAssets()
        oTap = oTaps[self.iTemplateAssets[0]["theName"]]
        self.assertEqual(iTap.name(), oTap.name())
        self.assertEqual(iTap.properties(), oTap.properties())
        self.assertEqual(iTap.shortCode(), oTap.shortCode())
        self.assertEqual(iTap.description(), oTap.description())
        self.assertEqual(iTap.type(), oTap.type())
        self.assertEqual(iTap.surfaceType(), oTap.surfaceType())
        self.assertEqual(iTap.accessRight(), oTap.accessRight())

        b.dbProxy.deleteTemplateAsset(oTap.id())
Example #3
0
 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
Example #4
0
 def update_template_asset(self, ta, name):
     found_ta = self.get_template_asset(name)
     taParams = TemplateAssetParameters(assetName=ta.theName,
                                        shortCode=ta.theShortCode,
                                        assetDesc=ta.theDescription,
                                        assetSig=ta.theSignificance,
                                        assetType=ta.theType,
                                        sType=ta.theSurfaceType,
                                        aRight=ta.theAccessRight,
                                        spValues=ta.theProperties,
                                        spRationale=ta.theRationale,
                                        tags=ta.theTags,
                                        ifs=ta.theInterfaces)
     taParams.setId(found_ta.theId)
     try:
         self.db_proxy.updateTemplateAsset(taParams)
     except ARMException as ex:
         self.close()
         raise ARMHTTPError(ex)
Example #5
0
def addSPDependentData(d):
  cairis.core.BorgFactory.initialise()
  b = Borg()
  for i in d['access_rights']:
    b.dbProxy.addValueType(ValueTypeParameters(i["theName"], i["theDescription"], 'access_right','',i["theValue"],i["theRationale"]))
  for i in d['surface_types']:
    b.dbProxy.addValueType(ValueTypeParameters(i["theName"], i["theDescription"], 'surface_type','',i["theValue"],i["theRationale"]))
  spValues = [0,0,0,0,0,0,0,0]
  srValues = ['None','None','None','None','None','None','None','None']
  for i in d['template_assets']:
    b.dbProxy.addTemplateAsset(TemplateAssetParameters(i["theName"], i["theShortCode"], i["theDescription"], i["theSignificance"],i["theType"],i["theSurfaceType"],i["theAccessRight"],spValues,srValues,[],[]))
Example #6
0
 def update_template_asset(self,ta,name):
   found_ta = self.get_template_asset(name)
   taParams = TemplateAssetParameters(
     assetName=ta.theName,
     shortCode=ta.theShortCode,
     assetDesc=ta.theDescription,
     assetSig=ta.theSignificance,
     assetType=ta.theType,
     sType=ta.theSurfaceType,
     aRight=ta.theAccessRight,
     spValues=ta.theProperties,
     spRationale=ta.theRationale,
     tags=ta.theTags,
     ifs=ta.theInterfaces)
   taParams.setId(found_ta.theId)
   try:
     self.db_proxy.updateTemplateAsset(taParams)
   except ARMException as ex:
     self.close()
     raise ARMHTTPError(ex)
 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, self.theSurfaceType,
                                     self.theAccessRight, 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 == 'description':
         self.inDescription = 0
     elif name == 'rationale':
         self.inRationale = 0
     elif name == 'significance':
         self.inSignificance = 0
     elif name == 'access_right' or name == 'surface_type':
         p = ValueTypeParameters(self.theName, self.theDescription, name,
                                 '', self.theScore, self.theRationale)
         self.theValueTypes.append(p)
         self.resetValueTypeAttributes()
  def testTemplateAsset(self):
    spValues = [(0,'None'),(0,'None'),(0,'None'),(0,'None'),(0,'None'),(0,'None'),(0,'None'),(0,'None')]
    iTap = TemplateAssetParameters(self.iTemplateAssets[0]["theName"], self.iTemplateAssets[0]["theShortCode"], self.iTemplateAssets[0]["theDescription"], self.iTemplateAssets[0]["theSignificance"],self.iTemplateAssets[0]["theType"],self.iTemplateAssets[0]["theSurfaceType"],self.iTemplateAssets[0]["theAccessRight"],spValues,[],[])
    b = Borg()
    b.dbProxy.addTemplateAsset(iTap)
    oTaps = b.dbProxy.getTemplateAssets()
    oTap = oTaps[self.iTemplateAssets[0]["theName"]]
    self.assertEqual(iTap.name(), oTap.name())
    self.assertEqual(iTap.properties(), oTap.properties())
    self.assertEqual(iTap.shortCode(),oTap.shortCode())
    self.assertEqual(iTap.description(),oTap.description())
    self.assertEqual(iTap.type(),oTap.type())
    self.assertEqual(iTap.surfaceType(),oTap.surfaceType())
    self.assertEqual(iTap.accessRight(),oTap.accessRight())

    b.dbProxy.deleteTemplateAsset(oTap.id())
Example #9
0
  def testTemplateAsset(self):
    spValues = [0,0,0,0,0,0,0,0]
    spRat = ['None','None','None','None','None','None','None','None']
    iTap = TemplateAssetParameters(self.iTemplateAssets[0]["theName"], self.iTemplateAssets[0]["theShortCode"], self.iTemplateAssets[0]["theDescription"], self.iTemplateAssets[0]["theSignificance"],self.iTemplateAssets[0]["theType"],self.iTemplateAssets[0]["theSurfaceType"],self.iTemplateAssets[0]["theAccessRight"],spValues,spRat,[],[("anInterface","provided","trusted","privileged")])
    b = Borg()
    b.dbProxy.addTemplateAsset(iTap)
    oTaps = b.dbProxy.getTemplateAssets()
    oTap = oTaps[self.iTemplateAssets[0]["theName"]]
    self.assertEqual(iTap.name(), oTap.name())
    self.assertEqual(iTap.properties(), oTap.properties())
    self.assertEqual(iTap.shortCode(),oTap.shortCode())
    self.assertEqual(iTap.description(),oTap.description())
    self.assertEqual(iTap.type(),oTap.type())
    self.assertEqual(iTap.surfaceType(),oTap.surfaceType())
    self.assertEqual(iTap.accessRight(),oTap.accessRight())

    b.dbProxy.deleteTemplateAsset(oTap.id())
Example #10
0
def addTestData():
    f = open(os.environ['CAIRIS_SRC'] + '/test/templategoals.json')
    d = json.load(f)
    f.close()
    iAccessRights = d['access_rights']
    iSurfaceTypes = d['surface_type']
    iTemplateAssets = d['template_assets']
    iTemplateGoals = d['template_goals']
    cairis.core.BorgFactory.initialise()
    b = Borg()
    iar1 = ValueTypeParameters(iAccessRights[0]["theName"],
                               iAccessRights[0]["theDescription"],
                               'access_right', '',
                               iAccessRights[0]["theValue"],
                               iAccessRights[0]["theRationale"])
    ist1 = ValueTypeParameters(iSurfaceTypes[0]["theName"],
                               iSurfaceTypes[0]["theDescription"],
                               'surface_type', '',
                               iSurfaceTypes[0]["theValue"],
                               iSurfaceTypes[0]["theRationale"])
    b.dbProxy.addValueType(iar1)
    b.dbProxy.addValueType(ist1)
    spValues = [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
    ]
    srValues = ['None', 'None', 'None', 'None', 'None', 'None', 'None', 'None']
    iTap = TemplateAssetParameters(
        iTemplateAssets[0]["theName"], iTemplateAssets[0]["theShortCode"],
        iTemplateAssets[0]["theDescription"],
        iTemplateAssets[0]["theSignificance"], iTemplateAssets[0]["theType"],
        iTemplateAssets[0]["theSurfaceType"],
        iTemplateAssets[0]["theAccessRight"], spValues, srValues, [], [])
    b.dbProxy.addTemplateAsset(iTap)
    iTag1 = TemplateGoalParameters(iTemplateGoals[0]["theName"],
                                   iTemplateGoals[0]["theDefinition"],
                                   iTemplateGoals[0]["theRationale"],
                                   iTemplateGoals[0]["theConcerns"],
                                   iTemplateGoals[0]["theResponsibilities"])
    b.dbProxy.addTemplateGoal(iTag1)
Example #11
0
 def add_object(self, ta):
     taParams = TemplateAssetParameters(assetName=ta.theName,
                                        shortCode=ta.theShortCode,
                                        assetDesc=ta.theDescription,
                                        assetSig=ta.theSignificance,
                                        assetType=ta.theType,
                                        sType=ta.theSurfaceType,
                                        aRight=ta.theAccessRight,
                                        spValues=ta.theProperties,
                                        spRationale=ta.theRationale,
                                        tags=ta.theTags,
                                        ifs=ta.theInterfaces)
     try:
         self.db_proxy.addTemplateAsset(taParams)
     except ARMException as ex:
         self.close()
         raise ARMHTTPError(ex)
def addAPDependentData(d):
  cairis.core.BorgFactory.initialise()
  b = Borg()
  for i in d['roles']:
    b.dbProxy.addRole(RoleParameters(i["theName"], i["theType"], i["theShortCode"], i["theDescription"],[]))
  for i in d['access_rights']:
    b.dbProxy.addValueType(ValueTypeParameters(i["theName"], i["theDescription"], 'access_right','',i["theValue"],i["theRationale"]))
  for i in d['surface_types']:
    b.dbProxy.addValueType(ValueTypeParameters(i["theName"], i["theDescription"], 'surface_type','',i["theValue"],i["theRationale"]))
  for i in d['protocols']:
    b.dbProxy.addValueType(ValueTypeParameters(i["theName"], i["theDescription"], 'protocol','',i["theValue"],i["theRationale"]))
  for i in d['privileges']:
    b.dbProxy.addValueType(ValueTypeParameters(i["theName"], i["theDescription"], 'privilege','',i["theValue"],i["theRationale"]))
  spValues = [(0,'None'),(0,'None'),(0,'None'),(0,'None'),(0,'None'),(0,'None'),(0,'None'),(0,'None')]
  for i in d['template_assets']:
    b.dbProxy.addTemplateAsset(TemplateAssetParameters(i["theName"], i["theShortCode"], i["theDescription"], i["theSignificance"],i["theType"],i["theSurfaceType"],i["theAccessRight"],spValues,[],[]))
  for i in d['template_goals']:
    b.dbProxy.addTemplateGoal(TemplateGoalParameters(i["theName"],i["theDefinition"],i["theRationale"],i["theConcerns"],i["theResponsibilities"]))
Example #13
0
def addTestData():
    f = open(os.environ['CAIRIS_SRC'] + '/test/templateassets.json')
    d = json.load(f)
    f.close()
    iAccessRights = d['access_rights']
    iSurfaceTypes = d['surface_type']
    iTemplateAssets = d['template_assets']
    iPrivileges = d['privileges']
    cairis.core.BorgFactory.initialise()
    b = Borg()
    iar1 = ValueTypeParameters(iAccessRights[0]["theName"],
                               iAccessRights[0]["theDescription"],
                               'access_right', '',
                               iAccessRights[0]["theValue"],
                               iAccessRights[0]["theRationale"])
    iar2 = ValueTypeParameters(iAccessRights[1]["theName"],
                               iAccessRights[1]["theDescription"],
                               'access_right', '',
                               iAccessRights[1]["theValue"],
                               iAccessRights[1]["theRationale"])
    ist1 = ValueTypeParameters(iSurfaceTypes[0]["theName"],
                               iSurfaceTypes[0]["theDescription"],
                               'surface_type', '',
                               iSurfaceTypes[0]["theValue"],
                               iSurfaceTypes[0]["theRationale"])
    ipr1 = ValueTypeParameters(iPrivileges[0]["theName"],
                               iPrivileges[0]["theDescription"], 'privilege',
                               '', iPrivileges[0]["theValue"],
                               iPrivileges[0]["theRationale"])
    b.dbProxy.addValueType(iar1)
    b.dbProxy.addValueType(iar2)
    b.dbProxy.addValueType(ist1)
    b.dbProxy.addValueType(ipr1)
    spValues = [0, 0, 0, 0, 0, 0, 0, 0]
    srValues = ['None', 'None', 'None', 'None', 'None', 'None', 'None', 'None']
    ifs = iTemplateAssets[0]
    iTap = TemplateAssetParameters(
        iTemplateAssets[0]["theName"], iTemplateAssets[0]["theShortCode"],
        iTemplateAssets[0]["theDescription"],
        iTemplateAssets[0]["theSignificance"], iTemplateAssets[0]["theType"],
        iTemplateAssets[0]["theSurfaceType"],
        iTemplateAssets[0]["theAccessRight"], spValues, srValues, [],
        [('anInterface', 'provided', 'trusted', 'privileged')])
    b.dbProxy.addTemplateAsset(iTap)
  def setUp(self):
    call([os.environ['CAIRIS_SRC'] + "/test/initdb.sh"])
    cairis.core.BorgFactory.initialise()
    f = open(os.environ['CAIRIS_SRC'] + '/test/componentviews.json')
    d = json.load(f)
    f.close()

    self.theRequirements = []
    self.theRoles = []
    self.iRoles = d['roles']
    for i in self.iRoles:
      self.theRoles.append(RoleParameters(i["theName"], i["theType"], i["theShortCode"], i["theDescription"],[]))

    self.theMetricTypes = []
    self.iAccessRights = d['access_rights']
    for i in self.iAccessRights:
      self.theMetricTypes.append(ValueTypeParameters(i["theName"], i["theDescription"], 'access_right','',i["theValue"],i["theRationale"]))

    self.iSurfaceTypes = d['surface_types']
    for i in self.iSurfaceTypes:
      self.theMetricTypes.append(ValueTypeParameters(i["theName"], i["theDescription"], 'surface_type','',i["theValue"],i["theRationale"]))

    self.iProtocols = d['protocols']
    for i in self.iProtocols:
      self.theMetricTypes.append(ValueTypeParameters(i["theName"], i["theDescription"], 'protocol','',i["theValue"],i["theRationale"]))

    self.iPrivileges = d['privileges']
    for i in self.iPrivileges:
      self.theMetricTypes.append(ValueTypeParameters(i["theName"], i["theDescription"], 'privilege','',i["theValue"],i["theRationale"]))

    self.theAssets = []
    spValues = [0,0,0,0,0,0,0,0,]
    srValues = ['None','None','None','None','None','None','None','None']
    self.iTemplateAssets = d['template_assets']
    for i in self.iTemplateAssets:
      self.theAssets.append(TemplateAssetParameters(i["theName"], i["theShortCode"], i["theDescription"], i["theSignificance"],i["theType"],i["theSurfaceType"],i["theAccessRight"],spValues,srValues,[],[]))

    self.theGoals = []
    self.iTemplateGoals = d['template_goals']
    for i in self.iTemplateGoals:
      self.theGoals.append(TemplateGoalParameters(i["theName"],i["theDefinition"],i["theRationale"],i["theConcerns"],i["theResponsibilities"]))

    self.iComponentViews = d['architectural_patterns']
Example #15
0
    def setUp(self):
        call([os.environ['CAIRIS_SRC'] + "/test/initdb.sh"])
        cairis.core.BorgFactory.initialise()
        f = open(os.environ['CAIRIS_SRC'] + '/test/templaterequirements.json')
        d = json.load(f)
        f.close()
        self.iAccessRights = d['access_rights']
        iar1 = ValueTypeParameters(self.iAccessRights[0]["theName"],
                                   self.iAccessRights[0]["theDescription"],
                                   'access_right', '',
                                   self.iAccessRights[0]["theValue"],
                                   self.iAccessRights[0]["theRationale"])
        self.iSurfaceTypes = d['surface_types']
        ist1 = ValueTypeParameters(self.iSurfaceTypes[0]["theName"],
                                   self.iSurfaceTypes[0]["theDescription"],
                                   'surface_type', '',
                                   self.iSurfaceTypes[0]["theValue"],
                                   self.iSurfaceTypes[0]["theRationale"])
        b = Borg()
        b.dbProxy.addValueType(iar1)
        b.dbProxy.addValueType(ist1)
        self.iTemplateAssets = d['template_assets']
        spValues = [0, 0, 0, 0, 0, 0, 0, 0]
        srValues = [
            'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None'
        ]
        iTap = TemplateAssetParameters(
            self.iTemplateAssets[0]["theName"],
            self.iTemplateAssets[0]["theShortCode"],
            self.iTemplateAssets[0]["theDescription"],
            self.iTemplateAssets[0]["theSignificance"],
            self.iTemplateAssets[0]["theType"],
            self.iTemplateAssets[0]["theSurfaceType"],
            self.iTemplateAssets[0]["theAccessRight"], spValues, srValues, [],
            [])
        b.dbProxy.addTemplateAsset(iTap)
        oTaps = b.dbProxy.getTemplateAssets()
        self.oTap = oTaps[self.iTemplateAssets[0]["theName"]]

        self.iTemplateReqs = d["template_requirements"]
Example #16
0
def addTestData():
    f = open(os.environ['CAIRIS_SRC'] + '/test/templaterequirements.json')
    d = json.load(f)
    f.close()
    iAccessRights = d['access_rights']
    iSurfaceTypes = d['surface_types']
    iTemplateAssets = d['template_assets']
    cairis.core.BorgFactory.initialise()
    b = Borg()
    iar1 = ValueTypeParameters(iAccessRights[0]["theName"],
                               iAccessRights[0]["theDescription"],
                               'access_right', '',
                               iAccessRights[0]["theValue"],
                               iAccessRights[0]["theRationale"])
    ist1 = ValueTypeParameters(iSurfaceTypes[0]["theName"],
                               iSurfaceTypes[0]["theDescription"],
                               'surface_type', '',
                               iSurfaceTypes[0]["theValue"],
                               iSurfaceTypes[0]["theRationale"])
    b.dbProxy.addValueType(iar1)
    b.dbProxy.addValueType(ist1)
    spValues = [(0, 'None'), (0, 'None'), (0, 'None'), (0, 'None'),
                (0, 'None'), (0, 'None'), (0, 'None'), (0, 'None')]
    iTap = TemplateAssetParameters(
        iTemplateAssets[0]["theName"], iTemplateAssets[0]["theShortCode"],
        iTemplateAssets[0]["theDescription"],
        iTemplateAssets[0]["theSignificance"], iTemplateAssets[0]["theType"],
        iTemplateAssets[0]["theSurfaceType"],
        iTemplateAssets[0]["theAccessRight"], spValues, [], [])
    b.dbProxy.addTemplateAsset(iTap)
    iTemplateReqs = d['template_requirements']
    iTar = TemplateRequirementParameters(iTemplateReqs[0]["theName"],
                                         iTemplateReqs[0]["theAsset"],
                                         iTemplateReqs[0]["theType"],
                                         iTemplateReqs[0]["theDescription"],
                                         iTemplateReqs[0]["theRationale"],
                                         iTemplateReqs[0]["theFitCriterion"])
    b.dbProxy.addTemplateRequirement(iTar)
Example #17
0
 def setUp(self):
     call([os.environ['CAIRIS_CFG_DIR'] + "/initdb.sh"])
     cairis.core.BorgFactory.initialise()
     f = open(os.environ['CAIRIS_SRC'] + '/test/templategoals.json')
     d = json.load(f)
     f.close()
     iAccessRights = d['access_rights']
     iar1 = ValueTypeParameters(iAccessRights[0]["theName"],
                                iAccessRights[0]["theDescription"],
                                'access_right', '',
                                iAccessRights[0]["theValue"],
                                iAccessRights[0]["theRationale"])
     iSurfaceTypes = d['surface_type']
     ist1 = ValueTypeParameters(iSurfaceTypes[0]["theName"],
                                iSurfaceTypes[0]["theDescription"],
                                'surface_type', '',
                                iSurfaceTypes[0]["theValue"],
                                iSurfaceTypes[0]["theRationale"])
     b = Borg()
     b.dbProxy.addValueType(iar1)
     b.dbProxy.addValueType(ist1)
     iTemplateAssets = d['template_assets']
     spValues = [0, 0, 0, 0, 0, 0, 0, 0]
     srValues = [
         'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None'
     ]
     iTap = TemplateAssetParameters(iTemplateAssets[0]["theName"],
                                    iTemplateAssets[0]["theShortCode"],
                                    iTemplateAssets[0]["theDescription"],
                                    iTemplateAssets[0]["theSignificance"],
                                    iTemplateAssets[0]["theType"],
                                    iTemplateAssets[0]["theSurfaceType"],
                                    iTemplateAssets[0]["theAccessRight"],
                                    spValues, srValues, [], [])
     b.dbProxy.addTemplateAsset(iTap)
     self.iTemplateGoals = d['template_goals']
 def endElement(self, name):
     if (name == 'component'):
         p = ComponentParameters(self.theName, self.theDescription,
                                 self.theInterfaces, self.theStructure,
                                 self.theComponentRequirements,
                                 self.theComponentGoals,
                                 self.theComponentGoalAssociations)
         self.theComponents.append(p)
         self.resetComponentAttributes()
     elif name == 'role':
         p = RoleParameters(self.theName, self.theType, self.theShortCode,
                            self.theDescription, [])
         self.theRoles.append(p)
         self.resetRoleAttributes()
     elif name == 'asset':
         spDict = {}
         spDict['confidentiality'] = 0
         spDict['integrity'] = 0
         spDict['availability'] = 0
         spDict['accountability'] = 0
         spDict['anonymity'] = 0
         spDict['pseudonymity'] = 0
         spDict['unlinkability'] = 0
         spDict['unobservability'] = 0
         srDict = {}
         srDict['confidentiality'] = 'None'
         srDict['integrity'] = 'None'
         srDict['availability'] = 'None'
         srDict['accountability'] = 'None'
         srDict['anonymity'] = 'None'
         srDict['pseudonymity'] = 'None'
         srDict['unlinkability'] = 'None'
         srDict['unobservability'] = 'None'
         for sp in self.theSecurityProperties:
             spName = sp[0]
             spValue = a2i(sp[1])
             spRationale = sp[2]
             if spName in spDict:
                 spDict[spName] = spValue
             if spName in srDict:
                 srDict[spName] = 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'])
         srValues = []
         srValues.append(srDict['confidentiality'])
         srValues.append(srDict['integrity'])
         srValues.append(srDict['availability'])
         srValues.append(srDict['accountability'])
         srValues.append(srDict['anonymity'])
         srValues.append(srDict['pseudonymity'])
         srValues.append(srDict['unlinkability'])
         srValues.append(srDict['unobservability'])
         p = TemplateAssetParameters(
             self.theName, self.theShortCode, self.theDescription,
             self.theSignificance, self.theAssetType, self.theSurfaceType,
             self.theAccessRight, spValues, srValues, 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 == 'structure':
         self.theStructure.append(
             (self.theHeadName, self.theHeadAdornment, self.theHeadNav,
              self.theHeadNry, self.theHeadRole, self.theTailRole,
              self.theTailNry, self.theTailNav, self.theTailAdornment,
              self.theTailName))
         self.resetStructure()
     elif name == 'requirement':
         p = TemplateRequirementParameters(self.theReqName, self.theAsset,
                                           self.theType,
                                           self.theDescription,
                                           self.theRationale,
                                           self.theFitCriterion)
         self.theRequirements.append(p)
         self.resetRequirementAttributes()
     elif name == 'goal':
         p = TemplateGoalParameters(self.theName, self.theDefinition,
                                    self.theRationale, self.theConcerns,
                                    self.theResponsibilities)
         self.theGoals.append(p)
         self.resetGoalAttributes()
     elif name == 'connector':
         p = ConnectorParameters(self.theName, self.theViewName,
                                 self.theFromName, self.theFromRole,
                                 self.theFromInterface, self.theToName,
                                 self.theToInterface, self.theToRole,
                                 self.theConnectorAsset,
                                 self.theProtocolName, self.theAccessRight)
         self.theConnectors.append(p)
         self.resetConnectorAttributes()
     elif name == 'component_goal_association':
         self.theComponentGoalAssociations.append(
             (self.theGoalName, self.theSubGoalName, self.theRefType,
              self.theRationale))
         self.resetComponentGoalAssociationAttributes()
     elif name == 'description':
         self.inDescription = 0
     elif name == 'definition':
         self.inDefinition = 0
     elif name == 'synopsis':
         self.inSynopsis = 0
     elif name == 'rationale':
         self.inRationale = 0
     elif name == 'significance':
         self.inSignificance = 0
     elif name == 'fit_criterion':
         self.inFitCriterion = 0
     elif name == 'access_right' or name == 'protocol' or name == 'privilege' or name == 'surface_type':
         p = ValueTypeParameters(self.theName, self.theDescription, name,
                                 '', self.theScore, self.theRationale)
         self.theMetricTypes.append(p)
         self.resetValueTypeAttributes()
     elif name == 'architectural_pattern':
         self.theViewParameters = ComponentViewParameters(
             self.theViewName, self.theSynopsis, self.theMetricTypes,
             self.theRoles, self.theAssets, self.theRequirements,
             self.theGoals, self.theComponents, self.theConnectors)
 def parameters(self):
   parameters = TemplateAssetParameters(self.theAssetName,self.theShortCode,self.theAssetDescription,self.theAssetSignificance,self.theType,self.theSurfaceType,self.theAccessRight,self.theSecurityProperties,self.theTags,self.theInterfaces)
   parameters.setId(self.theAssetId)
   return parameters