Commit 5bcc271d authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade eventos para enriquecer layer al editar

Añade tests de eventos
Añade eventos a la factoría
parent 5e1bd57d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -45,9 +45,11 @@ import es.redmic.atlaslib.events.layer.refresh.LayerRefreshedEvent;
import es.redmic.atlaslib.events.layer.refresh.RefreshLayerCancelledEvent;
import es.redmic.atlaslib.events.layer.refresh.RefreshLayerConfirmedEvent;
import es.redmic.atlaslib.events.layer.refresh.RefreshLayerFailedEvent;
import es.redmic.atlaslib.events.layer.update.EnrichUpdateLayerEvent;
import es.redmic.atlaslib.events.layer.update.LayerUpdatedEvent;
import es.redmic.atlaslib.events.layer.update.UpdateLayerCancelledEvent;
import es.redmic.atlaslib.events.layer.update.UpdateLayerConfirmedEvent;
import es.redmic.atlaslib.events.layer.update.UpdateLayerEnrichedEvent;
import es.redmic.atlaslib.events.layer.update.UpdateLayerFailedEvent;
import es.redmic.brokerlib.avro.common.Event;
import es.redmic.brokerlib.avro.common.EventError;
@@ -125,6 +127,18 @@ public class LayerEventFactory {
			successfulEvent = new LayerCreatedEvent().buildFrom(source);
		}

		if (type.equals(LayerEventTypes.ENRICH_UPDATE)) {

			logger.debug("Creando evento EnrichUpdateLayerEvent para: " + source.getAggregateId());
			successfulEvent = new EnrichUpdateLayerEvent().buildFrom(source);
		}

		if (type.equals(LayerEventTypes.UPDATE_ENRICHED)) {

			logger.debug("Creando evento UpdateLayerEnrichedEvent para: " + source.getAggregateId());
			successfulEvent = new UpdateLayerEnrichedEvent().buildFrom(source);
		}

		if (type.equals(LayerEventTypes.UPDATED)) {

			logger.debug("Creando evento LayerUpdatedEvent para: " + source.getAggregateId());
+20 −0
Original line number Diff line number Diff line
package es.redmic.atlaslib.events.layer.create;

/*-
 * #%L
 * Atlas-lib
 * %%
 * 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.apache.avro.Schema;

import es.redmic.atlaslib.dto.layer.LayerDTO;
+20 −0
Original line number Diff line number Diff line
package es.redmic.atlaslib.events.layer.create;

/*-
 * #%L
 * Atlas-lib
 * %%
 * 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.UUID;

import org.apache.avro.Schema;
+59 −0
Original line number Diff line number Diff line
package es.redmic.atlaslib.events.layer.update;

/*-
 * #%L
 * Atlas-lib
 * %%
 * 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.UUID;

import org.apache.avro.Schema;

import es.redmic.atlaslib.dto.layer.LayerDTO;
import es.redmic.atlaslib.events.layer.LayerEventTypes;
import es.redmic.atlaslib.events.layer.common.LayerEvent;

public class EnrichUpdateLayerEvent extends LayerEvent {

	// @formatter:off

	public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{"
		+ "\"type\":\"record\",\"name\":\"EnrichUpdateLayerEvent\","
				+ "\"namespace\":\"es.redmic.atlaslib.events.layer.update\",\"fields\":["
			+ getLayerEventSchema() + ","
			+ getEventBaseSchema() + "]}");
	// @formatter:on

	static String type = LayerEventTypes.ENRICH_UPDATE;

	public EnrichUpdateLayerEvent() {
		super(type);
		setSessionId(UUID.randomUUID().toString());
	}

	public EnrichUpdateLayerEvent(LayerDTO layer) {
		super(type);
		setSessionId(UUID.randomUUID().toString());
		setLayer(layer);
	}

	@Override
	public Schema getSchema() {
		return SCHEMA$;
	}
}
+55 −0
Original line number Diff line number Diff line
package es.redmic.atlaslib.events.layer.update;

/*-
 * #%L
 * Atlas-lib
 * %%
 * 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.apache.avro.Schema;

import es.redmic.atlaslib.dto.layer.LayerDTO;
import es.redmic.atlaslib.events.layer.LayerEventTypes;
import es.redmic.atlaslib.events.layer.common.LayerEvent;

public class UpdateLayerEnrichedEvent extends LayerEvent {

	// @formatter:off

	public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{"
		+ "\"type\":\"record\",\"name\":\"UpdateLayerEnrichedEvent\","
				+ "\"namespace\":\"es.redmic.atlaslib.events.layer.update\",\"fields\":["
			+ getLayerEventSchema() + ","
			+ getEventBaseSchema() + "]}");
	// @formatter:on

	static String type = LayerEventTypes.UPDATE_ENRICHED;

	public UpdateLayerEnrichedEvent() {
		super(type);
	}

	public UpdateLayerEnrichedEvent(LayerDTO layer) {
		super(type);
		setLayer(layer);
	}

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