当前位置: 首页>>代码示例>>Java>>正文


Java DataIntegrityViolationException.getMessage方法代码示例

本文整理汇总了Java中org.springframework.dao.DataIntegrityViolationException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java DataIntegrityViolationException.getMessage方法的具体用法?Java DataIntegrityViolationException.getMessage怎么用?Java DataIntegrityViolationException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.dao.DataIntegrityViolationException的用法示例。


在下文中一共展示了DataIntegrityViolationException.getMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCIRelation

import org.springframework.dao.DataIntegrityViolationException; //导入方法依赖的package包/类
@RequestMapping(method=RequestMethod.POST, value="/cm/simple/relations")
@ResponseBody
public CmsCIRelationSimple createCIRelation(
		@RequestParam(value="value", required = false)  String valueType, 
		@RequestBody CmsCIRelationSimple relSimple,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) throws CIValidationException {
	
	scopeVerifier.verifyScope(scope, relSimple);
	
	CmsCIRelation rel = cmsUtil.custCIRelationSimple2CIRelation(relSimple, valueType);
	rel.setCreatedBy(userId);
	try {
		CmsCIRelation newRel = cmManager.createRelation(rel);
		return cmsUtil.custCIRelation2CIRelationSimple(newRel, valueType,false);
	} catch (DataIntegrityViolationException dive) {
		if (dive instanceof DuplicateKeyException) {
			throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage());
		} else {
			throw new CmsException(CmsError.CMS_EXCEPTION, dive.getMessage());
		}
	}
}
 
开发者ID:oneops,项目名称:oneops,代码行数:24,代码来源:CmRestController.java

示例2: generateDesign

import org.springframework.dao.DataIntegrityViolationException; //导入方法依赖的package包/类
@RequestMapping(value="/assemblies/{assemblyId}/platforms", method = RequestMethod.POST)
@ResponseBody
public Map<String,Long> generateDesign(
		@PathVariable long assemblyId,
		@RequestBody CmsRfcCISimple platRfcSimple,
		@RequestHeader(value="X-Cms-User", required = false)  String userId,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope){

	if (userId == null) userId = "oneops-system";
	
	long startTime = System.currentTimeMillis(); 
	
	CmsRfcCI platRfc = util.custRfcCISimple2RfcCI(platRfcSimple);
	try {
		long platformCiId = dManager.generatePlatform(platRfc, assemblyId, userId, scope);  
		Map<String,Long> result = new HashMap<>(1);
		result.put("platformCiId", platformCiId);

		long tookTime = System.currentTimeMillis() - startTime;
		logger.debug("Time to generate Design - " + tookTime);

		return result;
	} catch (DataIntegrityViolationException dive) {
		if (dive instanceof DuplicateKeyException) {
			throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage());
		} else {
			throw new TransistorException(CmsError.CMS_EXCEPTION, dive.getMessage());
		}
	} catch (CmsBaseException te) {
		logger.error(te);
		te.printStackTrace();
		throw te;
	}
}
 
开发者ID:oneops,项目名称:oneops,代码行数:35,代码来源:TransistorRestController.java

示例3: clonePlatform

import org.springframework.dao.DataIntegrityViolationException; //导入方法依赖的package包/类
@RequestMapping(value="/platforms/{fromPlatformId}/clone", method = RequestMethod.POST)
@ResponseBody
public Map<String,Long> clonePlatform(
		@PathVariable long fromPlatformId,
		@RequestBody CmsRfcCISimple platRfcSimple,
		@RequestHeader(value="X-Cms-User", required = false)  String userId,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope){

	if (userId == null) userId = "oneops-system";
	try {
		long startTime = System.currentTimeMillis(); 
		
		CmsRfcCI platRfc = util.custRfcCISimple2RfcCI(platRfcSimple);
		
		long platformId = dManager.clonePlatform(platRfc, null, fromPlatformId, userId, scope);  
		
		Map<String,Long> result = new HashMap<>(1);
		result.put("platformCiId", platformId);

		long tookTime = System.currentTimeMillis() - startTime;
		logger.debug("Time to generate Design - " + tookTime);

		return result;
	} catch (DataIntegrityViolationException dive) {
		if (dive instanceof DuplicateKeyException) {
			throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage());
		} else {
			throw new TransistorException(CmsError.CMS_EXCEPTION, dive.getMessage());
		}
	} catch (CmsBaseException te) {
		logger.error(te);
		te.printStackTrace();
		throw te;
	}
}
 
开发者ID:oneops,项目名称:oneops,代码行数:36,代码来源:TransistorRestController.java

示例4: createCISimple

import org.springframework.dao.DataIntegrityViolationException; //导入方法依赖的package包/类
@RequestMapping(method=RequestMethod.POST, value="/cm/simple/cis")
@ResponseBody
public CmsCISimple createCISimple(
		@RequestParam(value="value", required = false)  String valueType, 
		@RequestBody CmsCISimple ciSimple,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) throws CIValidationException {	
	
	scopeVerifier.verifyScope(scope, ciSimple);
	
	CmsCI newCi = cmsUtil.custCISimple2CI(ciSimple, valueType);
	newCi.setCiId(0);
	newCi.setCiGoid(null);
	newCi.setCreatedBy(userId);
	try {
		CmsCI ci = cmManager.createCI(newCi);
		updateAltNs(ci.getCiId(), ciSimple);
		logger.debug(ci.getCiId());
		CmsCISimple cmsCISimple = cmsUtil.custCI2CISimple(ci, valueType);
		cmsCISimple.setAltNs(ciSimple.getAltNs());
		return cmsCISimple;
	} catch (DataIntegrityViolationException dive) {
		if (dive instanceof DuplicateKeyException) {
			throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage());
		} else {
			throw new CmsException(CmsError.CMS_EXCEPTION, dive.getMessage());
		}
	}
}
 
开发者ID:oneops,项目名称:oneops,代码行数:30,代码来源:CmRestController.java

示例5: cloneAssembly

import org.springframework.dao.DataIntegrityViolationException; //导入方法依赖的package包/类
@RequestMapping(value="/assemblies/{fromAssemblyId}/clone", method = RequestMethod.POST)
@ResponseBody
public Map<String,Long> cloneAssembly(
		@PathVariable long fromAssemblyId,
		@RequestBody CmsCISimple targetCISimple,
		@RequestHeader(value="X-Cms-User", required = false)  String userId,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope){

	if (userId == null) userId = "oneops-system";
	try {
		long startTime = System.currentTimeMillis(); 
		
		if (targetCISimple.getCiAttributes().get("description") == null) {
			targetCISimple.addCiAttribute("description", null);
		}
		
		CmsCI targetCI = util.custCISimple2CI(targetCISimple, null);
		
		long resultCiId = 0;
		if ("account.Assembly".equals(targetCI.getCiClassName())) {
			resultCiId = dManager.cloneAssembly(targetCI, fromAssemblyId, userId, scope);
		} else if ("account.Design".equals(targetCI.getCiClassName())) {
			resultCiId = dManager.saveAssemblyAsCatalog(targetCI, fromAssemblyId, userId, scope);
		} else {
			throw new TransistorException(CmsError.TRANSISTOR_BAD_CLASS_NAME, "Bad class name");
		}
		
		Map<String,Long> result = new HashMap<>(1);
		result.put("resultCiId", resultCiId);

		long tookTime = System.currentTimeMillis() - startTime;
		logger.debug("Time to generate Assembly/Catalog - " + tookTime);

		return result;
	} catch (DataIntegrityViolationException dive) {
		if (dive instanceof DuplicateKeyException) {
			throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage());
		} else {
			throw new TransistorException(CmsError.CMS_EXCEPTION, dive.getMessage());
		}
	} catch (CmsBaseException te) {
		logger.error(te);
		te.printStackTrace();
		throw te;
	}
}
 
开发者ID:oneops,项目名称:oneops,代码行数:47,代码来源:TransistorRestController.java


注:本文中的org.springframework.dao.DataIntegrityViolationException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。