package com.axelor.data;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAliasType;
import com.thoughtworks.xstream.annotations.XStreamInclude;

public class XStreamUtils {

  public static XStream createXStream() {
    return setupSecurity(new XStream());
  }

  public static XStream setupSecurity(XStream xStream) {
    XStream.setupDefaultSecurity(xStream);
    // Permission for any type which is annotated with an XStream annotation.
    xStream.addPermission(
        type -> {
          if (type == null) {
            return false;
          }
          return ((Class<?>) type).isAnnotationPresent(XStreamAlias.class)
              || ((Class<?>) type).isAnnotationPresent(XStreamAliasType.class)
              || ((Class<?>) type).isAnnotationPresent(XStreamInclude.class);
        });
    return xStream;
  }
}

@@ -1,8 +1,712 @@
+/*%0A * Axelor Business Solutions%0A *%0A * Copyright (C) 2005-2019 Axelor (%3Chttp://axelor.com%3E).%0A *%0A * This program is free software: you can redistribute it and/or  modify%0A * it under the terms of the GNU Affero General Public License, version 3,%0A * as published by the Free Software Foundation.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A
 package 

Add missing license header