PdDContext.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */


  20. package org.openspcoop2.pdd.core;

  21. import java.io.Serializable;

  22. import org.openspcoop2.protocol.sdk.Context;
  23. import org.openspcoop2.utils.MapKey;

  24. /**
  25.  * PdDContext
  26.  *
  27.  *
  28.  * @author Poli Andrea (apoli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. public class PdDContext extends Context implements Serializable {
  33.    
  34.     public PdDContext() {
  35.         super();
  36.     }

  37.     /**
  38.      *
  39.      */
  40.     private static final long serialVersionUID = -2577197242840238762L;
  41.    
  42.     public static String getValue(MapKey<String> key,PdDContext pddContext){
  43.         String value = null;
  44.         if(pddContext!=null){
  45.             Object o = pddContext.getObject(key);
  46.             if(o instanceof String ){
  47.                 value = (String) o;
  48.             }
  49.         }
  50.         return value;
  51.     }
  52.    
  53.     @Override
  54.     public Object clone() {
  55.         PdDContext newPdDContext = new PdDContext();
  56.         if(!this.isEmpty()) {
  57.             for (MapKey<String> key : this.keySet()) {
  58.                 Object o = this.getObject(key);
  59.                 newPdDContext.addObject(key, o);
  60.             }
  61.         }
  62.         return newPdDContext;
  63.     }
  64. }