/*
 * Unique Schlüssel für JPA Entität
 */
package de.ivu.elect.business.geodata.entity;
import java.util.function.Function;
import java.util.ArrayList;
import java.util.stream.Collectors;

@javax.enterprise.inject.Vetoed
public class GeodataOrtUK
implements de.ivu.elect.jee.entity.tk.EntityUK, java.io.Serializable
  {

  private static final long serialVersionUID = 1L;

    protected final java.lang.String ortsname;

    public java.lang.String getOrtsname(){
      return ortsname;
    }
    protected final java.lang.String ortsteilname;

    public java.lang.String getOrtsteilname(){
      return ortsteilname;
    }


  public GeodataOrtUK(
java.lang.String ortsname
, java.lang.String ortsteilname
  ) {
    super();


      this.ortsname = ortsname;
      this.ortsteilname = ortsteilname;
      }

  @Override
  public int hashCode() {
        int result = 1;
    
    
                    result = result + ((ortsname == null) ? 0 : ortsname.hashCode());
                    result = result + ((ortsteilname == null) ? 0 : ortsteilname.hashCode());
        
            
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (obj == null) {
      return false;
    }

    
    if (getClass() != obj.getClass()) {
      return false;
    }

            GeodataOrtUK other = (GeodataOrtUK) obj;

                if (ortsname == null) {
          if (other.ortsname != null) {
            return false;
          }
        } else if (!ortsname.equals(other.ortsname)) {
          return false;
        }
                if (ortsteilname == null) {
          if (other.ortsteilname != null) {
            return false;
          }
        } else if (!ortsteilname.equals(other.ortsteilname)) {
          return false;
        }
        
            
    return true;
  }

  @Override
  public String getEntityMessageKey() {
    return GeodataOrtConstants.MESSAGE_KEY_ENTITY_EINZAHL;
  }

  @Override
  public java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> getAllEntityFieldValues() {
    java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> result = new java.util.ArrayList<>();

    result.addAll(getEntityFieldValuesForEntity());
    return result;
  }

  @Override
  public java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> getEntityFieldValuesForEntity() {
            java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> result = new java.util.ArrayList<>();

                    result.add(new de.ivu.elect.jee.entity.tk.EntityFieldValue(GeodataOrtConstants.MESSAGE_KEY_ENTITY_EINZAHL, GeodataOrtConstants.MESSAGE_KEY_ORTSNAME_EINZAHL, ortsname));
                    result.add(new de.ivu.elect.jee.entity.tk.EntityFieldValue(GeodataOrtConstants.MESSAGE_KEY_ENTITY_EINZAHL, GeodataOrtConstants.MESSAGE_KEY_ORTSTEILNAME_EINZAHL, ortsteilname));
        
        return result;
      }
  
    @Override
  public String toString() {
    return "GeodataOrtUK[" + toStringParameter() + "]";
  }

            protected String toStringParameter() {
              String result = ""

                                                        +"ortsname="+ortsname
                            +", "                +"ortsteilname="+ortsteilname
                                    ;
                          return result;
            
            }




          public String allUKFields() {
    return String.join(", ", getAllUKFieldValues().stream()
         .map(object -> (object != null ? object.toString() : null))
         .collect(Collectors.toList()));
    }

   protected ArrayList<Object> getAllUKFieldValues() {
              ArrayList<Object> list = new ArrayList<>();
              list.add(ortsname);
         list.add(ortsteilname);
     return list;
   }

            public static <E extends GeodataOrt> java.util.Map<GeodataOrtUK, E> mappeGeodataOrtNachUK(java.util.Collection<E> entities) {

                return entities.stream().collect(java.util.stream.Collectors.toMap(GeodataOrt::getGeodataOrtUK, Function.<E>identity(), (u,v)->v));
             }


                public static Function<GeodataOrt, GeodataOrtUK> getGeodataOrtToUKFunction() {
                return GeodataOrt::getGeodataOrtUK;
                }

}
