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)
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)
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)
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)
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
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