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


Java BaseException类代码示例

本文整理汇总了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
     */
}
 
开发者ID:ewestfal,项目名称:rice-xml-converter,代码行数:29,代码来源:MaintenanceDocumentBase.java

示例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*/
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:51,代码来源:MaintenanceDocumentBase.java

示例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);
    }
}
 
开发者ID:HeinrichHartmann,项目名称:RequestDispatcher,代码行数:8,代码来源:SerializerImplXml.java

示例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);
    }
}
 
开发者ID:HeinrichHartmann,项目名称:RequestDispatcher,代码行数:8,代码来源:SerializerImplXml.java


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