Commit 137d327f authored by Noel Alonso's avatar Noel Alonso
Browse files

Elimina componentes no usados de series temporales

Comenta referencias, elimina recursos y tests
parent 8beebfc9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
package es.redmic.es.series.common.converter;
package es.redmic.es.geodata.common.converter;

/*-
 * #%L
@@ -27,7 +27,7 @@ import ma.glasnost.orika.MappingContext;
import ma.glasnost.orika.converter.BidirectionalConverter;
import ma.glasnost.orika.metadata.Type;

//@Component
@Component
public class DataDefinitionConverter extends BidirectionalConverter<Long, DataDefinitionDTO> {

	@Override
+0 −56
Original line number Diff line number Diff line
package es.redmic.es.series.attributeseries.mapper;

/*-
 * #%L
 * ElasticSearch
 * %%
 * Copyright (C) 2019 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.stereotype.Component;

import es.redmic.es.common.utils.DataMapperUtils;
import es.redmic.es.maintenance.qualifiers.service.AttributeTypeESService;
import es.redmic.models.es.maintenance.qualifiers.dto.AttributeTypeBaseDTO;
import es.redmic.models.es.maintenance.qualifiers.model.AttributeTypeBase;
import es.redmic.models.es.series.attributeseries.dto.AttributeSeriesDTO;
import es.redmic.models.es.series.attributeseries.model.AttributeSeries;
import ma.glasnost.orika.CustomMapper;
import ma.glasnost.orika.MappingContext;

@Component
public class AttributeSeriesESMapper extends CustomMapper<AttributeSeries, AttributeSeriesDTO> {
	
	@Autowired
	AttributeTypeESService attributeTypeESService;
	
	@Override
	public void mapAtoB(AttributeSeries a, AttributeSeriesDTO b, MappingContext context) {
		
		if (a.getAttributeType() != null)
			b.setAttributeType(mapperFacade.map(a.getAttributeType(), AttributeTypeBaseDTO.class));
	}
	
	@Override
	public void mapBtoA(AttributeSeriesDTO b, AttributeSeries a, MappingContext context) {
		
		if (b.getAttributeType() != null) {
			a.setAttributeType(mapperFacade.map(mapperFacade.newObject(b.getAttributeType(), DataMapperUtils.getBaseType(),
				DataMapperUtils.getObjectFactoryContext(attributeTypeESService)), AttributeTypeBase.class));
		}
	}
}
+0 −37
Original line number Diff line number Diff line
package es.redmic.es.series.attributeseries.repository;

/*-
 * #%L
 * ElasticSearch
 * %%
 * Copyright (C) 2019 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.stereotype.Repository;

import es.redmic.es.series.common.repository.RWSeriesESRepository;
import es.redmic.models.es.series.attributeseries.model.AttributeSeries;

@Repository
public class AttributeSeriesESRepository extends RWSeriesESRepository<AttributeSeries> {

	private static String[] INDEX = { "timeseries" };
	private static String TYPE = "_doc";

	public AttributeSeriesESRepository() {
		super(INDEX, TYPE);
	}
}
+0 −56
Original line number Diff line number Diff line
package es.redmic.es.series.attributeseries.service;

/*-
 * #%L
 * ElasticSearch
 * %%
 * Copyright (C) 2019 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.stereotype.Service;

import es.redmic.es.series.attributeseries.repository.AttributeSeriesESRepository;
import es.redmic.es.series.common.service.RWSeriesESService;
import es.redmic.models.es.common.model.ReferencesES;
import es.redmic.models.es.series.attributeseries.dto.AttributeSeriesDTO;
import es.redmic.models.es.series.attributeseries.model.AttributeSeries;

@Service
public class AttributeSeriesESService extends RWSeriesESService<AttributeSeries, AttributeSeriesDTO> {

	@Autowired
	public AttributeSeriesESService(AttributeSeriesESRepository repository) {
		super(repository);
	}

	@Override
	public AttributeSeries mapper(AttributeSeriesDTO dtoToIndex) {
		return orikaMapper.getMapperFacade().map(dtoToIndex, AttributeSeries.class);
	}

	@Override
	protected void postUpdate(ReferencesES<AttributeSeries> reference) {}

	@Override
	protected void postSave(Object model) {}

	@Override
	protected void preDelete(Object object) {}

	@Override
	protected void postDelete(String id) {}
}
+0 −46
Original line number Diff line number Diff line
package es.redmic.es.series.common.converter;

/*-
 * #%L
 * ElasticSearch
 * %%
 * Copyright (C) 2019 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 java.util.LinkedHashMap;

import org.springframework.stereotype.Component;

import es.redmic.models.es.series.timeseries.dto.DataHistogramItemDTO;
import es.redmic.models.es.series.timeseries.dto.DataHistogramStatsDTO;
import ma.glasnost.orika.CustomConverter;
import ma.glasnost.orika.MappingContext;
import ma.glasnost.orika.metadata.Type;

@SuppressWarnings("rawtypes")
//@Component
public class ItemHistogramConverter extends CustomConverter<LinkedHashMap, DataHistogramItemDTO> {

	@Override
	public DataHistogramItemDTO convert(LinkedHashMap source, Type<? extends DataHistogramItemDTO> destinationType,
		MappingContext mappingContext) {

		DataHistogramItemDTO item = new DataHistogramItemDTO();
		item.setKey_as_string((String) source.get("key_as_string"));
		item.setValue(mapperFacade.convert(source.get("value"), DataHistogramStatsDTO.class, null, mappingContext));
		return item;
	}
}
Loading