add indicator events for maintenance
This commit is contained in:
parent
2a295f454e
commit
b584015256
|
@ -171,6 +171,9 @@ public class AuditableAction {
|
||||||
public static final EventId Maintenance_SendPrefillingSourceAccountingEntriesEvents = new EventId(230010, "Maintenance_SendPrefillingSourceAccountingEntriesEvents");
|
public static final EventId Maintenance_SendPrefillingSourceAccountingEntriesEvents = new EventId(230010, "Maintenance_SendPrefillingSourceAccountingEntriesEvents");
|
||||||
public static final EventId Maintenance_SendReferenceTypeAccountingEntriesEvents = new EventId(230011, "Maintenance_SendReferenceTypeAccountingEntriesEvents");
|
public static final EventId Maintenance_SendReferenceTypeAccountingEntriesEvents = new EventId(230011, "Maintenance_SendReferenceTypeAccountingEntriesEvents");
|
||||||
public static final EventId Maintenance_SendUserAccountingEntriesEvents = new EventId(230012, "Maintenance_SendUserAccountingEntriesEvents");
|
public static final EventId Maintenance_SendUserAccountingEntriesEvents = new EventId(230012, "Maintenance_SendUserAccountingEntriesEvents");
|
||||||
|
public static final EventId Maintenance_SendIndicatorCreateEntryEvents = new EventId(230013, "Maintenance_SendIndicatorCreateEntryEvents");
|
||||||
|
public static final EventId Maintenance_SendIndicatorAccessEntryEvents = new EventId(230014, "Maintenance_SendIndicatorAccessEntryEvents");
|
||||||
|
public static final EventId Maintenance_SendIndicatorPointEntryEvents = new EventId(230015, "Maintenance_SendIndicatorPointEntryEvents");
|
||||||
|
|
||||||
|
|
||||||
public static final EventId Principal_Lookup = new EventId(240000, "Principal_Lookup");
|
public static final EventId Principal_Lookup = new EventId(240000, "Principal_Lookup");
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.opencdmp.commons.types.indicator;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public enum IndicatorFieldBaseType {
|
||||||
|
String("string"),
|
||||||
|
Keyword("keyword"),
|
||||||
|
Integer("integer"),
|
||||||
|
Double("double"),
|
||||||
|
Date("date"),
|
||||||
|
IntegerMap("integerMap"),
|
||||||
|
DoubleMap("doubleMap"),
|
||||||
|
IntegerArray("integerArray"),
|
||||||
|
DoubleArray("doubleArray"),
|
||||||
|
KeywordArray("keywordArray"),
|
||||||
|
;
|
||||||
|
private static final Map<String, IndicatorFieldBaseType> values = new HashMap<>();
|
||||||
|
|
||||||
|
private final String mappedName;
|
||||||
|
|
||||||
|
//For jackson parsing (used by MVC)
|
||||||
|
@JsonValue
|
||||||
|
public java.lang.String getMappedName() {
|
||||||
|
return mappedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
for (IndicatorFieldBaseType e : values()) {
|
||||||
|
values.put(e.asString(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IndicatorFieldBaseType(String mappedName) {
|
||||||
|
this.mappedName = mappedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String asString() {
|
||||||
|
return this.mappedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IndicatorFieldBaseType fromString(String value) {
|
||||||
|
return values.getOrDefault(value, String);
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,6 +34,12 @@ public class OutboxIntegrationEvent extends IntegrationEvent {
|
||||||
|
|
||||||
public static final String GENERATE_FILE = "GENERATE_FILE";
|
public static final String GENERATE_FILE = "GENERATE_FILE";
|
||||||
|
|
||||||
|
public static final String INDICATOR_POINT_ENTRY = "INDICATOR_POINT_ENTRY";
|
||||||
|
|
||||||
|
public static final String INDICATOR_ACCESS_ENTRY = "INDICATOR_ACCESS_ENTRY";
|
||||||
|
|
||||||
|
public static final String INDICATOR_ENTRY = "INDICATOR_ENTRY";
|
||||||
|
|
||||||
private TrackedEvent event;
|
private TrackedEvent event;
|
||||||
|
|
||||||
public TrackedEvent getEvent() {
|
public TrackedEvent getEvent() {
|
||||||
|
|
|
@ -36,6 +36,12 @@ public class OutboxProperties {
|
||||||
|
|
||||||
private final String accountingEntryCreatedTopic;
|
private final String accountingEntryCreatedTopic;
|
||||||
|
|
||||||
|
private final String indicatorPointTopic;
|
||||||
|
|
||||||
|
private final String indicatorTopic;
|
||||||
|
|
||||||
|
private final String indicatorAccessTopic;
|
||||||
|
|
||||||
private final String generateFileTopic;
|
private final String generateFileTopic;
|
||||||
|
|
||||||
public OutboxProperties(String exchange, int handleAckRetries, int handleNackRetries, int handleAckWaitInMilliSeconds, int handleNackWaitInMilliSeconds,
|
public OutboxProperties(String exchange, int handleAckRetries, int handleNackRetries, int handleAckWaitInMilliSeconds, int handleNackWaitInMilliSeconds,
|
||||||
|
@ -52,7 +58,7 @@ public class OutboxProperties {
|
||||||
String notifyTopic,
|
String notifyTopic,
|
||||||
String forgetMeCompletedTopic,
|
String forgetMeCompletedTopic,
|
||||||
String whatYouKnowAboutMeCompletedTopic,
|
String whatYouKnowAboutMeCompletedTopic,
|
||||||
String accountingEntryCreatedTopic, String generateFileTopic
|
String accountingEntryCreatedTopic, String indicatorPointTopic, String indicatorTopic, String indicatorAccessTopic, String generateFileTopic
|
||||||
) {
|
) {
|
||||||
this.exchange = exchange;
|
this.exchange = exchange;
|
||||||
this.handleAckRetries = handleAckRetries;
|
this.handleAckRetries = handleAckRetries;
|
||||||
|
@ -73,6 +79,9 @@ public class OutboxProperties {
|
||||||
this.forgetMeCompletedTopic = forgetMeCompletedTopic;
|
this.forgetMeCompletedTopic = forgetMeCompletedTopic;
|
||||||
this.whatYouKnowAboutMeCompletedTopic = whatYouKnowAboutMeCompletedTopic;
|
this.whatYouKnowAboutMeCompletedTopic = whatYouKnowAboutMeCompletedTopic;
|
||||||
this.accountingEntryCreatedTopic = accountingEntryCreatedTopic;
|
this.accountingEntryCreatedTopic = accountingEntryCreatedTopic;
|
||||||
|
this.indicatorPointTopic = indicatorPointTopic;
|
||||||
|
this.indicatorTopic = indicatorTopic;
|
||||||
|
this.indicatorAccessTopic = indicatorAccessTopic;
|
||||||
this.generateFileTopic = generateFileTopic;
|
this.generateFileTopic = generateFileTopic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,4 +164,16 @@ public class OutboxProperties {
|
||||||
public String getGenerateFileTopic() {
|
public String getGenerateFileTopic() {
|
||||||
return this.generateFileTopic;
|
return this.generateFileTopic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIndicatorPointTopic() {
|
||||||
|
return indicatorPointTopic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndicatorTopic() {
|
||||||
|
return indicatorTopic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndicatorAccessTopic() {
|
||||||
|
return indicatorAccessTopic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,6 +446,18 @@ public class OutboxRepositoryImpl implements OutboxRepository {
|
||||||
routingKey = this.outboxProperties.getTenantTouchTopic();
|
routingKey = this.outboxProperties.getTenantTouchTopic();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case OutboxIntegrationEvent.INDICATOR_POINT_ENTRY: {
|
||||||
|
routingKey = this.outboxProperties.getIndicatorPointTopic();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OutboxIntegrationEvent.INDICATOR_ENTRY: {
|
||||||
|
routingKey = this.outboxProperties.getIndicatorTopic();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OutboxIntegrationEvent.INDICATOR_ACCESS_ENTRY: {
|
||||||
|
routingKey = this.outboxProperties.getIndicatorAccessTopic();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case OutboxIntegrationEvent.TENANT_USER_INVITE: {
|
case OutboxIntegrationEvent.TENANT_USER_INVITE: {
|
||||||
routingKey = this.outboxProperties.getTenantUserInviteTopic();
|
routingKey = this.outboxProperties.getTenantUserInviteTopic();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicator;
|
||||||
|
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
|
import org.opencdmp.commons.validation.BaseValidator;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.opencdmp.integrationevent.TrackedEvent;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class IndicatorElasticEvent extends TrackedEvent {
|
||||||
|
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
private IndicatorMetadata metadata;
|
||||||
|
|
||||||
|
private IndicatorSchema schema;
|
||||||
|
public static final String _schema = "schema";
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndicatorMetadata getMetadata() {
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMetadata(IndicatorMetadata metadata) {
|
||||||
|
this.metadata = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndicatorSchema getSchema() {
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSchema(IndicatorSchema schema) {
|
||||||
|
this.schema = schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(IndicatorElasticEventValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class IndicatorElasticEventValidator extends BaseValidator<IndicatorElasticEvent> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "IndicatorElasticEventValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected IndicatorElasticEventValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<IndicatorElasticEvent> modelClass() {
|
||||||
|
return IndicatorElasticEvent.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(IndicatorElasticEvent item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.refSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getSchema()))
|
||||||
|
.on(IndicatorElasticEvent._schema)
|
||||||
|
.over(item.getSchema())
|
||||||
|
.using(() -> this.validatorFactory.validator(IndicatorSchema.IndicatorSchemaValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicator;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IndicatorElasticEventHandler {
|
||||||
|
|
||||||
|
void handle(IndicatorElasticEvent event);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicator;
|
||||||
|
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||||
|
import org.opencdmp.integrationevent.outbox.OutboxService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class IndicatorElasticEventHandlerImpl implements IndicatorElasticEventHandler {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(IndicatorElasticEventHandlerImpl.class));
|
||||||
|
|
||||||
|
private final OutboxService outboxService;
|
||||||
|
|
||||||
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public IndicatorElasticEventHandlerImpl(OutboxService outboxService, ApplicationContext applicationContext) {
|
||||||
|
this.outboxService = outboxService;
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(IndicatorElasticEvent event) {
|
||||||
|
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
|
||||||
|
message.setMessageId(UUID.randomUUID());
|
||||||
|
message.setType(OutboxIntegrationEvent.INDICATOR_ENTRY);
|
||||||
|
message.setEvent(event);
|
||||||
|
message.setTenantId(null);
|
||||||
|
|
||||||
|
this.outboxService.publish(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,219 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicator;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
|
import org.opencdmp.commons.types.indicator.IndicatorFieldBaseType;
|
||||||
|
import org.opencdmp.commons.validation.BaseValidator;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class IndicatorField {
|
||||||
|
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@JsonProperty(value="basetype")
|
||||||
|
private IndicatorFieldBaseType basetype;
|
||||||
|
public static final String _baseType = "basetype";
|
||||||
|
|
||||||
|
@JsonProperty(value="typesemantics")
|
||||||
|
private String typeSemantics;
|
||||||
|
|
||||||
|
@JsonProperty("typeid")
|
||||||
|
private String typeId;
|
||||||
|
|
||||||
|
// @JsonProperty("alt_labels")
|
||||||
|
// private List<AltTextPersist> altLabels;
|
||||||
|
//
|
||||||
|
// @JsonProperty("alt_descriptions")
|
||||||
|
// private List<AltTextPersist> altDescriptions;
|
||||||
|
//
|
||||||
|
// @JsonProperty("valuerange")
|
||||||
|
// private ValueRangePersist valueRange;
|
||||||
|
|
||||||
|
@JsonProperty("subfieldof")
|
||||||
|
private String subfieldOf;
|
||||||
|
|
||||||
|
@JsonProperty("valuefield")
|
||||||
|
private String valueField;
|
||||||
|
|
||||||
|
@JsonProperty("useas")
|
||||||
|
private String useAs;
|
||||||
|
|
||||||
|
// private List<OperatorPersist> operations;
|
||||||
|
//
|
||||||
|
// private List<BaseValidationPersist> validation;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndicatorFieldBaseType getBasetype() {
|
||||||
|
return basetype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBasetype(IndicatorFieldBaseType basetype) {
|
||||||
|
this.basetype = basetype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeSemantics() {
|
||||||
|
return typeSemantics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeSemantics(String typeSemantics) {
|
||||||
|
this.typeSemantics = typeSemantics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeId() {
|
||||||
|
return typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeId(String typeId) {
|
||||||
|
this.typeId = typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public List<AltTextPersist> getAltLabels() {
|
||||||
|
// return altLabels;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setAltLabels(List<AltTextPersist> altLabels) {
|
||||||
|
// this.altLabels = altLabels;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<AltTextPersist> getAltDescriptions() {
|
||||||
|
// return altDescriptions;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setAltDescriptions(List<AltTextPersist> altDescriptions) {
|
||||||
|
// this.altDescriptions = altDescriptions;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public ValueRangePersist getValueRange() {
|
||||||
|
// return valueRange;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setValueRange(ValueRangePersist valueRange) {
|
||||||
|
// this.valueRange = valueRange;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public String getSubfieldOf() {
|
||||||
|
return subfieldOf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubfieldOf(String subfieldOf) {
|
||||||
|
this.subfieldOf = subfieldOf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValueField() {
|
||||||
|
return valueField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValueField(String valueField) {
|
||||||
|
this.valueField = valueField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUseAs() {
|
||||||
|
return useAs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUseAs(String useAs) {
|
||||||
|
this.useAs = useAs;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public List<OperatorPersist> getOperations() {
|
||||||
|
// return operations;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setOperations(List<OperatorPersist> operations) {
|
||||||
|
// this.operations = operations;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<BaseValidationPersist> getValidation() {
|
||||||
|
// return validation;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setValidation(List<BaseValidationPersist> validation) {
|
||||||
|
// this.validation = validation;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Component(IndicatorFieldValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class IndicatorFieldValidator extends BaseValidator<IndicatorField> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "IndicatorFieldValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
|
||||||
|
protected IndicatorFieldValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<IndicatorField> modelClass() {
|
||||||
|
return IndicatorField.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(IndicatorField item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> !this.isNull(item.getBasetype()))
|
||||||
|
.failOn(IndicatorField._baseType).failWith(messageSource.getMessage("Validation_Required", new Object[]{IndicatorField._baseType}, LocaleContextHolder.getLocale()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicator;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
public class IndicatorMetadata {
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
// private List<SemanticsLabelEvent> semanticLabels;
|
||||||
|
//
|
||||||
|
// private List<AltTextPersist> altLabels;
|
||||||
|
//
|
||||||
|
// private List<AltTextPersist> altDescriptions;
|
||||||
|
|
||||||
|
private Instant date;
|
||||||
|
|
||||||
|
// private List<CoveragePersist> coverage;
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public List<SemanticsLabelPersist> getSemanticLabels() {
|
||||||
|
// return semanticLabels;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setSemanticLabels(List<SemanticsLabelPersist> semanticLabels) {
|
||||||
|
// this.semanticLabels = semanticLabels;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<AltTextPersist> getAltLabels() {
|
||||||
|
// return altLabels;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setAltLabels(List<AltTextPersist> altLabels) {
|
||||||
|
// this.altLabels = altLabels;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<AltTextPersist> getAltDescriptions() {
|
||||||
|
// return altDescriptions;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setAltDescriptions(List<AltTextPersist> altDescriptions) {
|
||||||
|
// this.altDescriptions = altDescriptions;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public Instant getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Instant date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public List<CoveragePersist> getCoverage() {
|
||||||
|
// return coverage;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setCoverage(List<CoveragePersist> coverage) {
|
||||||
|
// this.coverage = coverage;
|
||||||
|
// }
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicator;
|
||||||
|
|
||||||
|
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
|
import org.opencdmp.commons.validation.BaseValidator;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class IndicatorSchema {
|
||||||
|
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
private List<IndicatorField> fields;
|
||||||
|
public static final String _fields = "fields";
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IndicatorField> getFields() {
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields(List<IndicatorField> fields) {
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(IndicatorSchemaValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class IndicatorSchemaValidator extends BaseValidator<IndicatorSchema> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "IndicatorSchemaValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected IndicatorSchemaValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<IndicatorSchema> modelClass() {
|
||||||
|
return IndicatorSchema.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(IndicatorSchema item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.navSpec()
|
||||||
|
.iff(() -> !this.isNull(item.getFields()))
|
||||||
|
.on(IndicatorSchema._fields)
|
||||||
|
.over(item.getFields())
|
||||||
|
.using((itm) -> this.validatorFactory.validator(IndicatorField.IndicatorFieldValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicatoraccess;
|
||||||
|
|
||||||
|
import org.opencdmp.integrationevent.TrackedEvent;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class IndicatorAccessEvent extends TrackedEvent {
|
||||||
|
|
||||||
|
private UUID userId;
|
||||||
|
public static final String _indicatorId= "indicatorId";
|
||||||
|
|
||||||
|
private UUID indicatorId;
|
||||||
|
|
||||||
|
public UUID getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(UUID userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getIndicatorId() {
|
||||||
|
return indicatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndicatorId(UUID indicatorId) {
|
||||||
|
this.indicatorId = indicatorId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicatoraccess;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public interface IndicatorAccessEventHandler {
|
||||||
|
|
||||||
|
void handle(IndicatorAccessEvent event, UUID tenant);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicatoraccess;
|
||||||
|
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||||
|
import org.opencdmp.integrationevent.outbox.OutboxService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class IndicatorAccessEventHandlerImpl implements IndicatorAccessEventHandler {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(IndicatorAccessEventHandlerImpl.class));
|
||||||
|
|
||||||
|
private final OutboxService outboxService;
|
||||||
|
|
||||||
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public IndicatorAccessEventHandlerImpl(OutboxService outboxService, ApplicationContext applicationContext) {
|
||||||
|
this.outboxService = outboxService;
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(IndicatorAccessEvent event, UUID tenant) {
|
||||||
|
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
|
||||||
|
message.setMessageId(UUID.randomUUID());
|
||||||
|
message.setType(OutboxIntegrationEvent.INDICATOR_ACCESS_ENTRY);
|
||||||
|
message.setEvent(event);
|
||||||
|
message.setTenantId(tenant);
|
||||||
|
|
||||||
|
this.outboxService.publish(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicatorpoint;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
|
import org.opencdmp.commons.validation.BaseValidator;
|
||||||
|
import org.opencdmp.convention.ConventionService;
|
||||||
|
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||||
|
import org.opencdmp.integrationevent.TrackedEvent;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class IndicatorPointEvent extends TrackedEvent {
|
||||||
|
public IndicatorPointEvent() {
|
||||||
|
properties = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private UUID indicatorId;
|
||||||
|
public static final String _indicatorId= "indicatorId";
|
||||||
|
|
||||||
|
private Date timestamp;
|
||||||
|
|
||||||
|
private String batchId;
|
||||||
|
|
||||||
|
private String groupHash;
|
||||||
|
|
||||||
|
// private DataGroupInfoPersist groupInfo;
|
||||||
|
// public static final String _groupInfo= "groupInfo";
|
||||||
|
|
||||||
|
private Date batchTimestamp;
|
||||||
|
|
||||||
|
private Map<String, Object> properties;
|
||||||
|
|
||||||
|
public UUID getIndicatorId() {
|
||||||
|
return indicatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndicatorId(UUID indicatorId) {
|
||||||
|
this.indicatorId = indicatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getBatchTimestamp() {
|
||||||
|
return batchTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatchTimestamp(Date batchTimestamp) {
|
||||||
|
this.batchTimestamp = batchTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimestamp(Date timestamp) {
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBatchId() {
|
||||||
|
return batchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatchId(String batchId) {
|
||||||
|
this.batchId = batchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupHash() {
|
||||||
|
return groupHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupHash(String groupHash) {
|
||||||
|
this.groupHash = groupHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public DataGroupInfoPersist getGroupInfo() {
|
||||||
|
// return groupInfo;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setGroupInfo(DataGroupInfoPersist groupInfo) {
|
||||||
|
// this.groupInfo = groupInfo;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public Map<String, Object> getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonAnySetter
|
||||||
|
public void add(String property, Object value) {
|
||||||
|
properties.put(property, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component(IndicatorPointEventValidator.ValidatorName)
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public static class IndicatorPointEventValidator extends BaseValidator<IndicatorPointEvent> {
|
||||||
|
|
||||||
|
public static final String ValidatorName = "IndicatorPointEventValidator";
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
|
protected IndicatorPointEventValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
|
super(conventionService, errors);
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<IndicatorPointEvent> modelClass() {
|
||||||
|
return IndicatorPointEvent.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Specification> specifications(IndicatorPointEvent item) {
|
||||||
|
return Arrays.asList(
|
||||||
|
this.spec()
|
||||||
|
.must(() -> this.isValidGuid(item.getIndicatorId()))
|
||||||
|
.failOn(IndicatorPointEvent._indicatorId).failWith(messageSource.getMessage("Validation_Required", new Object[]{IndicatorPointEvent._indicatorId}, LocaleContextHolder.getLocale()))
|
||||||
|
// this.refSpec()
|
||||||
|
// .iff(() -> !this.isNull(item.getGroupInfo()))
|
||||||
|
// .on(QueueIndicatorPointEvent._groupInfo)
|
||||||
|
// .over(item.getGroupInfo())
|
||||||
|
// .using(() -> this.validatorFactory.validator(DataGroupInfoPersist.DataGroupInfoPersistValidator.class))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicatorpoint;
|
||||||
|
|
||||||
|
public interface IndicatorPointEventHandler {
|
||||||
|
|
||||||
|
void handle(IndicatorPointEvent event);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.opencdmp.integrationevent.outbox.indicatorpoint;
|
||||||
|
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent;
|
||||||
|
import org.opencdmp.integrationevent.outbox.OutboxService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class IndicatorPointEventHandlerImpl implements IndicatorPointEventHandler {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(IndicatorPointEventHandlerImpl.class));
|
||||||
|
|
||||||
|
private final OutboxService outboxService;
|
||||||
|
|
||||||
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public IndicatorPointEventHandlerImpl(OutboxService outboxService, ApplicationContext applicationContext) {
|
||||||
|
this.outboxService = outboxService;
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(IndicatorPointEvent event) {
|
||||||
|
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
|
||||||
|
message.setMessageId(UUID.randomUUID());
|
||||||
|
message.setType(OutboxIntegrationEvent.INDICATOR_POINT_ENTRY);
|
||||||
|
message.setEvent(event);
|
||||||
|
message.setTenantId(null);
|
||||||
|
|
||||||
|
this.outboxService.publish(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.opencdmp.service.maintenance;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableConfigurationProperties(KpiProperties.class)
|
||||||
|
public class KpiConfiguration {
|
||||||
|
private final KpiProperties properties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public KpiConfiguration(KpiProperties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KpiProperties getProperties() {
|
||||||
|
return this.properties;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package org.opencdmp.service.maintenance;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ConfigurationProperties(prefix = "kpi.user-indicator")
|
||||||
|
public class KpiProperties {
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
private UUID user;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(UUID user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,4 +29,10 @@ public interface MaintenanceService {
|
||||||
|
|
||||||
void sendUserAccountingEntriesEvents() throws InvalidApplicationException;
|
void sendUserAccountingEntriesEvents() throws InvalidApplicationException;
|
||||||
|
|
||||||
|
void sendIndicatorCreateEntryEvents() throws InvalidApplicationException;
|
||||||
|
|
||||||
|
void sendIndicatorAccessEntryEvents() throws InvalidApplicationException;
|
||||||
|
|
||||||
|
void sendIndicatorPointEntryEvents() throws InvalidApplicationException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,24 @@ package org.opencdmp.service.maintenance;
|
||||||
|
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
import org.opencdmp.commons.enums.UsageLimitTargetMetric;
|
import org.opencdmp.commons.enums.UsageLimitTargetMetric;
|
||||||
import org.opencdmp.commons.enums.accounting.AccountingValueType;
|
|
||||||
import org.opencdmp.commons.scope.tenant.TenantScope;
|
import org.opencdmp.commons.scope.tenant.TenantScope;
|
||||||
|
import org.opencdmp.commons.types.indicator.IndicatorFieldBaseType;
|
||||||
import org.opencdmp.data.*;
|
import org.opencdmp.data.*;
|
||||||
import org.opencdmp.integrationevent.outbox.accountingentrycreated.AccountingEntryCreatedIntegrationEventHandler;
|
import org.opencdmp.integrationevent.outbox.accountingentrycreated.AccountingEntryCreatedIntegrationEventHandler;
|
||||||
import org.opencdmp.integrationevent.outbox.annotationentityremoval.AnnotationEntityRemovalIntegrationEventHandler;
|
import org.opencdmp.integrationevent.outbox.annotationentityremoval.AnnotationEntityRemovalIntegrationEventHandler;
|
||||||
import org.opencdmp.integrationevent.outbox.annotationentitytouch.AnnotationEntityTouchedIntegrationEventHandler;
|
import org.opencdmp.integrationevent.outbox.annotationentitytouch.AnnotationEntityTouchedIntegrationEventHandler;
|
||||||
|
import org.opencdmp.integrationevent.outbox.indicator.*;
|
||||||
|
import org.opencdmp.integrationevent.outbox.indicatoraccess.IndicatorAccessEvent;
|
||||||
|
import org.opencdmp.integrationevent.outbox.indicatoraccess.IndicatorAccessEventHandler;
|
||||||
|
import org.opencdmp.integrationevent.outbox.indicatorpoint.IndicatorPointEvent;
|
||||||
|
import org.opencdmp.integrationevent.outbox.indicatorpoint.IndicatorPointEventHandler;
|
||||||
import org.opencdmp.integrationevent.outbox.tenantremoval.TenantRemovalIntegrationEventHandler;
|
import org.opencdmp.integrationevent.outbox.tenantremoval.TenantRemovalIntegrationEventHandler;
|
||||||
import org.opencdmp.integrationevent.outbox.tenanttouched.TenantTouchedIntegrationEvent;
|
import org.opencdmp.integrationevent.outbox.tenanttouched.TenantTouchedIntegrationEvent;
|
||||||
import org.opencdmp.integrationevent.outbox.tenanttouched.TenantTouchedIntegrationEventHandler;
|
import org.opencdmp.integrationevent.outbox.tenanttouched.TenantTouchedIntegrationEventHandler;
|
||||||
|
@ -20,6 +27,7 @@ import org.opencdmp.integrationevent.outbox.userremoval.UserRemovalIntegrationEv
|
||||||
import org.opencdmp.integrationevent.outbox.usertouched.UserTouchedIntegrationEventHandler;
|
import org.opencdmp.integrationevent.outbox.usertouched.UserTouchedIntegrationEventHandler;
|
||||||
import org.opencdmp.model.DescriptionTemplateType;
|
import org.opencdmp.model.DescriptionTemplateType;
|
||||||
import org.opencdmp.model.Tenant;
|
import org.opencdmp.model.Tenant;
|
||||||
|
import org.opencdmp.model.TenantUser;
|
||||||
import org.opencdmp.model.description.Description;
|
import org.opencdmp.model.description.Description;
|
||||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||||
import org.opencdmp.model.plan.Plan;
|
import org.opencdmp.model.plan.Plan;
|
||||||
|
@ -35,9 +43,10 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MaintenanceServiceImpl implements MaintenanceService {
|
public class MaintenanceServiceImpl implements MaintenanceService {
|
||||||
|
@ -47,13 +56,9 @@ public class MaintenanceServiceImpl implements MaintenanceService {
|
||||||
private final TenantEntityManager entityManager;
|
private final TenantEntityManager entityManager;
|
||||||
private final AuthorizationService authorizationService;
|
private final AuthorizationService authorizationService;
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
|
|
||||||
private final UserTouchedIntegrationEventHandler userTouchedIntegrationEventHandler;
|
private final UserTouchedIntegrationEventHandler userTouchedIntegrationEventHandler;
|
||||||
|
|
||||||
private final UserRemovalIntegrationEventHandler userRemovalIntegrationEventHandler;
|
private final UserRemovalIntegrationEventHandler userRemovalIntegrationEventHandler;
|
||||||
|
|
||||||
private final TenantTouchedIntegrationEventHandler tenantTouchedIntegrationEventHandler;
|
private final TenantTouchedIntegrationEventHandler tenantTouchedIntegrationEventHandler;
|
||||||
|
|
||||||
private final TenantRemovalIntegrationEventHandler tenantRemovalIntegrationEventHandler;
|
private final TenantRemovalIntegrationEventHandler tenantRemovalIntegrationEventHandler;
|
||||||
private final AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler;
|
private final AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler;
|
||||||
private final AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler;
|
private final AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler;
|
||||||
|
@ -61,12 +66,16 @@ public class MaintenanceServiceImpl implements MaintenanceService {
|
||||||
private final TenantScope tenantScope;
|
private final TenantScope tenantScope;
|
||||||
private final TenantEntityManager tenantEntityManager;
|
private final TenantEntityManager tenantEntityManager;
|
||||||
private final AccountingProperties accountingProperties;
|
private final AccountingProperties accountingProperties;
|
||||||
|
|
||||||
private final AccountingService accountingService;
|
private final AccountingService accountingService;
|
||||||
|
private final KpiProperties kpiProperties;
|
||||||
|
private final IndicatorElasticEventHandler indicatorElasticEventHandler;
|
||||||
|
private final IndicatorAccessEventHandler indicatorAccessEventHandler;
|
||||||
|
private final IndicatorPointEventHandler indicatorPointEventHandler;
|
||||||
|
private final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
public MaintenanceServiceImpl(
|
public MaintenanceServiceImpl(
|
||||||
TenantEntityManager entityManager, AuthorizationService authorizationService,
|
TenantEntityManager entityManager, AuthorizationService authorizationService,
|
||||||
QueryFactory queryFactory, UserTouchedIntegrationEventHandler userTouchedIntegrationEventHandler, UserRemovalIntegrationEventHandler userRemovalIntegrationEventHandler, TenantTouchedIntegrationEventHandler tenantTouchedIntegrationEventHandler, TenantRemovalIntegrationEventHandler tenantRemovalIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler, AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AccountingEntryCreatedIntegrationEventHandler accountingEntryCreatedIntegrationEventHandler, TenantScope tenantScope, TenantEntityManager tenantEntityManager, AccountingProperties accountingProperties, AccountingService accountingService) {
|
QueryFactory queryFactory, UserTouchedIntegrationEventHandler userTouchedIntegrationEventHandler, UserRemovalIntegrationEventHandler userRemovalIntegrationEventHandler, TenantTouchedIntegrationEventHandler tenantTouchedIntegrationEventHandler, TenantRemovalIntegrationEventHandler tenantRemovalIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler, AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AccountingEntryCreatedIntegrationEventHandler accountingEntryCreatedIntegrationEventHandler, TenantScope tenantScope, TenantEntityManager tenantEntityManager, AccountingProperties accountingProperties, AccountingService accountingService, KpiProperties kpiProperties, IndicatorElasticEventHandler indicatorElasticEventHandler, IndicatorAccessEventHandler indicatorAccessEventHandler, IndicatorPointEventHandler indicatorPointEventHandler, ValidatorFactory validatorFactory) {
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
|
@ -81,6 +90,11 @@ public class MaintenanceServiceImpl implements MaintenanceService {
|
||||||
this.tenantEntityManager = tenantEntityManager;
|
this.tenantEntityManager = tenantEntityManager;
|
||||||
this.accountingProperties = accountingProperties;
|
this.accountingProperties = accountingProperties;
|
||||||
this.accountingService = accountingService;
|
this.accountingService = accountingService;
|
||||||
|
this.kpiProperties = kpiProperties;
|
||||||
|
this.indicatorElasticEventHandler = indicatorElasticEventHandler;
|
||||||
|
this.indicatorAccessEventHandler = indicatorAccessEventHandler;
|
||||||
|
this.indicatorPointEventHandler = indicatorPointEventHandler;
|
||||||
|
this.validatorFactory = validatorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -396,4 +410,101 @@ public class MaintenanceServiceImpl implements MaintenanceService {
|
||||||
this.tenantEntityManager.reloadTenantFilters();
|
this.tenantEntityManager.reloadTenantFilters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendIndicatorCreateEntryEvents() throws InvalidApplicationException {
|
||||||
|
IndicatorElasticEvent event = new IndicatorElasticEvent();
|
||||||
|
event.setId(this.kpiProperties.getId());
|
||||||
|
IndicatorMetadata metadata = new IndicatorMetadata();
|
||||||
|
metadata.setCode(this.kpiProperties.getCode());
|
||||||
|
metadata.setLabel(this.kpiProperties.getLabel());
|
||||||
|
metadata.setDescription(this.kpiProperties.getDescription());
|
||||||
|
metadata.setUrl(this.kpiProperties.getUrl());
|
||||||
|
metadata.setDate(Instant.now());
|
||||||
|
|
||||||
|
event.setMetadata(metadata);
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.tenantEntityManager.disableTenantFilters();
|
||||||
|
List<TenantUserEntity> tenantUserEntities = this.queryFactory.query(TenantUserQuery.class).disableTracking().userIds(this.kpiProperties.getUser()).collectAs(new BaseFieldSet().ensure(TenantUser._tenant));
|
||||||
|
List<IndicatorField> fields = new ArrayList<>();
|
||||||
|
if (tenantUserEntities != null) {
|
||||||
|
List<TenantEntity> tenantEntities = this.queryFactory.query(TenantQuery.class).disableTracking().ids(tenantUserEntities.stream().map(TenantUserEntity::getTenantId).distinct().toList()).collect();
|
||||||
|
if (tenantEntities != null) {
|
||||||
|
for (TenantEntity tenant: tenantEntities) {
|
||||||
|
IndicatorField field = new IndicatorField();
|
||||||
|
field.setCode("tenant_code");
|
||||||
|
field.setName("Tenant Code");
|
||||||
|
field.setValueField(tenant.getCode());
|
||||||
|
field.setBasetype(IndicatorFieldBaseType.String);
|
||||||
|
fields.add(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
IndicatorField field1 = new IndicatorField();
|
||||||
|
field1.setCode("user_id");
|
||||||
|
field1.setName("User Id");
|
||||||
|
field1.setValueField(this.kpiProperties.getUser().toString());
|
||||||
|
field1.setBasetype(IndicatorFieldBaseType.String);
|
||||||
|
fields.add(field1);
|
||||||
|
|
||||||
|
IndicatorField field2 = new IndicatorField();
|
||||||
|
field2.setCode("created_at");
|
||||||
|
field2.setName("Created at");
|
||||||
|
field2.setValueField(Instant.now().toString());
|
||||||
|
field2.setBasetype(IndicatorFieldBaseType.Date);
|
||||||
|
fields.add(field2);
|
||||||
|
|
||||||
|
UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(this.kpiProperties.getUser()).firstAs(new BaseFieldSet().ensure(User._name));
|
||||||
|
if (user == null) {
|
||||||
|
throw new MyApplicationException("user not found");
|
||||||
|
}
|
||||||
|
IndicatorField field3 = new IndicatorField();
|
||||||
|
field3.setCode("user_name");
|
||||||
|
field3.setName("User Name");
|
||||||
|
field3.setValueField(user.getName());
|
||||||
|
field3.setBasetype(IndicatorFieldBaseType.String);
|
||||||
|
fields.add(field3);
|
||||||
|
|
||||||
|
IndicatorSchema schema = new IndicatorSchema();
|
||||||
|
schema.setId(this.kpiProperties.getId());
|
||||||
|
schema.setFields(fields);
|
||||||
|
|
||||||
|
event.setSchema(schema);
|
||||||
|
|
||||||
|
this.validatorFactory.validator(IndicatorElasticEvent.IndicatorElasticEventValidator.class).validateForce(event);
|
||||||
|
this.indicatorElasticEventHandler.handle(event);
|
||||||
|
} finally {
|
||||||
|
this.tenantEntityManager.reloadTenantFilters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendIndicatorAccessEntryEvents() throws InvalidApplicationException {
|
||||||
|
IndicatorAccessEvent event = new IndicatorAccessEvent();
|
||||||
|
event.setIndicatorId(this.kpiProperties.getId());
|
||||||
|
event.setUserId(this.kpiProperties.getUser());
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.tenantEntityManager.disableTenantFilters();
|
||||||
|
List<TenantUserEntity> tenantUserEntities = this.queryFactory.query(TenantUserQuery.class).disableTracking().userIds(this.kpiProperties.getUser()).collectAs(new BaseFieldSet().ensure(TenantUser._tenant));
|
||||||
|
if (tenantUserEntities != null) {
|
||||||
|
for (TenantUserEntity user: tenantUserEntities) {
|
||||||
|
this.indicatorAccessEventHandler.handle(event, user.getTenantId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
this.tenantEntityManager.reloadTenantFilters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendIndicatorPointEntryEvents() throws InvalidApplicationException {
|
||||||
|
IndicatorPointEvent event = new IndicatorPointEvent();
|
||||||
|
event.setIndicatorId(this.kpiProperties.getId());
|
||||||
|
|
||||||
|
this.validatorFactory.validator(IndicatorPointEvent.IndicatorPointEventValidator.class).validateForce(event);
|
||||||
|
this.indicatorPointEventHandler.handle(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,4 +181,34 @@ public class MaintenanceController {
|
||||||
|
|
||||||
this.auditService.track(AuditableAction.Maintenance_SendUserAccountingEntriesEvents);
|
this.auditService.track(AuditableAction.Maintenance_SendUserAccountingEntriesEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = "/events/indicator-entry")
|
||||||
|
public void sendIndicatorCreateEvents() throws InvalidApplicationException {
|
||||||
|
logger.debug("send indicator create entry queue events");
|
||||||
|
this.authorizationService.authorizeForce(Permission.ManageQueueEvents);
|
||||||
|
|
||||||
|
this.maintenanceService.sendIndicatorCreateEntryEvents();
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Maintenance_SendIndicatorCreateEntryEvents);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = "/events/indicator-access-entry")
|
||||||
|
public void sendIndicatorAccessEvents() throws InvalidApplicationException {
|
||||||
|
logger.debug("send indicator create entry queue events");
|
||||||
|
this.authorizationService.authorizeForce(Permission.ManageQueueEvents);
|
||||||
|
|
||||||
|
this.maintenanceService.sendIndicatorAccessEntryEvents();
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Maintenance_SendIndicatorAccessEntryEvents);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = "/events/indicator-point-entry")
|
||||||
|
public void sendIndicatorPointEvents() throws InvalidApplicationException {
|
||||||
|
logger.debug("send indicator point entry queue events");
|
||||||
|
this.authorizationService.authorizeForce(Permission.ManageQueueEvents);
|
||||||
|
|
||||||
|
this.maintenanceService.sendIndicatorPointEntryEvents();
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Maintenance_SendIndicatorPointEntryEvents);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,8 @@ spring:
|
||||||
optional:classpath:config/field-set-expander.yml[.yml], optional:classpath:config/field-set-expander-${spring.profiles.active}.yml[.yml], optional:file:../config/field-set-expander-${spring.profiles.active}.yml[.yml],
|
optional:classpath:config/field-set-expander.yml[.yml], optional:classpath:config/field-set-expander-${spring.profiles.active}.yml[.yml], optional:file:../config/field-set-expander-${spring.profiles.active}.yml[.yml],
|
||||||
optional:classpath:config/lock.yml[.yml], optional:classpath:config/lock-${spring.profiles.active}.yml[.yml], optional:file:../config/lock-${spring.profiles.active}.yml[.yml],
|
optional:classpath:config/lock.yml[.yml], optional:classpath:config/lock-${spring.profiles.active}.yml[.yml], optional:file:../config/lock-${spring.profiles.active}.yml[.yml],
|
||||||
optional:classpath:config/usage-limits.yml[.yml], optional:classpath:config/usage-limits-${spring.profiles.active}.yml[.yml], optional:file:../config/usage-limits-${spring.profiles.active}.yml[.yml],
|
optional:classpath:config/usage-limits.yml[.yml], optional:classpath:config/usage-limits-${spring.profiles.active}.yml[.yml], optional:file:../config/usage-limits-${spring.profiles.active}.yml[.yml],
|
||||||
optional:classpath:config/accounting.yml[.yml], optional:classpath:config/accounting-${spring.profiles.active}.yml[.yml], optional:file:../config/accounting-${spring.profiles.active}.yml[.yml]
|
optional:classpath:config/accounting.yml[.yml], optional:classpath:config/accounting-${spring.profiles.active}.yml[.yml], optional:file:../config/accounting-${spring.profiles.active}.yml[.yml],
|
||||||
|
optional:classpath:config/kpi.yml[.yml], optional:classpath:config/kpi-${spring.profiles.active}.yml[.yml], optional:file:../config/kpi-${spring.profiles.active}.yml[.yml]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
kpi:
|
||||||
|
user-indicator:
|
||||||
|
id: 97c2d685-d7d2-4bd1-a287-ba329ad45d74
|
||||||
|
user: 8552f758-f196-4a51-a3fd-154c088d85c4
|
||||||
|
label: test
|
||||||
|
description: test
|
||||||
|
url: url test
|
||||||
|
code: test
|
|
@ -43,6 +43,9 @@ queue:
|
||||||
annotation-entities-removal-topic: annotation.entities.remove
|
annotation-entities-removal-topic: annotation.entities.remove
|
||||||
what-you-know-about-me-completed-topic: whatyouknowaboutme.completed
|
what-you-know-about-me-completed-topic: whatyouknowaboutme.completed
|
||||||
accounting-entry-created-topic: accountingentry.create
|
accounting-entry-created-topic: accountingentry.create
|
||||||
|
indicator-topic: indicator.entry
|
||||||
|
indicator-point-topic: indicator_point.entry
|
||||||
|
indicator-access-topic: indicator_access.entry
|
||||||
generate-file-topic: generate.file
|
generate-file-topic: generate.file
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
enable: true
|
enable: true
|
||||||
|
|
|
@ -113,4 +113,25 @@ export class MaintenanceService extends BaseService {
|
||||||
.post<any>(url, null).pipe(
|
.post<any>(url, null).pipe(
|
||||||
catchError((error: any) => throwError(error)));
|
catchError((error: any) => throwError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendIndicatorCreateEvents(): Observable<any> {
|
||||||
|
const url = `${this.apiBase}/events/indicator-entry`;
|
||||||
|
return this.http
|
||||||
|
.post<any>(url, null).pipe(
|
||||||
|
catchError((error: any) => throwError(error)));
|
||||||
|
}
|
||||||
|
|
||||||
|
sendIndicatorAccessEvents(): Observable<any> {
|
||||||
|
const url = `${this.apiBase}/events/indicator-access-entry`;
|
||||||
|
return this.http
|
||||||
|
.post<any>(url, null).pipe(
|
||||||
|
catchError((error: any) => throwError(error)));
|
||||||
|
}
|
||||||
|
|
||||||
|
sendIndicatorPointEvents(): Observable<any> {
|
||||||
|
const url = `${this.apiBase}/events/indicator-point-entry`;
|
||||||
|
return this.http
|
||||||
|
.post<any>(url, null).pipe(
|
||||||
|
catchError((error: any) => throwError(error)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,12 @@
|
||||||
<button mat-button (click)="sendReferenceTypeAccountingEntriesEvents($event)" class="mb-1 mr-1 rounded-btn primary">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES')}}</button>
|
<button mat-button (click)="sendReferenceTypeAccountingEntriesEvents($event)" class="mb-1 mr-1 rounded-btn primary">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES')}}</button>
|
||||||
<button mat-button (click)="sendUserAccountingEntriesEvents($event)" class="mb-1 mr-1 rounded-btn primary">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-USER-ACCOUNTING-ENTRIES')}}</button>
|
<button mat-button (click)="sendUserAccountingEntriesEvents($event)" class="mb-1 mr-1 rounded-btn primary">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-USER-ACCOUNTING-ENTRIES')}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<h3>{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.INDICATOR-TITLE')}}</h3>
|
||||||
|
<button mat-button (click)="sendIndicatorCreateEvents($event)" class="mb-1 mr-1 rounded-btn primary">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-INDICATOR-CREATE-ENTRY')}}</button>
|
||||||
|
<button mat-button (click)="sendIndicatorAccessEvents($event)" class="mb-1 mr-1 rounded-btn primary">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-INDICATOR-ACCESS-ENTRY')}}</button>
|
||||||
|
<button mat-button (click)="sendIndicatorPointEvents($event)" class="mb-1 mr-1 rounded-btn primary">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-INDICATOR-POINT-ENTRY')}}</button>
|
||||||
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -465,6 +465,103 @@ export class MaintenanceTasksComponent extends BaseComponent implements OnInit {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendIndicatorCreateEvents(ev: Event) {
|
||||||
|
this.dialog.open(ConfirmationDialogComponent, {
|
||||||
|
data: {
|
||||||
|
message: this.language.instant('MAINTENANCE-TASKS.CONFIRMATION.MESSAGE'),
|
||||||
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||||
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||||
|
},
|
||||||
|
maxWidth: '30em'
|
||||||
|
})
|
||||||
|
.afterClosed()
|
||||||
|
.subscribe(confirm => {
|
||||||
|
if (confirm) {
|
||||||
|
this.doSendIndicatorCreateEvents(ev);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private doSendIndicatorCreateEvents(ev: Event) {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = true;
|
||||||
|
this.maintenanceService.sendIndicatorCreateEvents().pipe(takeUntil(this._destroyed)).subscribe(
|
||||||
|
_ => {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = false;
|
||||||
|
this.onCallbackSuccess();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = false;
|
||||||
|
this.onCallbackError(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendIndicatorAccessEvents(ev: Event) {
|
||||||
|
this.dialog.open(ConfirmationDialogComponent, {
|
||||||
|
data: {
|
||||||
|
message: this.language.instant('MAINTENANCE-TASKS.CONFIRMATION.MESSAGE'),
|
||||||
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||||
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||||
|
},
|
||||||
|
maxWidth: '30em'
|
||||||
|
})
|
||||||
|
.afterClosed()
|
||||||
|
.subscribe(confirm => {
|
||||||
|
if (confirm) {
|
||||||
|
this.doSendIndicatorAccessEvents(ev);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private doSendIndicatorAccessEvents(ev: Event) {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = true;
|
||||||
|
this.maintenanceService.sendIndicatorAccessEvents().pipe(takeUntil(this._destroyed)).subscribe(
|
||||||
|
_ => {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = false;
|
||||||
|
this.onCallbackSuccess();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = false;
|
||||||
|
this.onCallbackError(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendIndicatorPointEvents(ev: Event) {
|
||||||
|
this.dialog.open(ConfirmationDialogComponent, {
|
||||||
|
data: {
|
||||||
|
message: this.language.instant('MAINTENANCE-TASKS.CONFIRMATION.MESSAGE'),
|
||||||
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||||
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||||
|
},
|
||||||
|
maxWidth: '30em'
|
||||||
|
})
|
||||||
|
.afterClosed()
|
||||||
|
.subscribe(confirm => {
|
||||||
|
if (confirm) {
|
||||||
|
this.doSendIndicatorPointEvents(ev);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private doSendIndicatorPointEvents(ev: Event) {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = true;
|
||||||
|
this.maintenanceService.sendIndicatorPointEvents().pipe(takeUntil(this._destroyed)).subscribe(
|
||||||
|
_ => {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = false;
|
||||||
|
this.onCallbackSuccess();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
(ev.target as HTMLButtonElement).disabled = false;
|
||||||
|
this.onCallbackError(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
onCallbackSuccess(): void {
|
onCallbackSuccess(): void {
|
||||||
this.uiNotificationService.snackBarNotification(this.translate.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
this.uiNotificationService.snackBarNotification(this.translate.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||||
this.router.navigate(['/reload']).then(() => this.router.navigate([this.routerUtils.generateUrl('/maintenance-tasks')]));
|
this.router.navigate(['/reload']).then(() => this.router.navigate([this.routerUtils.generateUrl('/maintenance-tasks')]));
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,6 +422,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@
|
||||||
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
"SEND-REFERENCE-TYPE-ACCOUNTING-ENTRIES": "Send reference type accounting entries events",
|
||||||
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
"SEND-USER-ACCOUNTING-ENTRIES": "Send user accounting entries events",
|
||||||
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
"SEND-INDICATOR-CREATE-ENTRY": "Send indicator create entry events",
|
||||||
|
"SEND-INDICATOR-ACCESS-ENTRY": "Send indicator access entry events",
|
||||||
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
"SEND-INDICATOR-POINT-ENTRY": "Send indicator point entry events"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue