Search in sources :

Example 1 with EntityIdentificationAlertContent

use of com.thinkbiganalytics.alerts.spi.EntityIdentificationAlertContent in project kylo by Teradata.

the class InMemoryAlertManager method createEntityIdentificationAlertContent.

@Override
public <C extends Serializable> EntityIdentificationAlertContent createEntityIdentificationAlertContent(String entityId, SecurityRole.ENTITY_TYPE entityType, C content) {
    EntityIdentificationAlertContent c = new EntityIdentificationAlertContent();
    c.setContent(content);
    return c;
}
Also used : EntityIdentificationAlertContent(com.thinkbiganalytics.alerts.spi.EntityIdentificationAlertContent)

Example 2 with EntityIdentificationAlertContent

use of com.thinkbiganalytics.alerts.spi.EntityIdentificationAlertContent in project kylo by Teradata.

the class DefaultAlertManager method create.

/* (non-Javadoc)
     * @see com.thinkbiganalytics.alerts.spi.AlertManager#create(java.net.URI, com.thinkbiganalytics.alerts.api.Alert.Level, java.lang.String, java.io.Serializable)
     */
@Override
public <C extends Serializable> Alert create(URI type, String subtype, Level level, String description, C content) {
    final Principal user = SecurityContextHolder.getContext().getAuthentication() != null ? SecurityContextHolder.getContext().getAuthentication() : null;
    // reset the subtype if the content is an Entity
    if (subtype == null) {
        subtype = "Other";
    }
    if (content != null && content instanceof EntityIdentificationAlertContent) {
        subtype = "Entity";
    }
    final String finalSubType = subtype;
    Alert created = this.metadataAccess.commit(() -> {
        JpaAlert alert = new JpaAlert(type, finalSubType, level, user, description, content);
        this.repository.save(alert);
        return asValue(alert);
    }, MetadataAccess.SERVICE);
    updateLastUpdatedTime();
    notifyReceivers(1);
    return created;
}
Also used : Alert(com.thinkbiganalytics.alerts.api.Alert) JpaAlert(com.thinkbiganalytics.metadata.jpa.alerts.JpaAlert) JpaAlert(com.thinkbiganalytics.metadata.jpa.alerts.JpaAlert) Principal(java.security.Principal) EntityIdentificationAlertContent(com.thinkbiganalytics.alerts.spi.EntityIdentificationAlertContent)

Example 3 with EntityIdentificationAlertContent

use of com.thinkbiganalytics.alerts.spi.EntityIdentificationAlertContent in project kylo by Teradata.

the class DefaultAlertManager method createEntityIdentificationAlertContent.

public <C extends Serializable> EntityIdentificationAlertContent createEntityIdentificationAlertContent(String entityId, SecurityRole.ENTITY_TYPE entityType, C content) {
    if (content instanceof EntityIdentificationAlertContent) {
        ((EntityIdentificationAlertContent) content).setEntityId(entityId);
        ((EntityIdentificationAlertContent) content).setEntityType(entityType);
        return (EntityIdentificationAlertContent) content;
    } else {
        EntityIdentificationAlertContent c = new EntityIdentificationAlertContent();
        c.setEntityId(entityId);
        c.setEntityType(entityType);
        c.setContent(content);
        return c;
    }
}
Also used : EntityIdentificationAlertContent(com.thinkbiganalytics.alerts.spi.EntityIdentificationAlertContent)

Aggregations

EntityIdentificationAlertContent (com.thinkbiganalytics.alerts.spi.EntityIdentificationAlertContent)3 Alert (com.thinkbiganalytics.alerts.api.Alert)1 JpaAlert (com.thinkbiganalytics.metadata.jpa.alerts.JpaAlert)1 Principal (java.security.Principal)1