All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alipay.v3.util.schema.sdk.ServiceSchemaUtil Maven / Gradle / Ivy

The newest version!
/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2021 All Rights Reserved.
 */
package com.alipay.v3.util.schema.sdk;

import com.alipay.v3.util.schema.api.ServiceSchemaWriter;
import com.alipay.v3.util.schema.exception.SchemaException;
import com.alipay.v3.util.schema.model.attribute.Attribute;
import com.alipay.v3.util.schema.model.attribute.SingleAttribute;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author junying
 * @version : ServiceSchemaUtil.java, v 0.1 2021年03月24日 5:04 下午 junying Exp $
 */
public class ServiceSchemaUtil {
    public static String schemaXmlString(ServiceSchema serviceSchema, Map xmlMap) throws SchemaException {

        SingleAttribute serviceName = (SingleAttribute) xmlMap.get("serviceName");
        serviceName.setValue(serviceSchema.getServiceName());
        xmlMap.put("serviceName", serviceName);
        SingleAttribute serviceDesc = (SingleAttribute) xmlMap.get("serviceDesc");
        serviceDesc.setValue(serviceSchema.getServiceDesc());
        xmlMap.put("serviceDesc", serviceDesc);

        //        MultiComplexAttribute serviceUrl = (serviceUrl)xmlMap.get("serviceUrl");
        //        List serviceUrlAttributes = new ArrayList();

        List attributeList = new ArrayList();
        attributeList.add(xmlMap.get("serviceName"));
        attributeList.add(xmlMap.get("serviceDesc"));
        attributeList.add(xmlMap.get("serviceUrl"));
        return ServiceSchemaWriter.writeSchemaXmlString(attributeList);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy