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;
}
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;
}
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;
}
}
Aggregations