TileClimate.java

/*
 * Copyright 2018 Global Crop Diversity Trust
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.genesys.server.model.impl;

import java.time.Instant;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.annotation.LastModifiedDate;

/**
 * The TileClimate entity maintains data from worldclim.org.
 */
@Entity
@Table(name = "tile_climate", indexes = { @Index(columnList = "alt"), @Index(columnList = "tmean1"),
		@Index(columnList = "prec1"), @Index(columnList = "tmean2"), @Index(columnList = "prec2"),
		@Index(columnList = "tmean3"), @Index(columnList = "prec3"),
		@Index(columnList = "tmean4"), @Index(columnList = "prec4"),
		@Index(columnList = "tmean5"), @Index(columnList = "prec5"), @Index(columnList = "tmean6"),
		@Index(columnList = "prec6"), @Index(columnList = "tmean7"), @Index(columnList = "prec7"),
		@Index(columnList = "tmean8"), @Index(columnList = "prec8"),
		@Index(columnList = "tmean9"), @Index(columnList = "prec9"),
		@Index(columnList = "tmean10"), @Index(columnList = "prec10"), @Index(columnList = "tmean11"),
		@Index(columnList = "prec11"), @Index(columnList = "tmean12"), @Index(columnList = "prec12"),
		@Index(columnList = "bio1"), @Index(columnList = "bio2"), @Index(columnList = "bio3"), @Index(columnList = "bio4"), @Index(columnList = "bio5"),
		@Index(columnList = "bio6"), @Index(columnList = "bio7"), @Index(columnList = "bio8"), @Index(columnList = "bio9"), @Index(columnList = "bio10"),
		@Index(columnList = "bio11"), @Index(columnList = "bio12"), @Index(columnList = "bio13"), @Index(columnList = "bio14"), @Index(columnList = "bio15"),
		@Index(columnList = "bio16"), @Index(columnList = "bio17"), @Index(columnList = "bio18"), @Index(columnList = "bio19") })
@Getter
@Setter
@NoArgsConstructor
public class TileClimate {
	@Id
	private long tileIndex;

	private Double alt;

	private Double bio1;
	private Double bio2;
	private Double bio3;
	private Double bio4;
	private Double bio5;
	private Double bio6;
	private Double bio7;
	private Double bio8;
	private Double bio9;
	private Double bio10;
	private Double bio11;
	private Double bio12;
	private Double bio13;
	private Double bio14;
	private Double bio15;
	private Double bio16;
	private Double bio17;
	private Double bio18;
	private Double bio19;

	private Double prec1;
	private Double prec2;
	private Double prec3;
	private Double prec4;
	private Double prec5;
	private Double prec6;
	private Double prec7;
	private Double prec8;
	private Double prec9;
	private Double prec10;
	private Double prec11;
	private Double prec12;

	private Double tmax1;
	private Double tmax2;
	private Double tmax3;
	private Double tmax4;
	private Double tmax5;
	private Double tmax6;
	private Double tmax7;
	private Double tmax8;
	private Double tmax9;
	private Double tmax10;
	private Double tmax11;
	private Double tmax12;

	private Double tmean1;
	private Double tmean2;
	private Double tmean3;
	private Double tmean4;
	private Double tmean5;
	private Double tmean6;
	private Double tmean7;
	private Double tmean8;
	private Double tmean9;
	private Double tmean10;
	private Double tmean11;
	private Double tmean12;

	private Double tmin1;
	private Double tmin2;
	private Double tmin3;
	private Double tmin4;
	private Double tmin5;
	private Double tmin6;
	private Double tmin7;
	private Double tmin8;
	private Double tmin9;
	private Double tmin10;
	private Double tmin11;
	private Double tmin12;

	/**
	 * Allows us to track when the tile climate was last updated!
	 */
	@LastModifiedDate
	private Instant modifiedDate;
	
	public TileClimate(Long tileIndex) {
		this.tileIndex = tileIndex;
	}
}