Commit a3f34e89 authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade nuevos campos para configurar capas

parent 3f6c3813
Loading
Loading
Loading
Loading
+144 −0
Original line number Diff line number Diff line
package es.redmic.atlaslib.dto.layer;

/*-
 * #%L
 * Atlas-lib
 * %%
 * Copyright (C) 2019 - 2021 REDMIC Project / Server
 * %%
 * 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.
 * #L%
 */

import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaFormat;
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaNotNull;

import org.apache.avro.Schema;

import es.redmic.models.es.common.constraintvalidate.url.ValidateUrl;

@JsonSchemaNotNull
public class DownloadDTO extends org.apache.avro.specific.SpecificRecordBase
	implements org.apache.avro.specific.SpecificRecord {

	// @formatter:off

	@JsonIgnore
	public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse(
	"{\"type\":\"record\",\"name\":\"DownloadDTO\",\"namespace\":\"es.redmic.atlaslib.dto.layer\",\"fields\":["
			+ "{\"name\": \"name\",\"type\": \"string\"},"
			+ "{\"name\": \"url\",\"type\": \"string\"}]}");
	// @formatter:on

	@NotNull
	private String name;

	@JsonSchemaFormat("url")
	@ValidateUrl()
	@NotNull
	private String url;

	public DownloadDTO() {
	}

	public DownloadDTO(String name, String url) {

		setName(name);
		setUrl(url);
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((url == null) ? 0 : url.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;
		DownloadDTO other = (DownloadDTO) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (url == null) {
			if (other.url != null)
				return false;
		} else if (!url.equals(other.url))
			return false;
		return true;
	}

	@JsonIgnore
	@Override
	public Schema getSchema() {
		return SCHEMA$;
	}

	@JsonIgnore
	@Override
	public java.lang.Object get(int field$) {
		switch (field$) {
		case 0:
			return name;
		case 1:
			return url;
		default:
			throw new org.apache.avro.AvroRuntimeException("Bad index");
		}
	}

	@JsonIgnore
	@Override
	public void put(int field$, java.lang.Object value$) {
		switch (field$) {
		case 0:
			name = value$ != null ? value$.toString() : null;
			break;
		case 1:
			url = value$ != null ? value$.toString() : null;
			break;
		default:
			throw new org.apache.avro.AvroRuntimeException("Bad index");
		}
	}
}
+25 −0
Original line number Diff line number Diff line
@@ -50,6 +50,31 @@ public class LayerActivityDTO extends org.apache.avro.specific.SpecificRecordBas
		this.activity = activity;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((activity == null) ? 0 : activity.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;
		LayerActivityDTO other = (LayerActivityDTO) obj;
		if (activity == null) {
			if (other.activity != null)
				return false;
		} else if (!activity.equals(other.activity))
			return false;
		return true;
	}

	@JsonIgnore
	@Override
	public Schema getSchema() {
+51 −0
Original line number Diff line number Diff line
@@ -60,6 +60,13 @@ public abstract class LayerCompactDTO extends LayerBaseDTO {
	@Size(min = 1)
	private List<ProtocolDTO> protocols;

	@JsonSchemaUniqueItemsByRequiredProperties
	@Valid
	private List<DownloadDTO> downloads;

	@Valid
	private TimeDefinitionDTO timeDefinition;

	@Size(min = 0, max = 1500)
	private String description;

@@ -77,6 +84,8 @@ public abstract class LayerCompactDTO extends LayerBaseDTO {
	@NotNull
	private String urlSource;

	private String styles;

	public List<LayerActivityDTO> getActivities() {
		return this.activities;
	}
@@ -109,6 +118,22 @@ public abstract class LayerCompactDTO extends LayerBaseDTO {
		this.protocols = protocols;
	}

	public List<DownloadDTO> getDownloads() {
		return this.downloads;
	}

	public void setDownloads(List<DownloadDTO> downloads) {
		this.downloads = downloads;
	}

	public TimeDefinitionDTO getTimeDefinition() {
		return this.timeDefinition;
	}

	public void setTimeDefinition(TimeDefinitionDTO timeDefinition) {
		this.timeDefinition = timeDefinition;
	}

	public String getDescription() {
		return description;
	}
@@ -149,6 +174,14 @@ public abstract class LayerCompactDTO extends LayerBaseDTO {
		this.urlSource = urlSource;
	}

	public String getStyles() {
		return this.styles;
	}

	public void setStyles(String styles) {
		this.styles = styles;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
@@ -158,8 +191,11 @@ public abstract class LayerCompactDTO extends LayerBaseDTO {
		result = prime * result + ((description == null) ? 0 : description.hashCode());
		result = prime * result + ((latLonBoundsImage == null) ? 0 : latLonBoundsImage.hashCode());
		result = prime * result + ((protocols == null) ? 0 : protocols.hashCode());
		result = prime * result + ((downloads == null) ? 0 : downloads.hashCode());
		result = prime * result + ((timeDefinition == null) ? 0 : timeDefinition.hashCode());
		result = prime * result + ((refresh == null) ? 0 : refresh.hashCode());
		result = prime * result + ((urlSource == null) ? 0 : urlSource.hashCode());
		result = prime * result + ((styles == null) ? 0 : styles.hashCode());
		result = prime * result + ((themeInspire == null) ? 0 : themeInspire.hashCode());
		result = prime * result + ((activities == null) ? 0 : activities.hashCode());
		return result;
@@ -199,6 +235,16 @@ public abstract class LayerCompactDTO extends LayerBaseDTO {
				return false;
		} else if (!protocols.equals(other.protocols))
			return false;
		if (downloads == null) {
			if (other.downloads != null)
				return false;
		} else if (!downloads.equals(other.downloads))
			return false;
		if (timeDefinition == null) {
			if (other.timeDefinition != null)
				return false;
		} else if (!timeDefinition.equals(other.timeDefinition))
			return false;
		if (refresh == null) {
			if (other.refresh != null)
				return false;
@@ -209,6 +255,11 @@ public abstract class LayerCompactDTO extends LayerBaseDTO {
				return false;
		} else if (!urlSource.equals(other.urlSource))
			return false;
		if (styles == null) {
			if (other.styles != null)
				return false;
		} else if (!styles.equals(other.styles))
			return false;
		if (themeInspire == null) {
			if (other.themeInspire != null)
				return false;
+32 −14
Original line number Diff line number Diff line
@@ -84,11 +84,14 @@ public class LayerDTO extends LayerInfoDTO {
			+ "{\"name\":\"themeInspire\",\"type\":["+ ThemeInspireDTO.SCHEMA$ +", \"null\"]},"
			+ "{\"name\":\"latLonBoundsImage\",\"type\":[" + LatLonBoundingBoxDTO.SCHEMA$ + ", \"null\"]},"
			+ "{\"name\":\"protocols\",\"type\": [{\"type\": \"array\",\"items\":" + ProtocolDTO.SCHEMA$ + "},\"null\"]},"
			+ "{\"name\":\"downloads\",\"type\": [{\"type\": \"array\",\"items\":" + DownloadDTO.SCHEMA$ + "},\"null\"]},"
			+ "{\"name\":\"timeDefinition\",\"type\":[" + TimeDefinitionDTO.SCHEMA$ + ", \"null\"]},"
			+ "{\"name\":\"description\",\"type\":[\"string\", \"null\"]},"
			+ "{\"name\":\"alias\",\"type\":[\"string\", \"null\"]},"
			+ "{\"name\":\"atlas\",\"type\":\"boolean\", \"default\": \"false\"},"
			+ "{\"name\":\"refresh\",\"type\":\"int\", \"default\": \"0\"},"
			+ "{\"name\":\"urlSource\",\"type\":\"string\"},"
			+ "{\"name\":\"styles\",\"type\": [\"string\", \"null\"]},"
			+ "{\"name\":\"name\",\"type\":\"string\"},"
			+ "{\"name\":\"id\",\"type\":\"string\"}]}");
	// @formatter:on
@@ -337,18 +340,24 @@ public class LayerDTO extends LayerInfoDTO {
		case 20:
			return getProtocols();
		case 21:
			return getDescription();
			return getDownloads();
		case 22:
			return getAlias();
			return getTimeDefinition();
		case 23:
			return getAtlas();
			return getDescription();
		case 24:
			return getRefresh();
			return getAlias();
		case 25:
			return getUrlSource();
			return getAtlas();
		case 26:
			return getName();
			return getRefresh();
		case 27:
			return getUrlSource();
		case 28:
			return getStyles();
		case 29:
			return getName();
		case 30:
			return getId();
		default:
			throw new org.apache.avro.AvroRuntimeException("Bad index");
@@ -430,24 +439,33 @@ public class LayerDTO extends LayerInfoDTO {
			setProtocols(value != null ? (java.util.List) value : null);
			break;
		case 21:
			setDescription(value != null ? value.toString() : null);
			setDownloads(value != null ? (java.util.List) value : null);
			break;
		case 22:
			setAlias(value != null ? value.toString() : null);
			setTimeDefinition(value != null ? (TimeDefinitionDTO) value : null);
			break;
		case 23:
			setAtlas((Boolean) value);
			setDescription(value != null ? value.toString() : null);
			break;
		case 24:
			setRefresh((int) value);
			setAlias(value != null ? value.toString() : null);
			break;
		case 25:
			setUrlSource(value != null ? value.toString() : null);
			setAtlas((Boolean) value);
			break;
		case 26:
			setName(value.toString());
			setRefresh((int) value);
			break;
		case 27:
			setUrlSource(value != null ? value.toString() : null);
			break;
		case 28:
			setStyles(value != null ? value.toString() : null);
			break;
		case 29:
			setName(value.toString());
			break;
		case 30:
			setId(value.toString());
			break;
		default:
+1 −45
Original line number Diff line number Diff line
@@ -40,9 +40,7 @@ public class ProtocolDTO extends org.apache.avro.specific.SpecificRecordBase
	public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse(
		"{\"type\":\"record\",\"name\":\"ProtocolDTO\",\"namespace\":\"es.redmic.atlaslib.dto.layer\",\"fields\":["
				+ "{\"name\": \"type\",\"type\": \"string\"},"
				+ "{\"name\": \"url\",\"type\": \"string\"},"
				+ "{\"name\": \"style\",\"type\": [\"string\", \"null\"]},"
				+ "{\"name\": \"version\",\"type\": [\"string\", \"null\"]}]}");
				+ "{\"name\": \"url\",\"type\": \"string\"}]}");
	// @formatter:on

	@NotNull
@@ -53,10 +51,6 @@ public class ProtocolDTO extends org.apache.avro.specific.SpecificRecordBase
	@NotNull
	private String url;

	private String style;

	private String version;

	public ProtocolDTO() {
	}

@@ -94,30 +88,12 @@ public class ProtocolDTO extends org.apache.avro.specific.SpecificRecordBase
		this.url = url;
	}

	public String getStyle() {
		return this.style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	public String getVersion() {
		return this.version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		result = prime * result + ((url == null) ? 0 : url.hashCode());
		result = prime * result + ((style == null) ? 0 : style.hashCode());
		result = prime * result + ((version == null) ? 0 : version.hashCode());
		return result;
	}

@@ -140,16 +116,6 @@ public class ProtocolDTO extends org.apache.avro.specific.SpecificRecordBase
				return false;
		} else if (!url.equals(other.url))
			return false;
		if (style == null) {
			if (other.style != null)
				return false;
		} else if (!style.equals(other.style))
			return false;
		if (version == null) {
			if (other.version != null)
				return false;
		} else if (!version.equals(other.version))
			return false;
		return true;
	}

@@ -167,10 +133,6 @@ public class ProtocolDTO extends org.apache.avro.specific.SpecificRecordBase
			return type;
		case 1:
			return url;
		case 2:
			return style;
		case 3:
			return version;
		default:
			throw new org.apache.avro.AvroRuntimeException("Bad index");
		}
@@ -186,12 +148,6 @@ public class ProtocolDTO extends org.apache.avro.specific.SpecificRecordBase
		case 1:
			url = value$ != null ? value$.toString() : null;
			break;
		case 2:
			style = style != null ? value$.toString() : null;
			break;
		case 3:
			version = version != null ? value$.toString() : null;
			break;
		default:
			throw new org.apache.avro.AvroRuntimeException("Bad index");
		}
Loading