Commit 9a0e2163 authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade componentes para datos de observaciones

parent 0bf22d21
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
package es.redmic.api.privatedata.controller;

/*-
 * #%L
 * API
 * %%
 * Copyright (C) 2024 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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import es.redmic.api.common.controller.RController;
import es.redmic.api.privatedata.dto.ObservationSeriesDTO;
import es.redmic.api.privatedata.model.ObservationSeries;
import es.redmic.api.privatedata.service.ObservationSeriesESService;
import es.redmic.models.es.common.query.dto.DataQueryDTO;

@RestController
@RequestMapping("${controller.mapping.PRIVATE_OBSERVATIONSERIES}")
public class ObservationSeriesController
	extends RController<ObservationSeries, ObservationSeriesDTO, DataQueryDTO> {

	@Autowired
	public ObservationSeriesController(ObservationSeriesESService observationSeriesESService) {
		super(observationSeriesESService);
	}
}
+92 −0
Original line number Diff line number Diff line
package es.redmic.api.privatedata.dto;

import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/*-
 * #%L
 * API
 * %%
 * Copyright (C) 2024 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 es.redmic.models.es.administrative.taxonomy.dto.AnimalTaxonomyCompactDTO;
import es.redmic.models.es.administrative.taxonomy.dto.TaxonomyCompactDTO;
import es.redmic.models.es.common.dto.DomainDTO;
import es.redmic.models.es.maintenance.device.dto.DeviceCompactDTO;

public class ObservationDTO {

	private String note;

	@JsonIgnoreProperties(value = {"_meta"})
	@NotNull
	private TaxonomyCompactDTO taxonomy;

	@JsonIgnoreProperties(value = {"_meta"})
	@NotNull
	private DeviceCompactDTO device;

	@JsonIgnoreProperties(value = {"_meta"})
	@NotNull
	private AnimalTaxonomyCompactDTO animal;

	@JsonIgnoreProperties(value = {"_meta"})
	@NotNull
	private DomainDTO observationType;

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public TaxonomyCompactDTO getTaxonomy() {
		return taxonomy;
	}

	public void setTaxonomy(TaxonomyCompactDTO taxonomy) {
		this.taxonomy = taxonomy;
	}

	public DeviceCompactDTO getDevice() {
		return device;
	}

	public void setDevice(DeviceCompactDTO device) {
		this.device = device;
	}

	public AnimalTaxonomyCompactDTO getAnimal() {
		return animal;
	}

	public void setAnimal(AnimalTaxonomyCompactDTO animal) {
		this.animal = animal;
	}

	public DomainDTO getObservationType() {
		return observationType;
	}

	public void setObservationType(DomainDTO observationType) {
		this.observationType = observationType;
	}
}
+157 −0
Original line number Diff line number Diff line
package es.redmic.api.privatedata.dto;

/*-
 * #%L
 * API
 * %%
 * Copyright (C) 2024 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 org.joda.time.DateTime;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaIgnore;

import es.redmic.models.es.common.deserializer.CustomDateTimeDeserializer;
import es.redmic.models.es.common.dto.DTOImplementWithMeta;
import es.redmic.models.es.common.serializer.CustomDateTimeSerializer;

public class ObservationSeriesDTO extends DTOImplementWithMeta {

	@NotNull
	private Long activityId;

	@NotNull
	private Long featureId;

	@NotNull
	private Double value;

	@NotNull
	@JsonSerialize(using = CustomDateTimeSerializer.class)
	@JsonDeserialize(using = CustomDateTimeDeserializer.class)
	private DateTime date;

	@NotNull
	private Long dataDefinition;

	private Character qFlag = '0';

	private Character vFlag = 'U';

	@JsonSchemaIgnore
	@JsonSerialize(using = CustomDateTimeSerializer.class)
	@JsonDeserialize(using = CustomDateTimeDeserializer.class)
	private DateTime inserted;

	@JsonSchemaIgnore
	@JsonSerialize(using = CustomDateTimeSerializer.class)
	@JsonDeserialize(using = CustomDateTimeDeserializer.class)
	private DateTime updated;

	@JsonIgnoreProperties(value = {"_meta"})
	@NotNull
	private ObservationDTO observationDTO;

	public Double getValue() {
		return value;
	}

	public void setValue(Double value) {
		this.value = value;
	}

	public DateTime getDate() {
		return date;
	}

	public void setDate(DateTime date) {
		this.date = date;
	}

	public Long getDataDefinition() {
		return dataDefinition;
	}

	public void setDataDefinition(Long dataDefinition) {
		this.dataDefinition = dataDefinition;
	}


	@JsonProperty(value = "qFlag")
	public Character getQFlag() {
		return qFlag;
	}

	@JsonProperty(value = "qFlag")
	public void setQFlag(Character qFlag) {

		if (qFlag != null)
			this.qFlag = qFlag;
	}

	@JsonIgnore
	public void setqFlag(Character qFlag) {
		this.qFlag = qFlag;
	}

	@JsonProperty(value = "vFlag")
	public Character getVFlag() {
		return vFlag;
	}

	@JsonProperty(value = "vFlag")
	public void setVFlag(Character vFlag) {

		if (vFlag != null)
			this.vFlag = vFlag;
	}

	@JsonIgnore
	public void setvFlag(Character vFlag) {
		this.vFlag = vFlag;
	}

	public DateTime getInserted() {
		return inserted;
	}

	public void setInserted(DateTime inserted) {
		this.inserted = inserted;
	}

	public DateTime getUpdated() {
		return updated;
	}

	public void setUpdated(DateTime updated) {
		this.updated = updated;
	}

	public ObservationDTO getObservationDTO() {
		return observationDTO;
	}

	public void setObservationDTO(ObservationDTO observationDTO) {
		this.observationDTO = observationDTO;
	}
}
+80 −0
Original line number Diff line number Diff line
package es.redmic.api.privatedata.model;

import es.redmic.models.es.administrative.taxonomy.model.AnimalTaxonomyCompact;
import es.redmic.models.es.administrative.taxonomy.model.TaxonomyBase;
import es.redmic.models.es.common.model.DomainES;
import es.redmic.models.es.maintenance.device.model.DeviceCompact;

/*-
 * #%L
 * API
 * %%
 * Copyright (C) 2024 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%
 */

public class Observation {


	private String note;

	private TaxonomyBase taxonomy;

	private DeviceCompact device;

	private AnimalTaxonomyCompact animal;

	private DomainES observationType;

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public TaxonomyBase getTaxonomy() {
		return taxonomy;
	}

	public void setTaxonomy(TaxonomyBase taxonomy) {
		this.taxonomy = taxonomy;
	}

	public DeviceCompact getDevice() {
		return device;
	}

	public void setDevice(DeviceCompact device) {
		this.device = device;
	}

	public AnimalTaxonomyCompact getAnimal() {
		return animal;
	}

	public void setAnimal(AnimalTaxonomyCompact animal) {
		this.animal = animal;
	}

	public DomainES getObservationType() {
		return observationType;
	}

	public void setObservationType(DomainES observationType) {
		this.observationType = observationType;
	}
}
+143 −0
Original line number Diff line number Diff line
package es.redmic.api.privatedata.model;


/*-
 * #%L
 * API
 * %%
 * Copyright (C) 2024 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 org.joda.time.DateTime;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import es.redmic.models.es.common.deserializer.CustomDateTimeDeserializer;
import es.redmic.models.es.common.model.BaseAbstractES;
import es.redmic.models.es.common.serializer.CustomDateTimeSerializer;

public class ObservationSeries extends BaseAbstractES {

	private Long activityId;

	private Long featureId;

	private double value;

	private DateTime date;

	private Long dataDefinition;

	private Character qFlag = '0';

	private Character vFlag = 'U';

	@JsonSerialize(using = CustomDateTimeSerializer.class)
	@JsonDeserialize(using = CustomDateTimeDeserializer.class)
	private DateTime inserted;

	@JsonSerialize(using = CustomDateTimeSerializer.class)
	@JsonDeserialize(using = CustomDateTimeDeserializer.class)
	private DateTime updated;

	private Observation observation;

	public Long getActivityId() {
		return activityId;
	}

	public void setActivityId(Long activityId) {
		this.activityId = activityId;
	}

	public Long getFeatureId() {
		return featureId;
	}

	public void setFeatureId(Long featureId) {
		this.featureId = featureId;
	}

	public double getValue() {
		return this.value;
	}

	public void setValue(double value) {
		this.value = value;
	}

	@JsonSerialize(using = CustomDateTimeSerializer.class)
	public DateTime getDate() {
		return date;
	}

	@JsonDeserialize(using = CustomDateTimeDeserializer.class)
	public void setDate(DateTime date) {
		this.date = date;
	}

	public Long getDataDefinition() {
		return dataDefinition;
	}

	public void setDataDefinition(Long dataDefinition) {
		this.dataDefinition = dataDefinition;
	}

	@JsonProperty(value = "qFlag")
	public Character getQFlag() {
		return qFlag;
	}

	public void setQFlag(Character qFlag) {
		this.qFlag = qFlag;
	}

	@JsonProperty(value = "vFlag")
	public Character getVFlag() {
		return vFlag;
	}

	public void setVFlag(Character vFlag) {
		this.vFlag = vFlag;
	}

	public DateTime getInserted() {
		return inserted;
	}

	public void setInserted(DateTime inserted) {
		this.inserted = inserted;
	}

	public DateTime getUpdated() {
		return updated;
	}

	public void setUpdated(DateTime updated) {
		this.updated = updated;
	}

	public Observation getObservation() {
		return observation;
	}

	public void setObservation(Observation observation) {
		this.observation = observation;
	}
}
Loading