idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
2,000
public static < T > ExampleExpression exampleExpression ( EbeanServer ebeanServer , Example < T > example ) { LikeType likeType ; switch ( example . getMatcher ( ) . getDefaultStringMatcher ( ) ) { case EXACT : likeType = LikeType . EQUAL_TO ; break ; case CONTAINING : likeType = LikeType . CONTAINS ; break ; case STAR...
Return a ExampleExpression from Spring data Example
2,001
private void resetSettings ( FeedbackPanel feedbackPanel , Component component , Widget widget , AjaxRequestTarget target ) { try { UserWidgetParameters wp = dashboardService . getUserWidgetParameters ( widget . getId ( ) ) ; if ( wp != null ) { storageService . removeEntityById ( wp . getId ( ) ) ; dashboardService . ...
return true if we reset settings for a dashboard link with UserWidgetParameters
2,002
public void syncUsers ( boolean createUsers , boolean deleteUsers ) { List < String > realmUserNames = externalUsersService . getUserNames ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Synchronize for realm=" + realm + " users=" + realmUserNames . size ( ) + " (createUsers = " + createUsers + ", deleteUsers = ...
from NextServerSession doesn t work
2,003
public static < T > ExpressionList < T > containsIfNoneBlank ( ExpressionList < T > expressionList , String propertyName , String value ) { Assert . notNull ( expressionList , "expressionList must not null" ) ; Assert . hasText ( propertyName , "propertyName must not blank" ) ; if ( StringUtils . hasText ( value ) ) { ...
Return a ExpressionList specifying propertyName contains value .
2,004
public static < T > ExpressionList < T > eqIfNotNull ( ExpressionList < T > expressionList , String propertyName , Object value ) { Assert . notNull ( expressionList , "expressionList must not null" ) ; Assert . hasText ( propertyName , "propertyName must not null" ) ; if ( value != null ) { return expressionList . eq ...
Return a ExpressionList specifying propertyName equals value .
2,005
public static < T > ExpressionList < T > betweenIfNotNull ( ExpressionList < T > expressionList , String propertyName , Object start , Object end ) { Assert . notNull ( expressionList , "expressionList must not null" ) ; Assert . hasText ( propertyName , "propertyName must not null" ) ; if ( start != null && end != nul...
Return a ExpressionList specifying propertyName between start and end .
2,006
public static < T > ExpressionList < T > orContains ( ExpressionList < T > expressionList , List < String > propertyNames , String value ) { Assert . notNull ( expressionList , "expressionList must not null" ) ; Assert . notEmpty ( propertyNames , "propertyNames must not empty" ) ; if ( StringUtils . hasText ( value ) ...
Return a ExpressionList specifying propertyNames contains value .
2,007
public static < T > Query < T > queryWithPage ( ExpressionList < T > expressionList , Pageable pageable ) { Assert . notNull ( expressionList , "expressionList must not null" ) ; Assert . notNull ( pageable , "pageable must not null" ) ; return expressionList . setMaxRows ( pageable . getPageSize ( ) ) . setFirstRow ( ...
Return query specifying page .
2,008
public < T > Query < T > createQuery ( Class < T > entityType , String eql ) { Assert . notNull ( entityType , "entityType must not null" ) ; Assert . hasText ( eql , "eql must has text" ) ; return ebeanServer . createQuery ( entityType , eql ) ; }
Return a query using Ebean ORM query .
2,009
public SqlQuery createSqlQuery ( String sql ) { Assert . hasText ( sql , "sql must has text" ) ; return ebeanServer . createSqlQuery ( sql ) ; }
Return an SqlQuery for performing native SQL queries that return SqlRow s .
2,010
public < T > Query < T > createSqlQuery ( Class < T > entityType , String sql ) { Assert . notNull ( entityType , "entityType must not null" ) ; Assert . hasText ( sql , "sql must has text" ) ; RawSqlBuilder rawSqlBuilder = RawSqlBuilder . parse ( sql ) ; return ebeanServer . find ( entityType ) . setRawSql ( rawSqlBui...
Return a query using native SQL .
2,011
public < T > Query < T > createSqlQueryMappingColumns ( Class < T > entityType , String sql , Map < String , String > columnMapping ) { Assert . notNull ( entityType , "entityType must not null" ) ; Assert . hasText ( sql , "sql must has text" ) ; Assert . notEmpty ( columnMapping , "columnMapping must not empty" ) ; R...
Return a query using native SQL and column mapping .
2,012
public < T > Query < T > createNamedQuery ( Class < T > entityType , String queryName ) { return ebeanServer . createNamedQuery ( entityType , queryName ) ; }
Return a query using query name .
2,013
public < T > DtoQuery < T > createDtoQuery ( Class < T > dtoType , String sql ) { return ebeanServer . findDto ( dtoType , sql ) . setRelaxedMode ( ) ; }
Return a dto query using sql .
2,014
public < T > DtoQuery < T > createNamedDtoQuery ( Class < T > dtoType , String namedQuery ) { return ebeanServer . createNamedDtoQuery ( dtoType , namedQuery ) . setRelaxedMode ( ) ; }
Return a named dto query .
2,015
public ExampleExpression exampleOf ( Object example , boolean caseInsensitive , LikeType likeType ) { return ebeanServer . getExpressionFactory ( ) . exampleLike ( example , caseInsensitive , likeType ) ; }
Return a ExampleExpression specifying more options .
2,016
private String getResizeJavaScript ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "$(window).bind(\'resizeEnd\',function(){" ) ; sb . append ( getAlarmCall ( ) ) ; sb . append ( "});" ) ; return sb . toString ( ) ; }
alarm call will be made only when resize event finished!
2,017
protected < T extends DomainEvent > T registerEvent ( T event ) { Assert . notNull ( event , "Domain event must not be null!" ) ; this . domainEvents . add ( event ) ; return event ; }
Registers the given event object for publication on a call to a Spring Data repository s save methods .
2,018
public static boolean hasIntervalParameters ( Settings settings , Report report ) { if ( ! ReportConstants . NEXT . equals ( report . getType ( ) ) ) { return false ; } ro . nextreports . engine . Report nextReport = NextUtil . getNextReport ( settings , report ) ; Map < String , QueryParameter > parameters = Parameter...
Test if a report has two parameters with names start_date and end_date of type date and with single selection
2,019
public static Properties parseURL ( String url , Properties info ) { if ( ( url == null ) || ! url . toLowerCase ( ) . startsWith ( driverPrefix ) ) { return null ; } Properties props = new Properties ( info ) ; Enumeration < ? > en = info . propertyNames ( ) ; while ( en . hasMoreElements ( ) ) { String key = ( String...
Parse the driver URL and extract the properties .
2,020
public boolean accept ( File file ) { String name = file . getName ( ) ; if ( file . isDirectory ( ) ) { return true ; } return ( name . startsWith ( "theme" ) && name . endsWith ( ".properties" ) ) ; }
Returns true .
2,021
@ Transactional ( readOnly = true ) public Settings getSettings ( ) { try { return ( Settings ) getEntity ( StorageConstants . SETTINGS_ROOT ) ; } catch ( NotFoundException e ) { e . printStackTrace ( ) ; LOG . error ( "Could not read Settings node" , e ) ; return new Settings ( ) ; } }
An Authentication object was not found in the SecurityContext
2,022
protected Component newAddAllComponent ( ) { return new PaletteButton ( "addAllButton" ) { private static final long serialVersionUID = 1L ; protected void onComponentTag ( ComponentTag tag ) { super . onComponentTag ( tag ) ; tag . getAttributes ( ) . put ( "onclick" , getAddAllOnClickJS ( ) ) ; } } ; }
factory method for the addAll component
2,023
protected Component newRemoveAllComponent ( ) { return new PaletteButton ( "removeAllButton" ) { private static final long serialVersionUID = 1L ; protected void onComponentTag ( ComponentTag tag ) { super . onComponentTag ( tag ) ; tag . getAttributes ( ) . put ( "onclick" , getRemoveAllOnClickJS ( ) ) ; } } ; }
factory method for the removeAll component
2,024
protected Component newRemoveComponent ( ) { return new PaletteButton ( "removeButton" ) { private static final long serialVersionUID = 1L ; protected void onComponentTag ( ComponentTag tag ) { super . onComponentTag ( tag ) ; tag . getAttributes ( ) . put ( "onclick" , getRemoveOnClickJS ( ) ) ; } } ; }
factory method for the remove component
2,025
protected Component newAddComponent ( ) { return new PaletteButton ( "addButton" ) { private static final long serialVersionUID = 1L ; protected void onComponentTag ( ComponentTag tag ) { super . onComponentTag ( tag ) ; tag . getAttributes ( ) . put ( "onclick" , getAddOnClickJS ( ) ) ; } } ; }
factory method for the addcomponent
2,026
private String encodeFileName ( String fileName ) { String result = Normalizer . normalize ( fileName , Normalizer . Form . NFD ) . replaceAll ( "\\s+" , "-" ) . replaceAll ( "[^A-Za-z0-9_\\-\\.]" , "" ) ; if ( result . isEmpty ( ) ) { result = "report" ; } return result ; }
All characters different from a standard set are deleted
2,027
protected Component newButtonBar ( String s ) { buttonBar = new AjaxWizardButtonBar ( s , this ) { public void onCancel ( AjaxRequestTarget target ) { EntityBrowserPanel panel = findParent ( EntityBrowserPanel . class ) ; panel . backwardWorkspace ( target ) ; } } ; buttonBar . setFinishSteps ( finishSteps ) ; return b...
Job step and Destination step are allowed to finish
2,028
protected boolean checkForSignIn ( ) { Authentication authentication = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; if ( ( authentication != null ) && authentication . isAuthenticated ( ) ) { LOG . debug ( "Security context contains CAS authentication" ) ; return true ; } return false ; }
used in NextServerApplication . addSecurityStrategy
2,029
private void addRuntimeNameProperty ( ) throws RepositoryException { String statement = "/jcr:root" + ISO9075 . encodePath ( StorageConstants . REPORTS_ROOT ) + "//*[@className='ro.nextreports.server.domain.Report']" + "//*[fn:name()='parametersValues']" ; QueryResult queryResult = getTemplate ( ) . query ( statement )...
add runtimeName property to ParameterValue
2,030
private void convertOldIdNameClass ( ) throws RepositoryException { String searchRoot = "/jcr:root" + ISO9075 . encodePath ( StorageConstants . NEXT_SERVER_ROOT ) ; String searchPropertyName = "className" ; String searchPropertyValue = "com.asf.nextserver.domain.ParameterValue" ; String statement = searchRoot + "//*[@"...
IdName values can be found in ParameterValue entities which are used in Dashboards widget parameters or Scheduler report runtime parameters
2,031
public String getMailServerIp ( ) { Settings settings = getSettings ( ) ; if ( settings . getMailServer ( ) == null ) { return "127.0.0.1" ; } return settings . getMailServer ( ) . getIp ( ) ; }
helper methods used in Spring xml files with SpEL
2,032
private void clearParentsCache ( Entity entity ) { try { String xpath = null ; if ( entity instanceof DataSource ) { xpath = "//nextServer//*[@dataSource='" + entity . getId ( ) + "']" ; } else if ( entity instanceof Report ) { xpath = "//nextServer/scheduler/*[@report='" + entity . getId ( ) + "']" ; } if ( xpath != n...
clear all parents from cache
2,033
private Connection getDerbyConnection ( String wkpDir ) { wkpDir = wkpDir . replaceAll ( "\\\\" , "/" ) ; System . err . println ( wkpDir ) ; String DB_CONN_STRING = "jdbc:derby:" + wkpDir + "/db;create=false" ; String DRIVER_CLASS_NAME = "org.apache.derby.jdbc.EmbeddedDriver" ; String USER_NAME = null ; String PASSWOR...
Uses DriverManager .
2,034
public static DateFormat getAlignedFormat ( ) { if ( DATE_FORMAT instanceof SimpleDateFormat ) { SimpleDateFormat sdf = ( SimpleDateFormat ) DATE_FORMAT ; String pattern = sdf . toPattern ( ) . replaceAll ( "M+" , "MM" ) . replaceAll ( "d+" , "dd" ) . replaceAll ( "h+" , "hh" ) . replaceAll ( "H+" , "HH" ) ; sdf . appl...
we need to take the pattern and modify it
2,035
public List < Serializable > getValues ( String text , String type ) throws NumberFormatException { List < Serializable > list = new ArrayList < Serializable > ( ) ; String [ ] values = text . split ( DELIM ) ; for ( String v : values ) { Serializable value ; if ( QueryParameter . INTEGER_VALUE . equals ( type ) ) { va...
number and string values can be separated by semicolon delimiter
2,036
private List < Serializable > getSelectedValues ( List < IdName > values , List < Serializable > defaultValues ) { List < Serializable > selectedValues = new ArrayList < Serializable > ( ) ; if ( defaultValues == null ) { return selectedValues ; } for ( Serializable s : defaultValues ) { for ( IdName in : values ) { if...
a default value must be simple java object or an IdName but only with the id
2,037
private AjaxFormComponentUpdatingBehavior createAjax ( final QueryParameter parameter , final IModel model , final Component component , final String time ) { return new AjaxFormComponentUpdatingBehavior ( "onchange" ) { @ SuppressWarnings ( "unchecked" ) protected void onUpdate ( AjaxRequestTarget target ) { if ( ( mo...
used to update hours and minutes
2,038
public static ReplacedString replaceString ( String s , String find , String replace ) { if ( replace == null ) replace = "-" ; int index = - 1 ; int l = find . length ( ) ; boolean replaced = false ; do { index = s . indexOf ( find , index ) ; if ( index >= 0 ) { replaced = true ; s = s . substring ( 0 , index ) + rep...
Replace a string with another
2,039
public static void writeToClipboard ( String text ) { Clipboard systemClipboard = Toolkit . getDefaultToolkit ( ) . getSystemClipboard ( ) ; Transferable transferableText = new StringSelection ( text ) ; systemClipboard . setContents ( transferableText , null ) ; }
Write a text to system clipboard
2,040
public static EntityTreeExpansionState get ( ) { EntityTreeExpansionState expansion = Session . get ( ) . getMetaData ( KEY ) ; if ( expansion == null ) { expansion = new EntityTreeExpansionState ( ) ; Session . get ( ) . setMetaData ( KEY , expansion ) ; } return expansion ; }
Get the expansion for the session .
2,041
private String getResizeJavaScript ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "$(window).bind(\'resizeEnd\',function(){" ) ; sb . append ( getIndicatorCall ( ) ) ; sb . append ( "});" ) ; return sb . toString ( ) ; }
indicator call will be made only when resize event finished!
2,042
public String getJsonData ( Chart chart ) throws ReportRunnerException , NoDataFoundException , TimeoutException { return getJsonData ( chart , null , null ) ; }
Methods with chart do not now anything about settings!!
2,043
public boolean isSingleWidget ( String widgetId ) { try { WidgetState state = ( WidgetState ) storageService . getEntityById ( widgetId ) ; DashboardState dState = getDashboardState ( state ) ; if ( dState . getColumnCount ( ) > 1 ) { return false ; } if ( dState . getWidgetStates ( ) . size ( ) > 1 ) { return false ; ...
just a single widget in a dashboard with a single column
2,044
private void resetDrillDownableCache ( String entityId ) { try { if ( entityId == null ) { return ; } Entity entity = storageService . getEntityById ( entityId ) ; if ( entity instanceof Chart ) { if ( ( ( Chart ) entity ) . isDrillDownable ( ) ) { resetCache ( entityId ) ; } } } catch ( NotFoundException ex ) { LOG . ...
for drill down reports there is no need to reset cache when we move the widget
2,045
public Method getTargetMethod ( Exchange exchange ) { Object o = exchange . getBindingOperationInfo ( ) . getOperationInfo ( ) . getProperty ( Method . class . getName ( ) ) ; if ( o != null && o instanceof Method ) { return ( Method ) o ; } else { throw new RuntimeException ( "Target method not found on OperationInfo"...
Utility method for getting the method which is going to be invoked on the service by underlying invoker .
2,046
public void reset ( ) { this . errorType = ErrorType . NONE ; this . message = null ; this . columnName = null ; this . columnValue = null ; this . columnType = null ; this . line = null ; this . lineNumber = 0 ; this . linePos = 0 ; }
Resets all of the fields to non - error status . This is used internally so we can reuse an instance of this class .
2,047
public T getValue ( Object obj ) throws IllegalAccessException , InvocationTargetException { if ( field == null ) { @ SuppressWarnings ( "unchecked" ) T cast = ( T ) getMethod . invoke ( obj ) ; return cast ; } else { @ SuppressWarnings ( "unchecked" ) T cast = ( T ) field . get ( obj ) ; return cast ; } }
Get the value associated with this field from the object parameter either by getting from the field or calling the get method .
2,048
public void setValue ( Object obj , T value ) throws IllegalAccessException , InvocationTargetException { if ( field == null ) { setMethod . invoke ( obj , value ) ; } else { field . set ( obj , value ) ; } }
Set the value associated with this field from the object parameter either by setting via the field or calling the set method .
2,049
public Invoker create ( Object service , Invoker rootInvoker , SessionFactory sessionFactory ) { ImmutableMap . Builder < String , UnitOfWork > unitOfWorkMethodsBuilder = new ImmutableMap . Builder < > ( ) ; for ( Method m : service . getClass ( ) . getMethods ( ) ) { if ( m . isAnnotationPresent ( UnitOfWork . class )...
Factory method for creating UnitOfWorkInvoker .
2,050
@ SuppressWarnings ( "unchecked" ) public AbstractBuilder cxfOutFaultInterceptors ( Interceptor < ? extends Message > ... interceptors ) { this . cxfOutFaultInterceptors = ImmutableList . < Interceptor < ? extends Message > > builder ( ) . add ( interceptors ) . build ( ) ; return this ; }
Add CXF interceptors to the outgoing fault interceptor chain .
2,051
public static void addInternalConverters ( Map < Class < ? > , Converter < ? , ? > > converterMap ) { converterMap . put ( BigDecimal . class , BigDecimalConverter . getSingleton ( ) ) ; converterMap . put ( BigInteger . class , BigIntegerConverter . getSingleton ( ) ) ; converterMap . put ( Boolean . class , BooleanCo...
Add internal converters to the map .
2,052
public static Converter < ? , ? > constructConverter ( Class < ? extends Converter < ? , ? > > clazz ) { Constructor < ? extends Converter < ? , ? > > constructor ; try { constructor = clazz . getConstructor ( ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Could not find public no-arg constructor f...
Construct a converter instance .
2,053
public Endpoint publishEndpoint ( EndpointBuilder endpointBuilder ) { checkArgument ( endpointBuilder != null , "EndpointBuilder is null" ) ; return this . jaxwsEnvironment . publishEndpoint ( endpointBuilder ) ; }
Publish JAX - WS endpoint . Endpoint will be published relative to the CXF servlet path .
2,054
public < T > T getClient ( ClientBuilder < T > clientBuilder ) { checkArgument ( clientBuilder != null , "ClientBuilder is null" ) ; return jaxwsEnvironment . getClient ( clientBuilder ) ; }
Factory method for creating JAX - WS clients .
2,055
private Invoker timed ( Invoker invoker , List < Method > timedMethods ) { ImmutableMap . Builder < String , Timer > timers = new ImmutableMap . Builder < > ( ) ; for ( Method m : timedMethods ) { Timed annotation = m . getAnnotation ( Timed . class ) ; final String name = chooseName ( annotation . name ( ) , annotatio...
Factory method for TimedInvoker .
2,056
private Invoker metered ( Invoker invoker , List < Method > meteredMethods ) { ImmutableMap . Builder < String , Meter > meters = new ImmutableMap . Builder < > ( ) ; for ( Method m : meteredMethods ) { Metered annotation = m . getAnnotation ( Metered . class ) ; final String name = chooseName ( annotation . name ( ) ,...
Factory method for MeteredInvoker .
2,057
private Invoker exceptionMetered ( Invoker invoker , List < Method > meteredMethods ) { ImmutableMap . Builder < String , InstrumentedInvokers . ExceptionMeter > meters = new ImmutableMap . Builder < > ( ) ; for ( Method m : meteredMethods ) { ExceptionMetered annotation = m . getAnnotation ( ExceptionMetered . class )...
Factory method for ExceptionMeteredInvoker .
2,058
public Invoker create ( Object service , Invoker rootInvoker ) { List < Method > timedmethods = new ArrayList < > ( ) ; List < Method > meteredmethods = new ArrayList < > ( ) ; List < Method > exceptionmeteredmethods = new ArrayList < > ( ) ; for ( Method m : service . getClass ( ) . getMethods ( ) ) { if ( m . isAnnot...
Factory method for creating instrumented invoker chain .
2,059
public Endpoint publishEndpoint ( EndpointBuilder endpointBuilder ) { checkArgument ( endpointBuilder != null , "EndpointBuilder is null" ) ; EndpointImpl cxfendpoint = new EndpointImpl ( bus , endpointBuilder . getService ( ) ) ; if ( endpointBuilder . publishedEndpointUrl ( ) != null ) { cxfendpoint . setPublishedEnd...
Publish JAX - WS server side endpoint . Returns javax . xml . ws . Endpoint to enable further customization .
2,060
public < T > T getClient ( ClientBuilder < T > clientBuilder ) { JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean ( ) ; proxyFactory . setServiceClass ( clientBuilder . getServiceClass ( ) ) ; proxyFactory . setAddress ( clientBuilder . getAddress ( ) ) ; if ( clientBuilder . getHandlers ( ) != null ) { f...
JAX - WS client factory
2,061
public List < T > readAll ( File file , Collection < ParseError > parseErrors ) throws IOException , ParseException { checkEntityConfig ( ) ; return readAll ( new FileReader ( file ) , parseErrors ) ; }
Read in all of the entities in the file passed in .
2,062
public List < T > readAll ( Reader reader , Collection < ParseError > parseErrors ) throws IOException , ParseException { checkEntityConfig ( ) ; BufferedReader bufferedReader = new BufferedReaderLineCounter ( reader ) ; try { ParseError parseError = null ; if ( parseErrors != null ) { parseError = new ParseError ( ) ;...
Read in all of the entities in the reader passed in . It will use an internal buffered reader .
2,063
public String [ ] readHeader ( BufferedReader bufferedReader , ParseError parseError ) throws ParseException , IOException { checkEntityConfig ( ) ; String header = bufferedReader . readLine ( ) ; if ( header == null ) { if ( parseError == null ) { throw new ParseException ( "no header line read" , 0 ) ; } else { parse...
Read in a line and process it as a CSV header .
2,064
public List < T > readRows ( BufferedReader bufferedReader , Collection < ParseError > parseErrors ) throws IOException , ParseException { checkEntityConfig ( ) ; ParseError parseError = null ; if ( parseErrors != null ) { parseError = new ParseError ( ) ; } List < T > results = new ArrayList < T > ( ) ; while ( true )...
Read in all of the entities in the reader passed in but without the header .
2,065
public T readRow ( BufferedReader bufferedReader , ParseError parseError ) throws ParseException , IOException { checkEntityConfig ( ) ; String line = bufferedReader . readLine ( ) ; if ( line == null ) { return null ; } else { return processRow ( line , bufferedReader , parseError , getLineNumber ( bufferedReader ) ) ...
Read an entity line from the reader .
2,066
public boolean validateHeader ( String line , ParseError parseError ) throws ParseException { checkEntityConfig ( ) ; String [ ] columns = processHeader ( line , parseError ) ; return validateHeaderColumns ( columns , parseError , 1 ) ; }
Validate the header row against the configured header columns .
2,067
public String [ ] processHeader ( String line , ParseError parseError ) throws ParseException { checkEntityConfig ( ) ; try { return processHeader ( line , parseError , 1 ) ; } catch ( IOException e ) { return null ; } }
Process a header line and divide it up into a series of quoted columns .
2,068
public T processRow ( String line , ParseError parseError ) throws ParseException { checkEntityConfig ( ) ; try { return processRow ( line , null , parseError , 1 ) ; } catch ( IOException e ) { return null ; } }
Read and process a line and return the associated entity .
2,069
public void writeAll ( File file , Collection < T > entities , boolean writeHeader ) throws IOException { writeAll ( new FileWriter ( file ) , entities , writeHeader ) ; }
Write a collection of entities to the writer .
2,070
public void writeAll ( Writer writer , Collection < T > entities , boolean writeHeader ) throws IOException { checkEntityConfig ( ) ; BufferedWriter bufferedWriter = new BufferedWriter ( writer ) ; try { if ( writeHeader ) { writeHeader ( bufferedWriter , true ) ; } for ( T entity : entities ) { writeRow ( bufferedWrit...
Write a header and then the collection of entities to the writer .
2,071
public void writeHeader ( BufferedWriter bufferedWriter , boolean appendLineTermination ) throws IOException { checkEntityConfig ( ) ; bufferedWriter . write ( buildHeaderLine ( appendLineTermination ) ) ; }
Write the header line to the writer .
2,072
public void writeRow ( BufferedWriter bufferedWriter , T entity , boolean appendLineTermination ) throws IOException { checkEntityConfig ( ) ; String line = buildLine ( entity , appendLineTermination ) ; bufferedWriter . write ( line ) ; }
Write an entity row to the writer .
2,073
public String buildHeaderLine ( boolean appendLineTermination ) { checkEntityConfig ( ) ; StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( ColumnInfo < ? > columnInfo : allColumnInfos ) { if ( first ) { first = false ; } else { sb . append ( columnSeparator ) ; } String header = columnInfo . getC...
Build and return a header string made up of quoted column names .
2,074
public String buildLine ( T entity , boolean appendLineTermination ) { checkEntityConfig ( ) ; StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( ColumnInfo < Object > columnInfo : allColumnInfos ) { if ( first ) { first = false ; } else { sb . append ( columnSeparator ) ; } Object value ; try { va...
Convert the entity into a string of column values .
2,075
private void extractAndAssignValue ( String line , int lineNumber , ColumnInfo < Object > columnInfo , String columnStr , int linePos , Object target , ParseError parseError ) { Object value = extractValue ( line , lineNumber , columnInfo , columnStr , linePos , target , parseError ) ; if ( value == null ) { assignPars...
Extract a value from the line convert it into its java equivalent and assign it to our target object .
2,076
private Object extractValue ( String line , int lineNumber , ColumnInfo < Object > columnInfo , String columnStr , int linePos , Object target , ParseError parseError ) { Converter < Object , ? > converter = columnInfo . getConverter ( ) ; if ( alwaysTrimInput || columnInfo . isTrimInput ( ) || converter . isAlwaysTrim...
Extract a value from the line and convert it into its java equivalent .
2,077
public ClientBuilder < T > handlers ( Handler ... handlers ) { this . handlers = ImmutableList . < Handler > builder ( ) . add ( handlers ) . build ( ) ; return this ; }
Add client side JAX - WS handlers .
2,078
public static void premain ( String args , Instrumentation inst ) { GagTransformer transformer = new GagTransformer ( ) ; if ( args == null || args . length ( ) == 0 ) { transformer . addAllGenerators ( ) ; } else { for ( String key : args . split ( "," ) ) { transformer . addGeneratorForKey ( key ) ; } } inst . addTra...
An instrumentation agent needs to have a premain method .
2,079
public void initialize ( ) { deviceDirectory = getDeviceDirectory ( ) ; for ( int PortType = CommPortIdentifier . PORT_SERIAL ; PortType <= CommPortIdentifier . PORT_PARALLEL ; PortType ++ ) { if ( ! registerSpecifiedPorts ( PortType ) ) { if ( ! registerKnownPorts ( PortType ) ) { registerScannedPorts ( PortType ) ; }...
Determine the OS and where the OS has the devices located
2,080
private static void AddIdentifierToList ( CommPortIdentifier cpi ) { LOGGER . fine ( "CommPortIdentifier:AddIdentifierToList()" ) ; synchronized ( Sync ) { if ( CommPortIndex == null ) { CommPortIndex = cpi ; LOGGER . fine ( "CommPortIdentifier:AddIdentifierToList() null" ) ; } else { CommPortIdentifier index = CommPor...
by implementing its own linked list functionallity
2,081
static public CommPortIdentifier getPortIdentifier ( CommPort p ) throws NoSuchPortException { LOGGER . fine ( "CommPortIdentifier:getPortIdentifier(CommPort)" ) ; CommPortIdentifier c ; synchronized ( Sync ) { c = CommPortIndex ; while ( c != null && c . commPort != p ) { c = c . next ; } } if ( c != null ) { return (...
Gets communication port identifier
2,082
static public Enumeration < CommPortIdentifier > getPortIdentifiers ( ) { LOGGER . fine ( "static CommPortIdentifier:getPortIdentifiers()" ) ; synchronized ( Sync ) { HashMap oldPorts = new HashMap ( ) ; CommPortIdentifier p = CommPortIndex ; while ( p != null ) { oldPorts . put ( p . portName , p ) ; p = p . next ; } ...
Returns an enumeration of port identifiers which represent the communication ports currently available on the system .
2,083
public CommPort open ( String TheOwner , int i ) throws gnu . io . PortInUseException { LOGGER . fine ( "CommPortIdentifier:open(" + TheOwner + ", " + i + ")" ) ; boolean isAvailable ; synchronized ( this ) { isAvailable = this . Available ; if ( isAvailable ) { this . Available = false ; this . Owner = TheOwner ; } } ...
not written in java? I can t see where this request is done .
2,084
public void removePortOwnershipListener ( CommPortOwnershipListener c ) { LOGGER . fine ( "CommPortIdentifier:removePortOwnershipListener()" ) ; if ( ownershipListener != null ) { ownershipListener . removeElement ( c ) ; } }
removes PortOwnership listener
2,085
void internalClosePort ( ) { synchronized ( this ) { LOGGER . fine ( "CommPortIdentifier:internalClosePort()" ) ; Owner = null ; Available = true ; commPort = null ; notifyAll ( ) ; } fireOwnershipEvent ( CommPortOwnershipListener . PORT_UNOWNED ) ; }
clean up the Ownership information and send the event
2,086
public void removeEventListener ( ) { logger . fine ( "RXTXPort:removeEventListener() called" ) ; waitForTheNativeCodeSilly ( ) ; if ( monThreadisInterrupted == true ) { logger . fine ( " RXTXPort:removeEventListener() already interrupted" ) ; monThread = null ; SPEventListener = null ; return ; } else if ( monThread !...
Remove the serial port event listener
2,087
public static String [ ] getSerialPortList ( ) { Enumeration portList ; portList = CommPortIdentifier . getPortIdentifiers ( ) ; int serialPortCount = 0 ; while ( portList . hasMoreElements ( ) ) { CommPortIdentifier portId = ( CommPortIdentifier ) portList . nextElement ( ) ; if ( portId . getPortType ( ) == CommPortI...
Zwraca liste portow szeregowych
2,088
public static String [ ] getParallelPortList ( ) { Enumeration portList ; portList = CommPortIdentifier . getPortIdentifiers ( ) ; int serialPortCount = 0 ; while ( portList . hasMoreElements ( ) ) { CommPortIdentifier portId = ( CommPortIdentifier ) portList . nextElement ( ) ; if ( portId . getPortType ( ) == CommPor...
Zwraca liste portow rownoleglych
2,089
public TokenSyncDate getTokenSyncDate ( Integer subscriptionId ) { EntityManager entityManager = getEntityManager ( ) ; try { List < TokenSyncDate > list = entityManager . createQuery ( "SELECT syncDate FROM TokenSyncDate AS syncDate WHERE subscriptionId = :subscriptionId" , TokenSyncDate . class ) . setMaxResults ( 1 ...
get the date the tokens where last synced for the subscriptionId passed as argument
2,090
public void changeConfiguration ( ChargingStationId chargingStationId , ConfigurationItem configurationItem , CorrelationToken correlationToken ) { Changeconfiguration changeConfigurationRequest = new Changeconfiguration ( ) ; changeConfigurationRequest . setKey ( configurationItem . getKey ( ) ) ; changeConfigurationR...
Send a request to a charging station to change a configuration item .
2,091
private IdTagInfo_ . Status convertAuthenticationStatus ( IdentifyingToken . AuthenticationStatus status ) { IdTagInfo_ . Status result ; switch ( status ) { case ACCEPTED : result = IdTagInfo_ . Status . ACCEPTED ; break ; case EXPIRED : result = IdTagInfo_ . Status . EXPIRED ; break ; case DELETED : result = IdTagInf...
Converts the AuthenticationStatus into an OCPPJ specific status
2,092
public ChargePoint getVasRepresentation ( ChargingStation chargingStation ) { ChargePoint chargePoint = new ChargePoint ( ) ; chargePoint . setAddress ( chargingStation . getAddress ( ) ) ; chargePoint . getChargingCapabilities ( ) . addAll ( getChargingCapabilities ( chargingStation ) ) ; chargePoint . setChargingMode...
Creates a VAS representation of a charging station .
2,093
private void updateReservableForChargingStation ( ChargingStationId chargingStationId , boolean reservable ) { ChargingStation chargingStation = getChargingStation ( chargingStationId ) ; if ( chargingStation != null ) { chargingStation . setReservable ( reservable ) ; chargingStationRepository . createOrUpdate ( charg...
Updates the reservable property of the charging station . If the charging station cannot be found in the repository an error is logged .
2,094
private boolean reset ( ChargingStationId id , ResetType type ) { ChargePointService chargePointService = this . createChargingStationService ( id ) ; ResetRequest request = new ResetRequest ( ) ; request . setType ( type ) ; ResetResponse response = chargePointService . reset ( request , id . getId ( ) ) ; boolean has...
Reset a charging station .
2,095
private void updateEvseStatus ( ChargingStation chargingStation , String componentId , ComponentStatus status ) { for ( Evse evse : chargingStation . getEvses ( ) ) { if ( evse . getEvseId ( ) . equals ( componentId ) ) { evse . setStatus ( status ) ; } } }
Updates the status of a Evse in the charging station object if the evse id matches the component id .
2,096
private void updateChargingStationAvailability ( ChargingStationId chargingStationId , Availability availability ) { ChargingStation chargingStation = repository . findOne ( chargingStationId . getId ( ) ) ; if ( chargingStation != null ) { chargingStation . setAvailability ( availability ) ; repository . createOrUpdat...
Updates the charging station s availability .
2,097
private void updateComponentAvailability ( ChargingStationId chargingStationId , ComponentId componentId , ChargingStationComponent component , Availability availability ) { if ( ! component . equals ( ChargingStationComponent . EVSE ) || ! ( componentId instanceof EvseId ) ) { return ; } ChargingStation chargingStatio...
Updates a charging station s component availability .
2,098
private boolean updateChargingStationOpeningTimes ( ChargingStationOpeningTimesChangedEvent event , boolean clear ) { ChargingStation chargingStation = repository . findOne ( event . getChargingStationId ( ) . getId ( ) ) ; if ( chargingStation != null ) { if ( ! event . getOpeningTimes ( ) . isEmpty ( ) ) { if ( clear...
Updates the opening times of the charging station .
2,099
private boolean updateChargingStationLocation ( ChargingStationLocationChangedEvent event ) { ChargingStation chargingStation = repository . findOne ( event . getChargingStationId ( ) . getId ( ) ) ; if ( chargingStation != null ) { if ( event . getCoordinates ( ) != null ) { chargingStation . setLatitude ( event . get...
Updates the location of the charging station .