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

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

  private static final long serialVersionUID = 1L;

    protected final java.lang.Long position;

    public java.lang.Long getPosition(){
      return position;
    }

  protected final de.ivu.elect.business.gebietsbaum.entity.GebietUK gebietUK;

    public de.ivu.elect.business.gebietsbaum.entity.GebietUK getGebietUK(){
      return gebietUK;
    }

  public GebietPolygonPointUK(
java.lang.Long position
,   de.ivu.elect.business.gebietsbaum.entity.GebietUK gebietUK
  ) {
    super();


      this.position = position;
        this.gebietUK = gebietUK;
    }

  @Override
  public int hashCode() {
        int result = 1;
    
    
                    result = result + ((position == null) ? 0 : position.hashCode());
        
                    result = result + ((gebietUK == null) ? 0 : gebietUK.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;
    }

            GebietPolygonPointUK other = (GebietPolygonPointUK) obj;

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

  @Override
  public String getEntityMessageKey() {
    return GebietPolygonPointConstants.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());
    result.addAll(gebietUK.getAllEntityFieldValues());
    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(GebietPolygonPointConstants.MESSAGE_KEY_ENTITY_EINZAHL, GebietPolygonPointConstants.MESSAGE_KEY_POSITION_EINZAHL, position));
        
        return result;
      }
  
    @Override
  public String toString() {
    return "GebietPolygonPointUK[" + toStringParameter() + "]";
  }

            protected String toStringParameter() {
              String result = ""

                                                        +"position="+position
                                        +", "                +"gebietUK="+gebietUK
                        ;
                          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(position);
     return list;
   }

            public static <E extends GebietPolygonPoint> java.util.Map<GebietPolygonPointUK, E> mappeGebietPolygonPointNachUK(java.util.Collection<E> entities) {

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


                public static Function<GebietPolygonPoint, GebietPolygonPointUK> getGebietPolygonPointToUKFunction() {
                return GebietPolygonPoint::getGebietPolygonPointUK;
                }

}
