本文整理汇总了Java中com.thoughtworks.xstream.core.BaseException类的典型用法代码示例。如果您正苦于以下问题:Java BaseException类的具体用法?Java BaseException怎么用?Java BaseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseException类属于com.thoughtworks.xstream.core包,在下文中一共展示了BaseException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDataObjectFromXML
import com.thoughtworks.xstream.core.BaseException; //导入依赖的package包/类
/**
* Get data object from XML
*
* <p>
* Retrieves substring of document contents from maintainable tag name. Then use xml service to translate xml into
* a business object.
* </p>
*
* @param maintainableTagName the xml tag name of the maintainable
* @return data object
*/
protected Object getDataObjectFromXML(String maintainableTagName) {
String maintXml = StringUtils.substringBetween(xmlDocumentContents, "<" + maintainableTagName + ">",
"</" + maintainableTagName + ">");
/**
* Start IU Customization
*/
try {
Object businessObject = KRADServiceLocator.getXmlObjectSerializerService().fromXml(maintXml);
return businessObject;
} catch (BaseException e) {
String convertedXml = KRADServiceLocatorWeb.getMaintainableXMLConversionService().transformMaintainableXML(maintXml);
return KRADServiceLocator.getXmlObjectSerializerService().fromXml(convertedXml);
}
/**
* End IU Customization
*/
}
示例2: getDataObjectFromXML
import com.thoughtworks.xstream.core.BaseException; //导入依赖的package包/类
/**
* Get data object from XML
*
* <p>
* Retrieves substring of document contents from maintainable tag name. Then use xml service to translate xml into
* a business object.
* </p>
*
* @param maintainableTagName the xml tag name of the maintainable
* @return data object
*/
protected Object getDataObjectFromXML(String maintainableTagName) {
String maintXml = StringUtils.substringBetween(xmlDocumentContents, "<" + maintainableTagName + ">",
"</" + maintainableTagName + ">");
/*KULRICE-12304*/
try {
boolean ignoreMissingFields = false;
String classAndDocTypeNames = ConfigContext.getCurrentContextConfig().getProperty(KRADConstants.Config.IGNORE_MISSIONG_FIELDS_ON_DESERIALIZE);
if (!StringUtils.isEmpty(classAndDocTypeNames)) {
String classNameOnXML = StringUtils.substringBetween(xmlDocumentContents, "<" + maintainableTagName + "><", ">");
String classNamesNoSpaces = removeSpacesAround(classAndDocTypeNames);
List<String> classAndDocTypeNamesList = Arrays.asList(org.apache.commons.lang.StringUtils.split(classNamesNoSpaces, ","));
String originalDocTypeId = getDocumentHeader().getWorkflowDocument().getDocumentTypeId();
DocumentType docType = KewApiServiceLocator.getDocumentTypeService().getDocumentTypeById(originalDocTypeId);
while (docType != null && !ignoreMissingFields) {
for(String classNameOrDocTypeName : classAndDocTypeNamesList){
if (docType.getName().equalsIgnoreCase(classNameOrDocTypeName) ||
classNameOnXML.equalsIgnoreCase(classNameOrDocTypeName)) {
ignoreMissingFields = true;
break;
}
}
if (!StringUtils.isEmpty(docType.getParentId())) {
docType = KewApiServiceLocator.getDocumentTypeService().getDocumentTypeById(docType.getParentId());
} else {
docType = null;
}
}
}
if (!ignoreMissingFields) {
return KRADServiceLocator.getXmlObjectSerializerService().fromXml(maintXml);
} else {
return KRADServiceLocator.getXmlObjectSerializerIgnoreMissingFieldsService().fromXml(maintXml);
}
}catch (BaseException e) {
String convertedXml = KRADServiceLocatorWeb.getMaintainableXMLConversionService().transformMaintainableXML(maintXml);
return KRADServiceLocator.getXmlObjectSerializerService().fromXml(convertedXml);
}/*KULRICE-12304*/
}
示例3: serialize
import com.thoughtworks.xstream.core.BaseException; //导入依赖的package包/类
public byte[] serialize(Serializable o) {
try {
return xStream.toXML(o).getBytes();
} catch (BaseException e) {
throw new SerializationException(e);
}
}
示例4: deserialize
import com.thoughtworks.xstream.core.BaseException; //导入依赖的package包/类
public Object deserialize(byte[] data) throws CheckedSerializationException {
try {
return xStream.fromXML(new String(data));
} catch (BaseException e) {
throw new CheckedSerializationException(e);
}
}