예제 #1
0
  def update_asset_properties(self, props, name, existing_params=None):
    if existing_params is None:
      asset = self.get_asset_by_name(name, simplify=False)

      existing_params = AssetParameters(
        assetName=asset.theName,
        shortCode=asset.theShortCode,
        assetDesc=asset.theDescription,
        assetSig=asset.theSignificance,
        assetType=asset.theType,
        cFlag=asset.isCritical,
        cRationale=asset.theCriticalRationale,
        tags=asset.theTags,
        ifs=asset.theInterfaces,
        cProperties=[]
      )
      existing_params.setId(asset.theId)

    existing_params.theEnvironmentProperties = props

    try:
      self.db_proxy.updateAsset(existing_params)
    except DatabaseProxyException as ex:
      self.close()
      raise ARMHTTPError(ex)
    except ARMException as ex:
      self.close()
      raise ARMHTTPError(ex)
예제 #2
0
    def update_asset(self, asset, name):
        old_asset = self.get_asset_by_name(name, simplify=False)
        id = old_asset.theId

        params = AssetParameters(
            assetName=asset.theName,
            shortCode=asset.theShortCode,
            assetDesc=asset.theDescription,
            assetSig=asset.theSignificance,
            assetType=asset.theType,
            cFlag=asset.isCritical,
            cRationale=asset.theCriticalRationale,
            tags=asset.theTags,
            ifs=asset.theInterfaces,
            cProperties=asset.theEnvironmentProperties
        )
        params.setId(id)

        try:
            self.db_proxy.updateAsset(params)
        except DatabaseProxyException as ex:
            self.close()
            raise ARMHTTPError(ex)
        except ARMException as ex:
            self.close()
            raise ARMHTTPError(ex)
예제 #3
0
    def update_asset_properties(self, props, name, existing_params=None):
        if existing_params is None:
            asset = self.get_asset_by_name(name, simplify=False)

            existing_params = AssetParameters(
                assetName=asset.theName,
                shortCode=asset.theShortCode,
                assetDesc=asset.theDescription,
                assetSig=asset.theSignificance,
                assetType=asset.theType,
                cFlag=asset.isCritical,
                cRationale=asset.theCriticalRationale,
                tags=asset.theTags,
                ifs=asset.theInterfaces,
                cProperties=[]
            )
            existing_params.setId(asset.theId)

        existing_params.theEnvironmentProperties = props

        try:
            self.db_proxy.updateAsset(existing_params)
        except DatabaseProxyException as ex:
            self.close()
            raise ARMHTTPError(ex)
        except ARMException as ex:
            self.close()
            raise ARMHTTPError(ex)
예제 #4
0
    def update_asset(self, asset, name):
        old_asset = self.get_asset_by_name(name, simplify=False)
        id = old_asset.theId

        params = AssetParameters(
            assetName=asset.theName,
            shortCode=asset.theShortCode,
            assetDesc=asset.theDescription,
            assetSig=asset.theSignificance,
            assetType=asset.theType,
            cFlag=asset.isCritical,
            cRationale=asset.theCriticalRationale,
            tags=asset.theTags,
            ifs=asset.theInterfaces,
            cProperties=asset.theEnvironmentProperties
        )
        params.setId(id)

        try:
            self.db_proxy.updateAsset(params)
        except DatabaseProxyException as ex:
            self.close()
            raise ARMHTTPError(ex)
        except ARMException as ex:
            self.close()
            raise ARMHTTPError(ex)
예제 #5
0
    def update_object(self, asset, name):
        params = AssetParameters(assetName=asset.theName,
                                 shortCode=asset.theShortCode,
                                 assetDesc=asset.theDescription,
                                 assetSig=asset.theSignificance,
                                 assetType=asset.theType,
                                 cFlag=asset.isCritical,
                                 cRationale=asset.theCriticalRationale,
                                 tags=asset.theTags,
                                 ifs=asset.theInterfaces,
                                 cProperties=asset.theEnvironmentProperties)

        try:
            assetId = self.db_proxy.getDimensionId(name, 'asset')
            params.setId(assetId)
            self.db_proxy.updateAsset(params)
            return asset.theName
        except ObjectNotFound as ex:
            self.close()
            raise ObjectNotFoundHTTPError(ex)
        except DatabaseProxyException as ex:
            self.close()
            raise ARMHTTPError(ex)
        except ARMException as ex:
            self.close()
            raise ARMHTTPError(ex)
예제 #6
0
파일: AssetDAO.py 프로젝트: failys/cairis
  def update_asset(self, asset, name):
    params = AssetParameters(
      assetName=asset.theName,
      shortCode=asset.theShortCode,
      assetDesc=asset.theDescription,
      assetSig=asset.theSignificance,
      assetType=asset.theType,
      cFlag=asset.isCritical,
      cRationale=asset.theCriticalRationale,
      tags=asset.theTags,
      ifs=asset.theInterfaces,
      cProperties=asset.theEnvironmentProperties
    )

    try:
      assetId = self.db_proxy.getDimensionId(name,'asset')
      params.setId(assetId)
      self.db_proxy.updateAsset(params)
      return asset.theName
    except ObjectNotFound as ex:
      self.close()
      raise ObjectNotFoundHTTPError(ex)
    except DatabaseProxyException as ex:
      self.close()
      raise ARMHTTPError(ex)
    except ARMException as ex:
      self.close()
      raise ARMHTTPError(ex)
예제 #7
0
 def parameters(self):
     parameters = AssetParameters(
         self.theAssetName, self.theShortCode, self.theAssetDescription,
         self.theAssetSignificance, self.theType, self.theCriticalIndicator,
         self.theCriticalRationale, self.theTags, self.theInterfaces,
         self.theEnvironmentProperties)
     parameters.setId(self.theAssetId)
     return parameters
예제 #8
0
 def parameters(self):
   parameters = AssetParameters(self.theAssetName,self.theShortCode,self.theAssetDescription,self.theAssetSignificance,self.theType,self.theCriticalIndicator,self.theCriticalRationale,self.theTags,self.theInterfaces,self.theEnvironmentProperties)
   parameters.setId(self.theAssetId)
   return parameters