// Path: olastic-core/src/main/java/com/hevelian/olastic/core/serializer/utils/SerializeUtils.java
// public static FullQualifiedName getPropertyType(Object value) {
//     FullQualifiedName fqn = null;
//     if (value instanceof String) {
//         fqn = EdmPrimitiveTypeKind.String.getFullQualifiedName();
//     } else if (value instanceof Byte) {
//         fqn = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
//     } else if (value instanceof Short) {
//         fqn = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
//     } else if (value instanceof Integer) {
//         fqn = EdmPrimitiveTypeKind.Int32.getFullQualifiedName();
//     } else if (value instanceof Long) {
//         fqn = EdmPrimitiveTypeKind.Int64.getFullQualifiedName();
//     } else if (value instanceof Double) {
//         fqn = EdmPrimitiveTypeKind.Double.getFullQualifiedName();
//     } else if (value instanceof Boolean) {
//         fqn = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
//     } else if (value instanceof Date) {
//         fqn = EdmPrimitiveTypeKind.Date.getFullQualifiedName();
//     } else {
//         throw new ODataRuntimeException("Property type is not supported.");
//     }
//     return fqn;
// }


import static com.hevelian.olastic.core.serializer.utils.SerializeUtils.getPropertyType;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
import org.apache.olingo.commons.core.edm.EdmPropertyImpl;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
import org.apache.olingo.server.core.serializer.utils.ExpandSelectHelper;
import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializer;
package com.hevelian.olastic.core.serializer.xml;





/**
 * Custom implementation of {@link ODataXmlSerializer} to override some default
 * behavior.
 * 
 * @author rdidyk
 */
public class ElasticODataXmlSerializer extends ODataXmlSerializer {

    @Override
    protected void writeProperties(ServiceMetadata metadata, EdmStructuredType type,
            List<Property> properties, SelectOption select, String xml10InvalidCharReplacement,
            XMLStreamWriter writer) throws XMLStreamException, SerializerException {
        boolean all = ExpandSelectHelper.isAll(select);
// Path: olastic-core/src/main/java/com/hevelian/olastic/core/serializer/utils/SerializeUtils.java
// public static FullQualifiedName getPropertyType(Object value) {
//     FullQualifiedName fqn = null;
//     if (value instanceof String) {
//         fqn = EdmPrimitiveTypeKind.String.getFullQualifiedName();
//     } else if (value instanceof Byte) {
//         fqn = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
//     } else if (value instanceof Short) {
//         fqn = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
//     } else if (value instanceof Integer) {
//         fqn = EdmPrimitiveTypeKind.Int32.getFullQualifiedName();
//     } else if (value instanceof Long) {
//         fqn = EdmPrimitiveTypeKind.Int64.getFullQualifiedName();
//     } else if (value instanceof Double) {
//         fqn = EdmPrimitiveTypeKind.Double.getFullQualifiedName();
//     } else if (value instanceof Boolean) {
//         fqn = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
//     } else if (value instanceof Date) {
//         fqn = EdmPrimitiveTypeKind.Date.getFullQualifiedName();
//     } else {
//         throw new ODataRuntimeException("Property type is not supported.");
//     }
//     return fqn;
// }


// Path: olastic-core/src/main/java/com/hevelian/olastic/core/serializer/xml/ElasticODataXmlSerializer.java
import static com.hevelian.olastic.core.serializer.utils.SerializeUtils.getPropertyType;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
import org.apache.olingo.commons.core.edm.EdmPropertyImpl;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
import org.apache.olingo.server.core.serializer.utils.ExpandSelectHelper;
import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializer;

package com.hevelian.olastic.core.serializer.xml;





/**
 * Custom implementation of {@link ODataXmlSerializer} to override some default
 * behavior.
 * 
 * @author rdidyk
 */
public class ElasticODataXmlSerializer extends ODataXmlSerializer {

    @Override
    protected void writeProperties(ServiceMetadata metadata, EdmStructuredType type,
            List<Property> properties, SelectOption select, String xml10InvalidCharReplacement,
            XMLStreamWriter writer) throws XMLStreamException, SerializerException {
        boolean all = ExpandSelectHelper.isAll(select);
        Set<String> selected = all ? new HashSet<>()