本文整理了Java中org.eclipse.scada.ae.Event.create()
方法的一些代码示例,展示了Event.create()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.create()
方法的具体详情如下:
包路径:org.eclipse.scada.ae.Event
类名称:Event
方法名:create
暂无
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.da.master.common
/**
* Create a pre-filled event builder
*
* @return a new event builder
*/
protected EventBuilder createEventBuilder ()
{
final EventBuilder builder = Event.create ();
builder.sourceTimestamp ( new Date () );
builder.entryTimestamp ( new Date () );
injectEventAttributes ( builder );
return builder;
}
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage.postgres
final Event eventToStore = Event.create ().event ( event ).attribute ( Fields.COMMENT, comment ).build ();
this.dbExecutor.submit ( new Callable<Event> () {
@Override
代码示例来源:origin: org.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage.postgres
@Override
protected Integer performTask ( final ConnectionContext connectionContext ) throws Exception
{
connectionContext.setAutoCommit ( false );
final int i = connectionContext.update ( String.format ( cleanupArchiveSql, JdbcDao.this.schema ), JdbcDao.this.instance, new Timestamp ( date.getTime () ) );
final int j = connectionContext.update ( String.format ( cleanupReplicationSql, JdbcDao.this.schema ), new Timestamp ( date.getTime () ) );
if ( j > 0 )
{
final Date ts = new Date ( System.currentTimeMillis () );
final Event event = Event.create ().id ( UUID.randomUUID () ).sourceTimestamp ( ts ).entryTimestamp ( ts ).attribute ( Fields.MESSAGE, "deleted events from replication table due to call to cleanUp" ).attribute ( Fields.VALUE, j ).build ();
storeReplication ( connectionContext, event );
}
connectionContext.commit ();
return i;
}
} );
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage.postgres
@Override
protected Integer performTask ( final ConnectionContext connectionContext ) throws Exception
{
connectionContext.setAutoCommit ( false );
final int i = connectionContext.update ( String.format ( cleanupArchiveSql, JdbcDao.this.schema ), JdbcDao.this.instance, new Timestamp ( date.getTime () ) );
final int j = connectionContext.update ( String.format ( cleanupReplicationSql, JdbcDao.this.schema ), new Timestamp ( date.getTime () ) );
if ( j > 0 )
{
final Date ts = new Date ( System.currentTimeMillis () );
final Event event = Event.create ().id ( UUID.randomUUID () ).sourceTimestamp ( ts ).entryTimestamp ( ts ).attribute ( Fields.MESSAGE, "deleted events from replication table due to call to cleanUp" ).attribute ( Fields.VALUE, j ).build ();
storeReplication ( connectionContext, event );
}
connectionContext.commit ();
return i;
}
} );
代码示例来源:origin: org.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage.postgres
final Event eventToStore = Event.create ().event ( event ).attribute ( Fields.COMMENT, comment ).build ();
this.dbExecutor.submit ( new Callable<Event> () {
@Override
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage.jdbc
@Override
public Event update ( final UUID id, final String comment, final StoreListener listener ) throws Exception
{
this.queueSize.incrementAndGet ();
logger.debug ( "Update of comment on event {} with comment '{}'", id, comment );
final Event event = Event.create ().event ( this.jdbcStorageDao.loadEvent ( id ) ).attribute ( Fields.COMMENT, comment ).build ();
this.executor.submit ( new Runnable () {
@Override
public void run ()
{
try
{
JdbcStorage.this.jdbcStorageDao.updateComment ( id, comment );
logger.debug ( "Comment saved to database - remaining queue: {}, event: {}", JdbcStorage.this.queueSize.get (), event );
JdbcStorage.this.queueSize.decrementAndGet ();
if ( listener != null )
{
listener.notify ( event );
}
}
catch ( final Exception e )
{
JdbcStorage.this.queueSize.decrementAndGet ();
logger.error ( "Exception occured ({}) while saving Comment to database: {}", e, event );
logger.info ( "Exception was", e );
}
}
} );
return event;
}
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage.postgres
public Event fromSqlArray ( final Array array ) throws SQLException, ParseException
{
final DateFormat isoDateFormat = new SimpleDateFormat ( isoDatePatterrn );
final EventBuilder eb = Event.create ();
final String[] fields = (String[])array.getArray ();
for ( int i = 0; i < fields.length; i += 2 )
{
final String key = fields[i];
final String value = fields[i + 1];
if ( key.equals ( "id" ) )
{
eb.id ( UUID.fromString ( value ) );
}
else if ( key.equals ( "sourceTimestamp" ) )
{
eb.sourceTimestamp ( isoDateFormat.parse ( value ) );
}
else if ( key.equals ( "entryTimestamp" ) )
{
eb.entryTimestamp ( isoDateFormat.parse ( value ) );
}
else
{
eb.attribute ( key, VariantEditor.toVariant ( value ) );
}
}
return eb.build ();
}
}
代码示例来源:origin: org.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage.postgres
public Event fromSqlArray ( final Array array ) throws SQLException, ParseException
{
final DateFormat isoDateFormat = new SimpleDateFormat ( isoDatePatterrn );
final EventBuilder eb = Event.create ();
final String[] fields = (String[])array.getArray ();
for ( int i = 0; i < fields.length; i += 2 )
{
final String key = fields[i];
final String value = fields[i + 1];
if ( key.equals ( "id" ) )
{
eb.id ( UUID.fromString ( value ) );
}
else if ( key.equals ( "sourceTimestamp" ) )
{
eb.sourceTimestamp ( isoDateFormat.parse ( value ) );
}
else if ( key.equals ( "entryTimestamp" ) )
{
eb.entryTimestamp ( isoDateFormat.parse ( value ) );
}
else
{
eb.attribute ( key, VariantEditor.toVariant ( value ) );
}
}
return eb.build ();
}
}
代码示例来源:origin: org.eclipse.neoscada.core/org.eclipse.scada.ae.monitor.common
protected EventBuilder createEvent ( final UserInformation userInformation )
{
final EventBuilder builder = Event.create ();
injectEventAttributes ( builder );
if ( userInformation != null )
{
builder.attribute ( Fields.ACTOR_TYPE, "USER" );
builder.attribute ( Fields.ACTOR_NAME, userInformation.getName () );
}
return builder;
}
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage
protected Event createEvent ( final Event event )
{
final EventBuilder builder = Event.create ().event ( event ).id ( UUID.randomUUID () );
final Date now = new GregorianCalendar ().getTime ();
if ( !allowEntryTimestamp || ( event.getEntryTimestamp () == null ) )
{
// if we are not allowed to have prefilled entryTimestamps
// or a missing the timestamp anyway
builder.entryTimestamp ( now );
}
if ( event.getSourceTimestamp () == null )
{
builder.sourceTimestamp ( now );
}
builder.attribute ( "nodeId", this.nodeId );
return builder.build ();
}
代码示例来源:origin: org.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage
protected Event createEvent ( final Event event )
{
final EventBuilder builder = Event.create ().event ( event ).id ( UUID.randomUUID () );
final Date now = new GregorianCalendar ().getTime ();
if ( !allowEntryTimestamp || ( event.getEntryTimestamp () == null ) )
{
// if we are not allowed to have prefilled entryTimestamps
// or a missing the timestamp anyway
builder.entryTimestamp ( now );
}
if ( event.getSourceTimestamp () == null )
{
builder.sourceTimestamp ( now );
}
builder.attribute ( "nodeId", this.nodeId );
return builder.build ();
}
代码示例来源:origin: org.eclipse.neoscada.core/org.eclipse.scada.ae.utils
protected EventBuilder create ( final Object value, final UserInformation userInformation )
{
final EventBuilder builder = Event.create ();
injectEventAttributes ( builder );
builder.attribute ( Event.Fields.EVENT_TYPE, "CFG" );
if ( userInformation != null )
{
builder.attribute ( Event.Fields.ACTOR_TYPE, "USER" );
builder.attribute ( Event.Fields.ACTOR_NAME, userInformation.getName () );
}
builder.attribute ( Event.Fields.VALUE, value );
return builder;
}
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.ae.server.storage.jdbc
EventBuilder eb = Event.create ();
boolean hasMore = true;
long l = 0;
eb = Event.create ();
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.ae.utils
protected EventBuilder create ( final Object value, final UserInformation userInformation )
{
final EventBuilder builder = Event.create ();
injectEventAttributes ( builder );
builder.attribute ( Event.Fields.EVENT_TYPE, "CFG" );
if ( userInformation != null )
{
builder.attribute ( Event.Fields.ACTOR_TYPE, "USER" );
builder.attribute ( Event.Fields.ACTOR_NAME, userInformation.getName () );
}
builder.attribute ( Event.Fields.VALUE, value );
return builder;
}
代码示例来源:origin: org.eclipse.neoscada.core/org.eclipse.scada.ae.server.injector
@Override
public synchronized Pair<Boolean, Event> evaluate ( final Event event )
{
if ( this.matcher != null )
{
if ( this.matcher.matches ( event ) )
{
final Variant message = makeMessage ( event );
triggerFailure ( Variant.NULL, makeLong ( event.getSourceTimestamp () ), this.configuration.severity, this.configuration.requireAkn, new MessageDecorator ( message ) );
final Event resultEvent = Event.create () //
.event ( event ) //
.attribute ( Fields.COMMENT, annotateCommentWithSource ( event ) ) //
.attribute ( Fields.SOURCE, getId () ) //
.attribute ( Fields.MONITOR_TYPE, this.monitorType )//
.build ();
return new Pair<Boolean, Event> ( true, resultEvent );
}
}
return new Pair<Boolean, Event> ( false, event );
}
代码示例来源:origin: de.dentrassi.eclipse.neoscada.core/org.eclipse.scada.ae.server.injector
@Override
public synchronized Pair<Boolean, Event> evaluate ( final Event event )
{
if ( this.matcher != null )
{
if ( this.matcher.matches ( event ) )
{
final Variant message = makeMessage ( event );
triggerFailure ( Variant.NULL, makeLong ( event.getSourceTimestamp () ), this.configuration.severity, this.configuration.requireAkn, new MessageDecorator ( message ) );
final Event resultEvent = Event.create () //
.event ( event ) //
.attribute ( Fields.COMMENT, annotateCommentWithSource ( event ) ) //
.attribute ( Fields.SOURCE, getId () ) //
.attribute ( Fields.MONITOR_TYPE, this.monitorType )//
.build ();
return new Pair<Boolean, Event> ( true, resultEvent );
}
}
return new Pair<Boolean, Event> ( false, event );
}
内容来源于网络,如有侵权,请联系作者删除!