id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
6,700
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.betweenIfNotNull
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 != null) { return expressionList.between(propertyName, start, end); } return expressionList; }
java
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 != null) { return expressionList.between(propertyName, start, end); } return expressionList; }
[ "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", "!=", "null", ")", "{", "return", "expressionList", ".", "between", "(", "propertyName", ",", "start", ",", "end", ")", ";", "}", "return", "expressionList", ";", "}" ]
Return a ExpressionList specifying propertyName between start and end. @param expressionList the ExpressionList to add contains expression @param propertyName the property name of entity bean. @param start start value. @param end end value. @param <T> the type of entity. @return a ExpressionList specifying propertyName between start and end.
[ "Return", "a", "ExpressionList", "specifying", "propertyName", "between", "start", "and", "end", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L292-L302
6,701
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.orContains
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)) { Junction<T> junction = expressionList .or(); ExpressionList<T> exp = null; for (String propertyName : propertyNames) { if (exp == null) { exp = junction.contains(propertyName, value); } else { exp = exp.contains(propertyName, value); } } if (exp != null) { exp.endOr(); return exp; } } return expressionList; }
java
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)) { Junction<T> junction = expressionList .or(); ExpressionList<T> exp = null; for (String propertyName : propertyNames) { if (exp == null) { exp = junction.contains(propertyName, value); } else { exp = exp.contains(propertyName, value); } } if (exp != null) { exp.endOr(); return exp; } } return expressionList; }
[ "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", ")", ")", "{", "Junction", "<", "T", ">", "junction", "=", "expressionList", ".", "or", "(", ")", ";", "ExpressionList", "<", "T", ">", "exp", "=", "null", ";", "for", "(", "String", "propertyName", ":", "propertyNames", ")", "{", "if", "(", "exp", "==", "null", ")", "{", "exp", "=", "junction", ".", "contains", "(", "propertyName", ",", "value", ")", ";", "}", "else", "{", "exp", "=", "exp", ".", "contains", "(", "propertyName", ",", "value", ")", ";", "}", "}", "if", "(", "exp", "!=", "null", ")", "{", "exp", ".", "endOr", "(", ")", ";", "return", "exp", ";", "}", "}", "return", "expressionList", ";", "}" ]
Return a ExpressionList specifying propertyNames contains value. @param expressionList the ExpressionList to add contains expression @param propertyNames the property name of entity bean. @param value contains value. @param <T> the type of entity. @return the ExpressionList specifying propertyNames contains value.
[ "Return", "a", "ExpressionList", "specifying", "propertyNames", "contains", "value", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L313-L335
6,702
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.queryWithPage
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((int) pageable.getOffset()) .setOrder(Converters.convertToEbeanOrderBy(pageable.getSort())); }
java
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((int) pageable.getOffset()) .setOrder(Converters.convertToEbeanOrderBy(pageable.getSort())); }
[ "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", "(", "(", "int", ")", "pageable", ".", "getOffset", "(", ")", ")", ".", "setOrder", "(", "Converters", ".", "convertToEbeanOrderBy", "(", "pageable", ".", "getSort", "(", ")", ")", ")", ";", "}" ]
Return query specifying page. @param expressionList the ExpressionList to add contains expression @param pageable 0-based index page. @param <T> the type of entity. @return the query specifying page.
[ "Return", "query", "specifying", "page", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L345-L351
6,703
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.createQuery
@Override 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); }
java
@Override 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); }
[ "@", "Override", "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. @param eql the Ebean ORM query. @return the created Query using ORM query.
[ "Return", "a", "query", "using", "Ebean", "ORM", "query", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L424-L429
6,704
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.createSqlQuery
@Override public SqlQuery createSqlQuery(String sql) { Assert.hasText(sql, "sql must has text"); return ebeanServer.createSqlQuery(sql); }
java
@Override public SqlQuery createSqlQuery(String sql) { Assert.hasText(sql, "sql must has text"); return ebeanServer.createSqlQuery(sql); }
[ "@", "Override", "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. @param sql the sql to create SqlQuery using native SQL. @return the created SqlQuery.
[ "Return", "an", "SqlQuery", "for", "performing", "native", "SQL", "queries", "that", "return", "SqlRow", "s", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L437-L441
6,705
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.createSqlQuery
@Override 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(rawSqlBuilder.create()); }
java
@Override 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(rawSqlBuilder.create()); }
[ "@", "Override", "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", "(", "rawSqlBuilder", ".", "create", "(", ")", ")", ";", "}" ]
Return a query using native SQL. @param sql native SQL. @return the created Query using native SQL.
[ "Return", "a", "query", "using", "native", "SQL", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L449-L455
6,706
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.createSqlQueryMappingColumns
@Override 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"); RawSqlBuilder rawSqlBuilder = RawSqlBuilder.parse(sql); columnMapping.entrySet().forEach(entry -> { rawSqlBuilder.columnMapping(entry.getKey(), entry.getValue()); }); return ebeanServer.find(entityType).setRawSql(rawSqlBuilder.create()); }
java
@Override 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"); RawSqlBuilder rawSqlBuilder = RawSqlBuilder.parse(sql); columnMapping.entrySet().forEach(entry -> { rawSqlBuilder.columnMapping(entry.getKey(), entry.getValue()); }); return ebeanServer.find(entityType).setRawSql(rawSqlBuilder.create()); }
[ "@", "Override", "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\"", ")", ";", "RawSqlBuilder", "rawSqlBuilder", "=", "RawSqlBuilder", ".", "parse", "(", "sql", ")", ";", "columnMapping", ".", "entrySet", "(", ")", ".", "forEach", "(", "entry", "->", "{", "rawSqlBuilder", ".", "columnMapping", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", ")", ";", "return", "ebeanServer", ".", "find", "(", "entityType", ")", ".", "setRawSql", "(", "rawSqlBuilder", ".", "create", "(", ")", ")", ";", "}" ]
Return a query using native SQL and column mapping. @param sql native SQL @param columnMapping column mapping,key is dbColumn, value is propertyName. @return the created Query using native SQL and column mapping config.
[ "Return", "a", "query", "using", "native", "SQL", "and", "column", "mapping", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L464-L476
6,707
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.createNamedQuery
@Override public <T> Query<T> createNamedQuery(Class<T> entityType, String queryName) { return ebeanServer.createNamedQuery(entityType, queryName); }
java
@Override public <T> Query<T> createNamedQuery(Class<T> entityType, String queryName) { return ebeanServer.createNamedQuery(entityType, queryName); }
[ "@", "Override", "public", "<", "T", ">", "Query", "<", "T", ">", "createNamedQuery", "(", "Class", "<", "T", ">", "entityType", ",", "String", "queryName", ")", "{", "return", "ebeanServer", ".", "createNamedQuery", "(", "entityType", ",", "queryName", ")", ";", "}" ]
Return a query using query name. @param queryName the name of query defined in ebean.xml or Entity. @return the query using query name.
[ "Return", "a", "query", "using", "query", "name", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L505-L508
6,708
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.createDtoQuery
@Override public <T> DtoQuery<T> createDtoQuery(Class<T> dtoType, String sql) { return ebeanServer.findDto(dtoType, sql).setRelaxedMode(); }
java
@Override public <T> DtoQuery<T> createDtoQuery(Class<T> dtoType, String sql) { return ebeanServer.findDto(dtoType, sql).setRelaxedMode(); }
[ "@", "Override", "public", "<", "T", ">", "DtoQuery", "<", "T", ">", "createDtoQuery", "(", "Class", "<", "T", ">", "dtoType", ",", "String", "sql", ")", "{", "return", "ebeanServer", ".", "findDto", "(", "dtoType", ",", "sql", ")", ".", "setRelaxedMode", "(", ")", ";", "}" ]
Return a dto query using sql. @param dtoType DTO Bean type, just normal classes @param sql native SQL @return
[ "Return", "a", "dto", "query", "using", "sql", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L517-L520
6,709
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.createNamedDtoQuery
@Override public <T> DtoQuery<T> createNamedDtoQuery(Class<T> dtoType, String namedQuery) { return ebeanServer.createNamedDtoQuery(dtoType, namedQuery).setRelaxedMode(); }
java
@Override public <T> DtoQuery<T> createNamedDtoQuery(Class<T> dtoType, String namedQuery) { return ebeanServer.createNamedDtoQuery(dtoType, namedQuery).setRelaxedMode(); }
[ "@", "Override", "public", "<", "T", ">", "DtoQuery", "<", "T", ">", "createNamedDtoQuery", "(", "Class", "<", "T", ">", "dtoType", ",", "String", "namedQuery", ")", "{", "return", "ebeanServer", ".", "createNamedDtoQuery", "(", "dtoType", ",", "namedQuery", ")", ".", "setRelaxedMode", "(", ")", ";", "}" ]
Return a named dto query. @param dtoType DTO Bean type, just normal classes @param namedQuery the query using query name. @return
[ "Return", "a", "named", "dto", "query", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L529-L532
6,710
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.exampleOf
@Override public ExampleExpression exampleOf(Object example, boolean caseInsensitive, LikeType likeType) { return ebeanServer.getExpressionFactory().exampleLike(example, caseInsensitive, likeType); }
java
@Override public ExampleExpression exampleOf(Object example, boolean caseInsensitive, LikeType likeType) { return ebeanServer.getExpressionFactory().exampleLike(example, caseInsensitive, likeType); }
[ "@", "Override", "public", "ExampleExpression", "exampleOf", "(", "Object", "example", ",", "boolean", "caseInsensitive", ",", "LikeType", "likeType", ")", "{", "return", "ebeanServer", ".", "getExpressionFactory", "(", ")", ".", "exampleLike", "(", "example", ",", "caseInsensitive", ",", "likeType", ")", ";", "}" ]
Return a ExampleExpression specifying more options. @return the created ExampleExpression specifying more options.
[ "Return", "a", "ExampleExpression", "specifying", "more", "options", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L549-L554
6,711
nextreports/nextreports-server
src/ro/nextreports/server/web/dashboard/alarm/AlarmHTML5Panel.java
AlarmHTML5Panel.getResizeJavaScript
private String getResizeJavaScript() { StringBuilder sb = new StringBuilder(); sb.append("$(window).bind(\'resizeEnd\',function(){"); sb.append(getAlarmCall()); sb.append("});"); return sb.toString(); }
java
private String getResizeJavaScript() { StringBuilder sb = new StringBuilder(); sb.append("$(window).bind(\'resizeEnd\',function(){"); sb.append(getAlarmCall()); sb.append("});"); return sb.toString(); }
[ "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!
[ "alarm", "call", "will", "be", "made", "only", "when", "resize", "event", "finished!" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/dashboard/alarm/AlarmHTML5Panel.java#L78-L84
6,712
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/domain/AbstractAggregateRoot.java
AbstractAggregateRoot.registerEvent
protected <T extends DomainEvent> T registerEvent(T event) { Assert.notNull(event, "Domain event must not be null!"); this.domainEvents.add(event); return event; }
java
protected <T extends DomainEvent> T registerEvent(T event) { Assert.notNull(event, "Domain event must not be null!"); this.domainEvents.add(event); return event; }
[ "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. @param event must not be {@literal null}. @return the event that has been added.
[ "Registers", "the", "given", "event", "object", "for", "publication", "on", "a", "call", "to", "a", "Spring", "Data", "repository", "s", "save", "methods", "." ]
dd11b97654982403b50dd1d5369cadad71fce410
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/domain/AbstractAggregateRoot.java#L47-L52
6,713
nextreports/nextreports-server
src/ro/nextreports/server/report/util/ReportUtil.java
ReportUtil.hasIntervalParameters
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 = ParameterUtil.getUsedParametersMap(nextReport); boolean hasStart = false; boolean hasEnd = false; for (QueryParameter qp : parameters.values()) { if (QueryParameter.INTERVAL_START_DATE_NAME.equals(qp.getName())) { if (!ParameterUtil.isDateTime(qp)) { return false; } if (!qp.getSelection().equals(QueryParameter.SINGLE_SELECTION)) { return false; } hasStart = true; } else if (QueryParameter.INTERVAL_END_DATE_NAME.equals(qp.getName())) { if (!ParameterUtil.isDateTime(qp)) { return false; } if (!qp.getSelection().equals(QueryParameter.SINGLE_SELECTION)) { return false; } hasEnd = true; } } return (hasStart && hasEnd); }
java
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 = ParameterUtil.getUsedParametersMap(nextReport); boolean hasStart = false; boolean hasEnd = false; for (QueryParameter qp : parameters.values()) { if (QueryParameter.INTERVAL_START_DATE_NAME.equals(qp.getName())) { if (!ParameterUtil.isDateTime(qp)) { return false; } if (!qp.getSelection().equals(QueryParameter.SINGLE_SELECTION)) { return false; } hasStart = true; } else if (QueryParameter.INTERVAL_END_DATE_NAME.equals(qp.getName())) { if (!ParameterUtil.isDateTime(qp)) { return false; } if (!qp.getSelection().equals(QueryParameter.SINGLE_SELECTION)) { return false; } hasEnd = true; } } return (hasStart && hasEnd); }
[ "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", "=", "ParameterUtil", ".", "getUsedParametersMap", "(", "nextReport", ")", ";", "boolean", "hasStart", "=", "false", ";", "boolean", "hasEnd", "=", "false", ";", "for", "(", "QueryParameter", "qp", ":", "parameters", ".", "values", "(", ")", ")", "{", "if", "(", "QueryParameter", ".", "INTERVAL_START_DATE_NAME", ".", "equals", "(", "qp", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "!", "ParameterUtil", ".", "isDateTime", "(", "qp", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "qp", ".", "getSelection", "(", ")", ".", "equals", "(", "QueryParameter", ".", "SINGLE_SELECTION", ")", ")", "{", "return", "false", ";", "}", "hasStart", "=", "true", ";", "}", "else", "if", "(", "QueryParameter", ".", "INTERVAL_END_DATE_NAME", ".", "equals", "(", "qp", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "!", "ParameterUtil", ".", "isDateTime", "(", "qp", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "qp", ".", "getSelection", "(", ")", ".", "equals", "(", "QueryParameter", ".", "SINGLE_SELECTION", ")", ")", "{", "return", "false", ";", "}", "hasEnd", "=", "true", ";", "}", "}", "return", "(", "hasStart", "&&", "hasEnd", ")", ";", "}" ]
Test if a report has two parameters with names start_date and end_date, of type date and with single selection @param settings settings @param report report @return true if a report has two parameters with names start_date and end_date, of type date and with single selection
[ "Test", "if", "a", "report", "has", "two", "parameters", "with", "names", "start_date", "and", "end_date", "of", "type", "date", "and", "with", "single", "selection" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/report/util/ReportUtil.java#L272-L300
6,714
nextreports/nextreports-server
src/ro/nextreports/server/api/client/jdbc/Driver.java
Driver.parseURL
public static Properties parseURL(String url, Properties info) { if ((url == null) || !url.toLowerCase().startsWith(driverPrefix)) { return null; // throws exception ?! } Properties props = new Properties(info); // take local copy of existing properties Enumeration<?> en = info.propertyNames(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); String value = info.getProperty(key); if (value != null) { props.setProperty(key.toUpperCase(), value); } } String tmp = url.substring(driverPrefix.length()); String[] tokens = tmp.split(";"); if (tokens.length != 2) { return null; // datasource missing } try { new URL(tokens[0]); } catch (MalformedURLException e) { return null; // url invalid } props.setProperty(SERVER_URL, tokens[0]); props.setProperty(DATASOURCE_PATH, tokens[1]); return props; }
java
public static Properties parseURL(String url, Properties info) { if ((url == null) || !url.toLowerCase().startsWith(driverPrefix)) { return null; // throws exception ?! } Properties props = new Properties(info); // take local copy of existing properties Enumeration<?> en = info.propertyNames(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); String value = info.getProperty(key); if (value != null) { props.setProperty(key.toUpperCase(), value); } } String tmp = url.substring(driverPrefix.length()); String[] tokens = tmp.split(";"); if (tokens.length != 2) { return null; // datasource missing } try { new URL(tokens[0]); } catch (MalformedURLException e) { return null; // url invalid } props.setProperty(SERVER_URL, tokens[0]); props.setProperty(DATASOURCE_PATH, tokens[1]); return props; }
[ "public", "static", "Properties", "parseURL", "(", "String", "url", ",", "Properties", "info", ")", "{", "if", "(", "(", "url", "==", "null", ")", "||", "!", "url", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "driverPrefix", ")", ")", "{", "return", "null", ";", "// throws exception ?!", "}", "Properties", "props", "=", "new", "Properties", "(", "info", ")", ";", "// take local copy of existing properties", "Enumeration", "<", "?", ">", "en", "=", "info", ".", "propertyNames", "(", ")", ";", "while", "(", "en", ".", "hasMoreElements", "(", ")", ")", "{", "String", "key", "=", "(", "String", ")", "en", ".", "nextElement", "(", ")", ";", "String", "value", "=", "info", ".", "getProperty", "(", "key", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "props", ".", "setProperty", "(", "key", ".", "toUpperCase", "(", ")", ",", "value", ")", ";", "}", "}", "String", "tmp", "=", "url", ".", "substring", "(", "driverPrefix", ".", "length", "(", ")", ")", ";", "String", "[", "]", "tokens", "=", "tmp", ".", "split", "(", "\";\"", ")", ";", "if", "(", "tokens", ".", "length", "!=", "2", ")", "{", "return", "null", ";", "// datasource missing", "}", "try", "{", "new", "URL", "(", "tokens", "[", "0", "]", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "return", "null", ";", "// url invalid", "}", "props", ".", "setProperty", "(", "SERVER_URL", ",", "tokens", "[", "0", "]", ")", ";", "props", ".", "setProperty", "(", "DATASOURCE_PATH", ",", "tokens", "[", "1", "]", ")", ";", "return", "props", ";", "}" ]
Parse the driver URL and extract the properties. @param url the URL to parse @param info any existing properties already loaded in a <code>Properties</code> object @return the URL properties as a <code>Properties</code> object
[ "Parse", "the", "driver", "URL", "and", "extract", "the", "properties", "." ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/api/client/jdbc/Driver.java#L133-L167
6,715
nextreports/nextreports-server
src/ro/nextreports/server/web/themes/ThemeFileFilter.java
ThemeFileFilter.accept
public boolean accept(File file) { String name = file.getName(); if (file.isDirectory()) { return true; } return (name.startsWith("theme") && name.endsWith(".properties")); }
java
public boolean accept(File file) { String name = file.getName(); if (file.isDirectory()) { return true; } return (name.startsWith("theme") && name.endsWith(".properties")); }
[ "public", "boolean", "accept", "(", "File", "file", ")", "{", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "return", "true", ";", "}", "return", "(", "name", ".", "startsWith", "(", "\"theme\"", ")", "&&", "name", ".", "endsWith", "(", "\".properties\"", ")", ")", ";", "}" ]
Returns true. @param file the file to check @return true
[ "Returns", "true", "." ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/themes/ThemeFileFilter.java#L40-L46
6,716
nextreports/nextreports-server
src/ro/nextreports/server/service/DefaultStorageService.java
DefaultStorageService.getSettings
@Transactional(readOnly = true) public Settings getSettings() { try { return (Settings) getEntity(StorageConstants.SETTINGS_ROOT); } catch (NotFoundException e) { // should never happen e.printStackTrace(); LOG.error("Could not read Settings node", e); return new Settings(); } }
java
@Transactional(readOnly = true) public Settings getSettings() { try { return (Settings) getEntity(StorageConstants.SETTINGS_ROOT); } catch (NotFoundException e) { // should never happen e.printStackTrace(); LOG.error("Could not read Settings node", e); return new Settings(); } }
[ "@", "Transactional", "(", "readOnly", "=", "true", ")", "public", "Settings", "getSettings", "(", ")", "{", "try", "{", "return", "(", "Settings", ")", "getEntity", "(", "StorageConstants", ".", "SETTINGS_ROOT", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "// should never happen", "e", ".", "printStackTrace", "(", ")", ";", "LOG", ".", "error", "(", "\"Could not read Settings node\"", ",", "e", ")", ";", "return", "new", "Settings", "(", ")", ";", "}", "}" ]
'An Authentication object was not found in the SecurityContext'
[ "An", "Authentication", "object", "was", "not", "found", "in", "the", "SecurityContext" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/service/DefaultStorageService.java#L439-L449
6,717
nextreports/nextreports-server
src/ro/nextreports/server/web/common/misc/ExtendedPalette.java
ExtendedPalette.newAddAllComponent
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()); } }; }
java
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()); } }; }
[ "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 @return addAll component
[ "factory", "method", "for", "the", "addAll", "component" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/common/misc/ExtendedPalette.java#L116-L125
6,718
nextreports/nextreports-server
src/ro/nextreports/server/web/common/misc/ExtendedPalette.java
ExtendedPalette.newRemoveAllComponent
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()); } }; }
java
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()); } }; }
[ "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 @return removeAll component
[ "factory", "method", "for", "the", "removeAll", "component" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/common/misc/ExtendedPalette.java#L132-L141
6,719
nextreports/nextreports-server
src/ro/nextreports/server/web/common/misc/ExtendedPalette.java
ExtendedPalette.newRemoveComponent
protected Component newRemoveComponent() { return new PaletteButton("removeButton") { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.getAttributes().put("onclick", getRemoveOnClickJS()); } }; }
java
protected Component newRemoveComponent() { return new PaletteButton("removeButton") { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.getAttributes().put("onclick", getRemoveOnClickJS()); } }; }
[ "protected", "Component", "newRemoveComponent", "(", ")", "{", "return", "new", "PaletteButton", "(", "\"removeButton\"", ")", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "@", "Override", "protected", "void", "onComponentTag", "(", "ComponentTag", "tag", ")", "{", "super", ".", "onComponentTag", "(", "tag", ")", ";", "tag", ".", "getAttributes", "(", ")", ".", "put", "(", "\"onclick\"", ",", "getRemoveOnClickJS", "(", ")", ")", ";", "}", "}", ";", "}" ]
factory method for the remove component @return remove component
[ "factory", "method", "for", "the", "remove", "component" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/common/misc/ExtendedPalette.java#L206-L216
6,720
nextreports/nextreports-server
src/ro/nextreports/server/web/common/misc/ExtendedPalette.java
ExtendedPalette.newAddComponent
protected Component newAddComponent() { return new PaletteButton("addButton") { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.getAttributes().put("onclick", getAddOnClickJS()); } }; }
java
protected Component newAddComponent() { return new PaletteButton("addButton") { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.getAttributes().put("onclick", getAddOnClickJS()); } }; }
[ "protected", "Component", "newAddComponent", "(", ")", "{", "return", "new", "PaletteButton", "(", "\"addButton\"", ")", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "@", "Override", "protected", "void", "onComponentTag", "(", "ComponentTag", "tag", ")", "{", "super", ".", "onComponentTag", "(", "tag", ")", ";", "tag", ".", "getAttributes", "(", ")", ".", "put", "(", "\"onclick\"", ",", "getAddOnClickJS", "(", ")", ")", ";", "}", "}", ";", "}" ]
factory method for the addcomponent @return add component
[ "factory", "method", "for", "the", "addcomponent" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/common/misc/ExtendedPalette.java#L223-L233
6,721
nextreports/nextreports-server
src/ro/nextreports/server/service/DefaultReportService.java
DefaultReportService.encodeFileName
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; }
java
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; }
[ "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
[ "All", "characters", "different", "from", "a", "standard", "set", "are", "deleted" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/service/DefaultReportService.java#L399-L407
6,722
nextreports/nextreports-server
src/ro/nextreports/server/web/schedule/ScheduleWizard.java
ScheduleWizard.newButtonBar
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 buttonBar; }
java
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 buttonBar; }
[ "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", "buttonBar", ";", "}" ]
Job step and Destination step are allowed to finish
[ "Job", "step", "and", "Destination", "step", "are", "allowed", "to", "finish" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/schedule/ScheduleWizard.java#L177-L186
6,723
nextreports/nextreports-server
src/ro/nextreports/server/web/NextServerSession.java
NextServerSession.checkForSignIn
protected boolean checkForSignIn() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if ((authentication != null) && authentication.isAuthenticated()) { LOG.debug("Security context contains CAS authentication"); return true; } return false; }
java
protected boolean checkForSignIn() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if ((authentication != null) && authentication.isAuthenticated()) { LOG.debug("Security context contains CAS authentication"); return true; } return false; }
[ "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
[ "used", "in", "NextServerApplication", ".", "addSecurityStrategy" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/NextServerSession.java#L305-L313
6,724
nextreports/nextreports-server
src/ro/nextreports/server/update/StorageUpdate12.java
StorageUpdate12.addRuntimeNameProperty
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); NodeIterator nodes = queryResult.getNodes(); LOG.info("RuntimeHistory : Found " + nodes.getSize() + " parameterValues nodes"); while (nodes.hasNext()) { Node node = nodes.nextNode(); NodeIterator childrenIt = node.getNodes(); while (childrenIt.hasNext()) { Node child = childrenIt.nextNode(); child.setProperty("runtimeName", child.getName()); } } getTemplate().save(); }
java
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); NodeIterator nodes = queryResult.getNodes(); LOG.info("RuntimeHistory : Found " + nodes.getSize() + " parameterValues nodes"); while (nodes.hasNext()) { Node node = nodes.nextNode(); NodeIterator childrenIt = node.getNodes(); while (childrenIt.hasNext()) { Node child = childrenIt.nextNode(); child.setProperty("runtimeName", child.getName()); } } getTemplate().save(); }
[ "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", ")", ";", "NodeIterator", "nodes", "=", "queryResult", ".", "getNodes", "(", ")", ";", "LOG", ".", "info", "(", "\"RuntimeHistory : Found \"", "+", "nodes", ".", "getSize", "(", ")", "+", "\" parameterValues nodes\"", ")", ";", "while", "(", "nodes", ".", "hasNext", "(", ")", ")", "{", "Node", "node", "=", "nodes", ".", "nextNode", "(", ")", ";", "NodeIterator", "childrenIt", "=", "node", ".", "getNodes", "(", ")", ";", "while", "(", "childrenIt", ".", "hasNext", "(", ")", ")", "{", "Node", "child", "=", "childrenIt", ".", "nextNode", "(", ")", ";", "child", ".", "setProperty", "(", "\"runtimeName\"", ",", "child", ".", "getName", "(", ")", ")", ";", "}", "}", "getTemplate", "(", ")", ".", "save", "(", ")", ";", "}" ]
add runtimeName property to ParameterValue
[ "add", "runtimeName", "property", "to", "ParameterValue" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/update/StorageUpdate12.java#L37-L58
6,725
nextreports/nextreports-server
src/ro/nextreports/server/update/StorageUpdate21.java
StorageUpdate21.convertOldIdNameClass
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 + "//*[@" + searchPropertyName + "='" + searchPropertyValue + "']"; QueryResult queryResult = getTemplate().query(statement); NodeIterator nodes = queryResult.getNodes(); LOG.info("Found " + nodes.getSize() + " parameter value nodes"); while (nodes.hasNext()) { Node node = nodes.nextNode(); Property property = null; try { property = node.getProperty("value"); } catch (PathNotFoundException ex) { continue; } try { Object value = deserialize(property.getBinary().getStream()); if (value instanceof Object[]) { Object[] values = (Object[]) value; Object[] convertedValues = new Object[values.length]; boolean converted = false; for (int i = 0; i < values.length; i++) { Object tmp = values[i]; if (tmp instanceof com.asf.nextreports.engine.queryexec.IdName) { com.asf.nextreports.engine.queryexec.IdName oldIdName = (com.asf.nextreports.engine.queryexec.IdName) tmp; IdName idName = new IdName(); idName.setId(oldIdName.getId()); idName.setName(oldIdName.getName()); convertedValues[i] = idName; converted = true; } else { convertedValues[i] = tmp; } } if (converted) { ValueFactory valueFactory = node.getSession().getValueFactory(); Binary binary = valueFactory.createBinary(new ByteArrayInputStream(serialize(convertedValues))); property.setValue(binary); } } else if (value instanceof com.asf.nextreports.engine.queryexec.IdName) { com.asf.nextreports.engine.queryexec.IdName oldIdName = (com.asf.nextreports.engine.queryexec.IdName) value; IdName idName = new IdName(); idName.setId(oldIdName.getId()); idName.setName(oldIdName.getName()); ValueFactory valueFactory = node.getSession().getValueFactory(); Binary binary = valueFactory.createBinary(new ByteArrayInputStream(serialize(idName))); property.setValue(binary); } } catch (Exception e) { e.printStackTrace(); } } getTemplate().save(); }
java
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 + "//*[@" + searchPropertyName + "='" + searchPropertyValue + "']"; QueryResult queryResult = getTemplate().query(statement); NodeIterator nodes = queryResult.getNodes(); LOG.info("Found " + nodes.getSize() + " parameter value nodes"); while (nodes.hasNext()) { Node node = nodes.nextNode(); Property property = null; try { property = node.getProperty("value"); } catch (PathNotFoundException ex) { continue; } try { Object value = deserialize(property.getBinary().getStream()); if (value instanceof Object[]) { Object[] values = (Object[]) value; Object[] convertedValues = new Object[values.length]; boolean converted = false; for (int i = 0; i < values.length; i++) { Object tmp = values[i]; if (tmp instanceof com.asf.nextreports.engine.queryexec.IdName) { com.asf.nextreports.engine.queryexec.IdName oldIdName = (com.asf.nextreports.engine.queryexec.IdName) tmp; IdName idName = new IdName(); idName.setId(oldIdName.getId()); idName.setName(oldIdName.getName()); convertedValues[i] = idName; converted = true; } else { convertedValues[i] = tmp; } } if (converted) { ValueFactory valueFactory = node.getSession().getValueFactory(); Binary binary = valueFactory.createBinary(new ByteArrayInputStream(serialize(convertedValues))); property.setValue(binary); } } else if (value instanceof com.asf.nextreports.engine.queryexec.IdName) { com.asf.nextreports.engine.queryexec.IdName oldIdName = (com.asf.nextreports.engine.queryexec.IdName) value; IdName idName = new IdName(); idName.setId(oldIdName.getId()); idName.setName(oldIdName.getName()); ValueFactory valueFactory = node.getSession().getValueFactory(); Binary binary = valueFactory.createBinary(new ByteArrayInputStream(serialize(idName))); property.setValue(binary); } } catch (Exception e) { e.printStackTrace(); } } getTemplate().save(); }
[ "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", "+", "\"//*[@\"", "+", "searchPropertyName", "+", "\"='\"", "+", "searchPropertyValue", "+", "\"']\"", ";", "QueryResult", "queryResult", "=", "getTemplate", "(", ")", ".", "query", "(", "statement", ")", ";", "NodeIterator", "nodes", "=", "queryResult", ".", "getNodes", "(", ")", ";", "LOG", ".", "info", "(", "\"Found \"", "+", "nodes", ".", "getSize", "(", ")", "+", "\" parameter value nodes\"", ")", ";", "while", "(", "nodes", ".", "hasNext", "(", ")", ")", "{", "Node", "node", "=", "nodes", ".", "nextNode", "(", ")", ";", "Property", "property", "=", "null", ";", "try", "{", "property", "=", "node", ".", "getProperty", "(", "\"value\"", ")", ";", "}", "catch", "(", "PathNotFoundException", "ex", ")", "{", "continue", ";", "}", "try", "{", "Object", "value", "=", "deserialize", "(", "property", ".", "getBinary", "(", ")", ".", "getStream", "(", ")", ")", ";", "if", "(", "value", "instanceof", "Object", "[", "]", ")", "{", "Object", "[", "]", "values", "=", "(", "Object", "[", "]", ")", "value", ";", "Object", "[", "]", "convertedValues", "=", "new", "Object", "[", "values", ".", "length", "]", ";", "boolean", "converted", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "Object", "tmp", "=", "values", "[", "i", "]", ";", "if", "(", "tmp", "instanceof", "com", ".", "asf", ".", "nextreports", ".", "engine", ".", "queryexec", ".", "IdName", ")", "{", "com", ".", "asf", ".", "nextreports", ".", "engine", ".", "queryexec", ".", "IdName", "oldIdName", "=", "(", "com", ".", "asf", ".", "nextreports", ".", "engine", ".", "queryexec", ".", "IdName", ")", "tmp", ";", "IdName", "idName", "=", "new", "IdName", "(", ")", ";", "idName", ".", "setId", "(", "oldIdName", ".", "getId", "(", ")", ")", ";", "idName", ".", "setName", "(", "oldIdName", ".", "getName", "(", ")", ")", ";", "convertedValues", "[", "i", "]", "=", "idName", ";", "converted", "=", "true", ";", "}", "else", "{", "convertedValues", "[", "i", "]", "=", "tmp", ";", "}", "}", "if", "(", "converted", ")", "{", "ValueFactory", "valueFactory", "=", "node", ".", "getSession", "(", ")", ".", "getValueFactory", "(", ")", ";", "Binary", "binary", "=", "valueFactory", ".", "createBinary", "(", "new", "ByteArrayInputStream", "(", "serialize", "(", "convertedValues", ")", ")", ")", ";", "property", ".", "setValue", "(", "binary", ")", ";", "}", "}", "else", "if", "(", "value", "instanceof", "com", ".", "asf", ".", "nextreports", ".", "engine", ".", "queryexec", ".", "IdName", ")", "{", "com", ".", "asf", ".", "nextreports", ".", "engine", ".", "queryexec", ".", "IdName", "oldIdName", "=", "(", "com", ".", "asf", ".", "nextreports", ".", "engine", ".", "queryexec", ".", "IdName", ")", "value", ";", "IdName", "idName", "=", "new", "IdName", "(", ")", ";", "idName", ".", "setId", "(", "oldIdName", ".", "getId", "(", ")", ")", ";", "idName", ".", "setName", "(", "oldIdName", ".", "getName", "(", ")", ")", ";", "ValueFactory", "valueFactory", "=", "node", ".", "getSession", "(", ")", ".", "getValueFactory", "(", ")", ";", "Binary", "binary", "=", "valueFactory", ".", "createBinary", "(", "new", "ByteArrayInputStream", "(", "serialize", "(", "idName", ")", ")", ")", ";", "property", ".", "setValue", "(", "binary", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "getTemplate", "(", ")", ".", "save", "(", ")", ";", "}" ]
IdName values can be found in ParameterValue entities which are used in Dashboards widget parameters or Scheduler report runtime parameters
[ "IdName", "values", "can", "be", "found", "in", "ParameterValue", "entities", "which", "are", "used", "in", "Dashboards", "widget", "parameters", "or", "Scheduler", "report", "runtime", "parameters" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/update/StorageUpdate21.java#L53-L111
6,726
nextreports/nextreports-server
src/ro/nextreports/server/settings/SettingsBean.java
SettingsBean.getMailServerIp
public String getMailServerIp() { Settings settings = getSettings(); if (settings.getMailServer() == null) { return "127.0.0.1"; } return settings.getMailServer().getIp(); }
java
public String getMailServerIp() { Settings settings = getSettings(); if (settings.getMailServer() == null) { return "127.0.0.1"; } return settings.getMailServer().getIp(); }
[ "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
[ "helper", "methods", "used", "in", "Spring", "xml", "files", "with", "SpEL" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/settings/SettingsBean.java#L50-L57
6,727
nextreports/nextreports-server
src/ro/nextreports/server/dao/JcrStorageDao.java
JcrStorageDao.clearParentsCache
private void clearParentsCache(Entity entity) { try { String xpath = null; if (entity instanceof DataSource) { // find all reports and charts with this DataSource xpath = "//nextServer//*[@dataSource='" + entity.getId() + "']"; } else if (entity instanceof Report) { // find all schedulers with this report xpath = "//nextServer/scheduler/*[@report='" + entity.getId() + "']"; } if (xpath != null) { NodeIterator nodes = getTemplate().query(xpath).getNodes(); while (nodes.hasNext()) { entitiesCache.remove(nodes.nextNode().getIdentifier()); } } // if entity is inside a drill down we have to clear the master // report (with drillDown list) // first parent is 'drillDownEntities' node; second parent is the // actual report/chart if ((entity instanceof Report) || (entity instanceof Chart)) { xpath = " //nextServer//drillDownEntities/*[@entity='" + entity.getId() + "']"; if (xpath != null) { NodeIterator nodes = getTemplate().query(xpath).getNodes(); while (nodes.hasNext()) { entitiesCache.remove(nodes.nextNode().getParent().getParent().getIdentifier()); } } } } catch (RepositoryException e) { throw convertJcrAccessException(e); } }
java
private void clearParentsCache(Entity entity) { try { String xpath = null; if (entity instanceof DataSource) { // find all reports and charts with this DataSource xpath = "//nextServer//*[@dataSource='" + entity.getId() + "']"; } else if (entity instanceof Report) { // find all schedulers with this report xpath = "//nextServer/scheduler/*[@report='" + entity.getId() + "']"; } if (xpath != null) { NodeIterator nodes = getTemplate().query(xpath).getNodes(); while (nodes.hasNext()) { entitiesCache.remove(nodes.nextNode().getIdentifier()); } } // if entity is inside a drill down we have to clear the master // report (with drillDown list) // first parent is 'drillDownEntities' node; second parent is the // actual report/chart if ((entity instanceof Report) || (entity instanceof Chart)) { xpath = " //nextServer//drillDownEntities/*[@entity='" + entity.getId() + "']"; if (xpath != null) { NodeIterator nodes = getTemplate().query(xpath).getNodes(); while (nodes.hasNext()) { entitiesCache.remove(nodes.nextNode().getParent().getParent().getIdentifier()); } } } } catch (RepositoryException e) { throw convertJcrAccessException(e); } }
[ "private", "void", "clearParentsCache", "(", "Entity", "entity", ")", "{", "try", "{", "String", "xpath", "=", "null", ";", "if", "(", "entity", "instanceof", "DataSource", ")", "{", "// find all reports and charts with this DataSource", "xpath", "=", "\"//nextServer//*[@dataSource='\"", "+", "entity", ".", "getId", "(", ")", "+", "\"']\"", ";", "}", "else", "if", "(", "entity", "instanceof", "Report", ")", "{", "// find all schedulers with this report", "xpath", "=", "\"//nextServer/scheduler/*[@report='\"", "+", "entity", ".", "getId", "(", ")", "+", "\"']\"", ";", "}", "if", "(", "xpath", "!=", "null", ")", "{", "NodeIterator", "nodes", "=", "getTemplate", "(", ")", ".", "query", "(", "xpath", ")", ".", "getNodes", "(", ")", ";", "while", "(", "nodes", ".", "hasNext", "(", ")", ")", "{", "entitiesCache", ".", "remove", "(", "nodes", ".", "nextNode", "(", ")", ".", "getIdentifier", "(", ")", ")", ";", "}", "}", "// if entity is inside a drill down we have to clear the master", "// report (with drillDown list)", "// first parent is 'drillDownEntities' node; second parent is the", "// actual report/chart", "if", "(", "(", "entity", "instanceof", "Report", ")", "||", "(", "entity", "instanceof", "Chart", ")", ")", "{", "xpath", "=", "\" //nextServer//drillDownEntities/*[@entity='\"", "+", "entity", ".", "getId", "(", ")", "+", "\"']\"", ";", "if", "(", "xpath", "!=", "null", ")", "{", "NodeIterator", "nodes", "=", "getTemplate", "(", ")", ".", "query", "(", "xpath", ")", ".", "getNodes", "(", ")", ";", "while", "(", "nodes", ".", "hasNext", "(", ")", ")", "{", "entitiesCache", ".", "remove", "(", "nodes", ".", "nextNode", "(", ")", ".", "getParent", "(", ")", ".", "getParent", "(", ")", ".", "getIdentifier", "(", ")", ")", ";", "}", "}", "}", "}", "catch", "(", "RepositoryException", "e", ")", "{", "throw", "convertJcrAccessException", "(", "e", ")", ";", "}", "}" ]
clear all parents from cache
[ "clear", "all", "parents", "from", "cache" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/dao/JcrStorageDao.java#L681-L713
6,728
nextreports/nextreports-server
src/ro/nextreports/server/dao/JcrStorageDao.java
JcrStorageDao.getDerbyConnection
private Connection getDerbyConnection(String wkpDir) { // See your driver documentation for the proper format of this string : wkpDir = wkpDir.replaceAll("\\\\", "/"); System.err.println(wkpDir); String DB_CONN_STRING = "jdbc:derby:" + wkpDir // "d:/workspace/workspace-next-work/nextreports-server/data/workspaces/default" + "/db;create=false"; // Provided by your driver documentation. In this case, a MySql driver // is used : String DRIVER_CLASS_NAME = "org.apache.derby.jdbc.EmbeddedDriver"; String USER_NAME = null; String PASSWORD = null; Connection result = null; try { Class.forName(DRIVER_CLASS_NAME).newInstance(); } catch (Exception ex) { LOG.debug("Check classpath. Cannot load db driver: " + DRIVER_CLASS_NAME); } try { result = DriverManager.getConnection(DB_CONN_STRING, USER_NAME, PASSWORD); } catch (SQLException e) { LOG.debug("Driver loaded, but cannot connect to db: " + DB_CONN_STRING); } return result; }
java
private Connection getDerbyConnection(String wkpDir) { // See your driver documentation for the proper format of this string : wkpDir = wkpDir.replaceAll("\\\\", "/"); System.err.println(wkpDir); String DB_CONN_STRING = "jdbc:derby:" + wkpDir // "d:/workspace/workspace-next-work/nextreports-server/data/workspaces/default" + "/db;create=false"; // Provided by your driver documentation. In this case, a MySql driver // is used : String DRIVER_CLASS_NAME = "org.apache.derby.jdbc.EmbeddedDriver"; String USER_NAME = null; String PASSWORD = null; Connection result = null; try { Class.forName(DRIVER_CLASS_NAME).newInstance(); } catch (Exception ex) { LOG.debug("Check classpath. Cannot load db driver: " + DRIVER_CLASS_NAME); } try { result = DriverManager.getConnection(DB_CONN_STRING, USER_NAME, PASSWORD); } catch (SQLException e) { LOG.debug("Driver loaded, but cannot connect to db: " + DB_CONN_STRING); } return result; }
[ "private", "Connection", "getDerbyConnection", "(", "String", "wkpDir", ")", "{", "// See your driver documentation for the proper format of this string :", "wkpDir", "=", "wkpDir", ".", "replaceAll", "(", "\"\\\\\\\\\"", ",", "\"/\"", ")", ";", "System", ".", "err", ".", "println", "(", "wkpDir", ")", ";", "String", "DB_CONN_STRING", "=", "\"jdbc:derby:\"", "+", "wkpDir", "// \"d:/workspace/workspace-next-work/nextreports-server/data/workspaces/default\"", "+", "\"/db;create=false\"", ";", "// Provided by your driver documentation. In this case, a MySql driver", "// is used :", "String", "DRIVER_CLASS_NAME", "=", "\"org.apache.derby.jdbc.EmbeddedDriver\"", ";", "String", "USER_NAME", "=", "null", ";", "String", "PASSWORD", "=", "null", ";", "Connection", "result", "=", "null", ";", "try", "{", "Class", ".", "forName", "(", "DRIVER_CLASS_NAME", ")", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "LOG", ".", "debug", "(", "\"Check classpath. Cannot load db driver: \"", "+", "DRIVER_CLASS_NAME", ")", ";", "}", "try", "{", "result", "=", "DriverManager", ".", "getConnection", "(", "DB_CONN_STRING", ",", "USER_NAME", ",", "PASSWORD", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "LOG", ".", "debug", "(", "\"Driver loaded, but cannot connect to db: \"", "+", "DB_CONN_STRING", ")", ";", "}", "return", "result", ";", "}" ]
Uses DriverManager.
[ "Uses", "DriverManager", "." ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/dao/JcrStorageDao.java#L1280-L1306
6,729
nextreports/nextreports-server
src/ro/nextreports/server/web/common/table/DateColumn.java
DateColumn.getAlignedFormat
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.applyPattern(pattern); return sdf; } else { return DATE_FORMAT; } }
java
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.applyPattern(pattern); return sdf; } else { return DATE_FORMAT; } }
[ "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", ".", "applyPattern", "(", "pattern", ")", ";", "return", "sdf", ";", "}", "else", "{", "return", "DATE_FORMAT", ";", "}", "}" ]
we need to take the pattern and modify it
[ "we", "need", "to", "take", "the", "pattern", "and", "modify", "it" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/common/table/DateColumn.java#L61-L74
6,730
nextreports/nextreports-server
src/ro/nextreports/server/web/report/ManualListPanel.java
ManualListPanel.getValues
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)) { value = Integer.parseInt(v); } else if (QueryParameter.BYTE_VALUE.equals(type)) { value = Byte.parseByte(v); } else if (QueryParameter.SHORT_VALUE.equals(type)) { value = Short.parseShort(v); } else if (QueryParameter.LONG_VALUE.equals(type)) { value = Long.parseLong(v); } else if (QueryParameter.FLOAT_VALUE.equals(type)) { value = Float.parseFloat(v); } else if (QueryParameter.DOUBLE_VALUE.equals(type)) { value = Double.parseDouble(v); } else if (QueryParameter.BIGDECIMAL_VALUE.equals(type)) { value = new BigDecimal(v); } else { // String value = v; } list.add(value); } return list; }
java
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)) { value = Integer.parseInt(v); } else if (QueryParameter.BYTE_VALUE.equals(type)) { value = Byte.parseByte(v); } else if (QueryParameter.SHORT_VALUE.equals(type)) { value = Short.parseShort(v); } else if (QueryParameter.LONG_VALUE.equals(type)) { value = Long.parseLong(v); } else if (QueryParameter.FLOAT_VALUE.equals(type)) { value = Float.parseFloat(v); } else if (QueryParameter.DOUBLE_VALUE.equals(type)) { value = Double.parseDouble(v); } else if (QueryParameter.BIGDECIMAL_VALUE.equals(type)) { value = new BigDecimal(v); } else { // String value = v; } list.add(value); } return list; }
[ "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", ")", ")", "{", "value", "=", "Integer", ".", "parseInt", "(", "v", ")", ";", "}", "else", "if", "(", "QueryParameter", ".", "BYTE_VALUE", ".", "equals", "(", "type", ")", ")", "{", "value", "=", "Byte", ".", "parseByte", "(", "v", ")", ";", "}", "else", "if", "(", "QueryParameter", ".", "SHORT_VALUE", ".", "equals", "(", "type", ")", ")", "{", "value", "=", "Short", ".", "parseShort", "(", "v", ")", ";", "}", "else", "if", "(", "QueryParameter", ".", "LONG_VALUE", ".", "equals", "(", "type", ")", ")", "{", "value", "=", "Long", ".", "parseLong", "(", "v", ")", ";", "}", "else", "if", "(", "QueryParameter", ".", "FLOAT_VALUE", ".", "equals", "(", "type", ")", ")", "{", "value", "=", "Float", ".", "parseFloat", "(", "v", ")", ";", "}", "else", "if", "(", "QueryParameter", ".", "DOUBLE_VALUE", ".", "equals", "(", "type", ")", ")", "{", "value", "=", "Double", ".", "parseDouble", "(", "v", ")", ";", "}", "else", "if", "(", "QueryParameter", ".", "BIGDECIMAL_VALUE", ".", "equals", "(", "type", ")", ")", "{", "value", "=", "new", "BigDecimal", "(", "v", ")", ";", "}", "else", "{", "// String", "value", "=", "v", ";", "}", "list", ".", "add", "(", "value", ")", ";", "}", "return", "list", ";", "}" ]
number and string values can be separated by semicolon delimiter
[ "number", "and", "string", "values", "can", "be", "separated", "by", "semicolon", "delimiter" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/report/ManualListPanel.java#L221-L247
6,731
nextreports/nextreports-server
src/ro/nextreports/server/web/report/ParameterRuntimePanel.java
ParameterRuntimePanel.getSelectedValues
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 (s instanceof IdName) { if ((in.getId() != null) && in.getId().equals( ((IdName)s).getId())) { selectedValues.add(in); break; } } else if ((in.getId() != null) && in.getId().equals(s)) { selectedValues.add(in); break; } } } return selectedValues; }
java
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 (s instanceof IdName) { if ((in.getId() != null) && in.getId().equals( ((IdName)s).getId())) { selectedValues.add(in); break; } } else if ((in.getId() != null) && in.getId().equals(s)) { selectedValues.add(in); break; } } } return selectedValues; }
[ "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", "(", "s", "instanceof", "IdName", ")", "{", "if", "(", "(", "in", ".", "getId", "(", ")", "!=", "null", ")", "&&", "in", ".", "getId", "(", ")", ".", "equals", "(", "(", "(", "IdName", ")", "s", ")", ".", "getId", "(", ")", ")", ")", "{", "selectedValues", ".", "add", "(", "in", ")", ";", "break", ";", "}", "}", "else", "if", "(", "(", "in", ".", "getId", "(", ")", "!=", "null", ")", "&&", "in", ".", "getId", "(", ")", ".", "equals", "(", "s", ")", ")", "{", "selectedValues", ".", "add", "(", "in", ")", ";", "break", ";", "}", "}", "}", "return", "selectedValues", ";", "}" ]
a default value must be simple java object , or an IdName but only with the id
[ "a", "default", "value", "must", "be", "simple", "java", "object", "or", "an", "IdName", "but", "only", "with", "the", "id" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/report/ParameterRuntimePanel.java#L543-L563
6,732
nextreports/nextreports-server
src/ro/nextreports/server/web/report/ParameterRuntimePanel.java
ParameterRuntimePanel.createAjax
private AjaxFormComponentUpdatingBehavior createAjax(final QueryParameter parameter, final IModel model, final Component component, final String time) { return new AjaxFormComponentUpdatingBehavior("onchange") { @SuppressWarnings("unchecked") @Override protected void onUpdate(AjaxRequestTarget target) { // @todo wicket 1.5 does not update model for DateField and DateTimeField // https://issues.apache.org/jira/browse/WICKET-4496 // use this as an workaround if ((model == null) || (model.getObject() == null)) { return; } Date date = (Date)model.getObject(); if ("hours".equals(time)) { date = DateUtil.setHours(date, (Integer)component.getDefaultModelObject()); } else if ("minutes".equals(time)) { date = DateUtil.setMinutes(date, (Integer)component.getDefaultModelObject()); } model.setObject(date); populateDependentParameters(parameter, target, false); } }; }
java
private AjaxFormComponentUpdatingBehavior createAjax(final QueryParameter parameter, final IModel model, final Component component, final String time) { return new AjaxFormComponentUpdatingBehavior("onchange") { @SuppressWarnings("unchecked") @Override protected void onUpdate(AjaxRequestTarget target) { // @todo wicket 1.5 does not update model for DateField and DateTimeField // https://issues.apache.org/jira/browse/WICKET-4496 // use this as an workaround if ((model == null) || (model.getObject() == null)) { return; } Date date = (Date)model.getObject(); if ("hours".equals(time)) { date = DateUtil.setHours(date, (Integer)component.getDefaultModelObject()); } else if ("minutes".equals(time)) { date = DateUtil.setMinutes(date, (Integer)component.getDefaultModelObject()); } model.setObject(date); populateDependentParameters(parameter, target, false); } }; }
[ "private", "AjaxFormComponentUpdatingBehavior", "createAjax", "(", "final", "QueryParameter", "parameter", ",", "final", "IModel", "model", ",", "final", "Component", "component", ",", "final", "String", "time", ")", "{", "return", "new", "AjaxFormComponentUpdatingBehavior", "(", "\"onchange\"", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "protected", "void", "onUpdate", "(", "AjaxRequestTarget", "target", ")", "{", "// @todo wicket 1.5 does not update model for DateField and DateTimeField", "// https://issues.apache.org/jira/browse/WICKET-4496\t", "// use this as an workaround\t", "if", "(", "(", "model", "==", "null", ")", "||", "(", "model", ".", "getObject", "(", ")", "==", "null", ")", ")", "{", "return", ";", "}", "Date", "date", "=", "(", "Date", ")", "model", ".", "getObject", "(", ")", ";", "if", "(", "\"hours\"", ".", "equals", "(", "time", ")", ")", "{", "date", "=", "DateUtil", ".", "setHours", "(", "date", ",", "(", "Integer", ")", "component", ".", "getDefaultModelObject", "(", ")", ")", ";", "}", "else", "if", "(", "\"minutes\"", ".", "equals", "(", "time", ")", ")", "{", "date", "=", "DateUtil", ".", "setMinutes", "(", "date", ",", "(", "Integer", ")", "component", ".", "getDefaultModelObject", "(", ")", ")", ";", "}", "model", ".", "setObject", "(", "date", ")", ";", "populateDependentParameters", "(", "parameter", ",", "target", ",", "false", ")", ";", "}", "}", ";", "}" ]
used to update hours and minutes
[ "used", "to", "update", "hours", "and", "minutes" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/report/ParameterRuntimePanel.java#L604-L628
6,733
nextreports/nextreports-server
src/ro/nextreports/server/util/StringUtil.java
StringUtil.replaceString
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) + replace + s.substring(index + l); } } while (index >= 0); return new ReplacedString(s, replaced); }
java
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) + replace + s.substring(index + l); } } while (index >= 0); return new ReplacedString(s, replaced); }
[ "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", ")", "+", "replace", "+", "s", ".", "substring", "(", "index", "+", "l", ")", ";", "}", "}", "while", "(", "index", ">=", "0", ")", ";", "return", "new", "ReplacedString", "(", "s", ",", "replaced", ")", ";", "}" ]
Replace a string with another @param s string to replace into @param find string to be replaced @param replace new string @return the string with replacements
[ "Replace", "a", "string", "with", "another" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/util/StringUtil.java#L40-L53
6,734
nextreports/nextreports-server
src/ro/nextreports/server/util/StringUtil.java
StringUtil.writeToClipboard
public static void writeToClipboard(String text) { Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable transferableText = new StringSelection(text); systemClipboard.setContents(transferableText, null); }
java
public static void writeToClipboard(String text) { Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable transferableText = new StringSelection(text); systemClipboard.setContents(transferableText, null); }
[ "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 @param text text to write
[ "Write", "a", "text", "to", "system", "clipboard" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/util/StringUtil.java#L60-L64
6,735
nextreports/nextreports-server
src/ro/nextreports/server/web/core/menu/EntityTreeExpansionState.java
EntityTreeExpansionState.get
public static EntityTreeExpansionState get() { EntityTreeExpansionState expansion = Session.get().getMetaData(KEY); if (expansion == null) { expansion = new EntityTreeExpansionState(); Session.get().setMetaData(KEY, expansion); } return expansion; }
java
public static EntityTreeExpansionState get() { EntityTreeExpansionState expansion = Session.get().getMetaData(KEY); if (expansion == null) { expansion = new EntityTreeExpansionState(); Session.get().setMetaData(KEY, expansion); } return expansion; }
[ "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. @return expansion
[ "Get", "the", "expansion", "for", "the", "session", "." ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/core/menu/EntityTreeExpansionState.java#L121-L128
6,736
nextreports/nextreports-server
src/ro/nextreports/server/web/dashboard/indicator/IndicatorHTML5Panel.java
IndicatorHTML5Panel.getResizeJavaScript
private String getResizeJavaScript() { StringBuilder sb = new StringBuilder(); sb.append("$(window).bind(\'resizeEnd\',function(){"); sb.append(getIndicatorCall()); sb.append("});"); return sb.toString(); }
java
private String getResizeJavaScript() { StringBuilder sb = new StringBuilder(); sb.append("$(window).bind(\'resizeEnd\',function(){"); sb.append(getIndicatorCall()); sb.append("});"); return sb.toString(); }
[ "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!
[ "indicator", "call", "will", "be", "made", "only", "when", "resize", "event", "finished!" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/dashboard/indicator/IndicatorHTML5Panel.java#L112-L118
6,737
nextreports/nextreports-server
src/ro/nextreports/server/service/DefaultChartService.java
DefaultChartService.getJsonData
public String getJsonData(Chart chart) throws ReportRunnerException, NoDataFoundException, TimeoutException { return getJsonData(chart, null, null); }
java
public String getJsonData(Chart chart) throws ReportRunnerException, NoDataFoundException, TimeoutException { return getJsonData(chart, null, null); }
[ "public", "String", "getJsonData", "(", "Chart", "chart", ")", "throws", "ReportRunnerException", ",", "NoDataFoundException", ",", "TimeoutException", "{", "return", "getJsonData", "(", "chart", ",", "null", ",", "null", ")", ";", "}" ]
Methods with chart do not now anything about settings!!
[ "Methods", "with", "chart", "do", "not", "now", "anything", "about", "settings!!" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/service/DefaultChartService.java#L90-L93
6,738
nextreports/nextreports-server
src/ro/nextreports/server/service/DefaultDashboardService.java
DefaultDashboardService.isSingleWidget
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; } return true; } catch (NotFoundException e) { return false; } }
java
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; } return true; } catch (NotFoundException e) { return false; } }
[ "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", ";", "}", "return", "true", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "return", "false", ";", "}", "}" ]
just a single widget in a dashboard with a single column
[ "just", "a", "single", "widget", "in", "a", "dashboard", "with", "a", "single", "column" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/service/DefaultDashboardService.java#L1058-L1072
6,739
nextreports/nextreports-server
src/ro/nextreports/server/service/DefaultDashboardService.java
DefaultDashboardService.resetDrillDownableCache
private void resetDrillDownableCache(String entityId) { try { // has no chart id in settings if (entityId == null) { return; } Entity entity = storageService.getEntityById(entityId); if (entity instanceof Chart) { if (((Chart)entity).isDrillDownable()) { resetCache(entityId); } } } catch (NotFoundException ex) { LOG.error("Reset cache - not found", ex); } }
java
private void resetDrillDownableCache(String entityId) { try { // has no chart id in settings if (entityId == null) { return; } Entity entity = storageService.getEntityById(entityId); if (entity instanceof Chart) { if (((Chart)entity).isDrillDownable()) { resetCache(entityId); } } } catch (NotFoundException ex) { LOG.error("Reset cache - not found", ex); } }
[ "private", "void", "resetDrillDownableCache", "(", "String", "entityId", ")", "{", "try", "{", "// has no chart id in settings", "if", "(", "entityId", "==", "null", ")", "{", "return", ";", "}", "Entity", "entity", "=", "storageService", ".", "getEntityById", "(", "entityId", ")", ";", "if", "(", "entity", "instanceof", "Chart", ")", "{", "if", "(", "(", "(", "Chart", ")", "entity", ")", ".", "isDrillDownable", "(", ")", ")", "{", "resetCache", "(", "entityId", ")", ";", "}", "}", "}", "catch", "(", "NotFoundException", "ex", ")", "{", "LOG", ".", "error", "(", "\"Reset cache - not found\"", ",", "ex", ")", ";", "}", "}" ]
for drill down reports there is no need to reset cache when we move the widget
[ "for", "drill", "down", "reports", "there", "is", "no", "need", "to", "reset", "cache", "when", "we", "move", "the", "widget" ]
cfce12f5c6d52cb6a739388d50142c6e2e07c55e
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/service/DefaultDashboardService.java#L1270-L1285
6,740
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/AbstractInvoker.java
AbstractInvoker.getTargetMethod
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"); } }
java
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"); } }
[ "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.
[ "Utility", "method", "for", "getting", "the", "method", "which", "is", "going", "to", "be", "invoked", "on", "the", "service", "by", "underlying", "invoker", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/AbstractInvoker.java#L22-L33
6,741
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/ParseError.java
ParseError.reset
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; }
java
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; }
[ "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.
[ "Resets", "all", "of", "the", "fields", "to", "non", "-", "error", "status", ".", "This", "is", "used", "internally", "so", "we", "can", "reuse", "an", "instance", "of", "this", "class", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/ParseError.java#L122-L131
6,742
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/ColumnInfo.java
ColumnInfo.getValue
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; } }
java
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; } }
[ "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.
[ "Get", "the", "value", "associated", "with", "this", "field", "from", "the", "object", "parameter", "either", "by", "getting", "from", "the", "field", "or", "calling", "the", "get", "method", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/ColumnInfo.java#L69-L79
6,743
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/ColumnInfo.java
ColumnInfo.setValue
public void setValue(Object obj, T value) throws IllegalAccessException, InvocationTargetException { if (field == null) { setMethod.invoke(obj, value); } else { field.set(obj, value); } }
java
public void setValue(Object obj, T value) throws IllegalAccessException, InvocationTargetException { if (field == null) { setMethod.invoke(obj, value); } else { field.set(obj, value); } }
[ "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.
[ "Set", "the", "value", "associated", "with", "this", "field", "from", "the", "object", "parameter", "either", "by", "setting", "via", "the", "field", "or", "calling", "the", "set", "method", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/ColumnInfo.java#L85-L91
6,744
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/UnitOfWorkInvokerFactory.java
UnitOfWorkInvokerFactory.create
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)) { unitOfWorkMethodsBuilder.put(m.getName(), m.getAnnotation(UnitOfWork.class)); } } ImmutableMap<String, UnitOfWork> unitOfWorkMethods = unitOfWorkMethodsBuilder.build(); Invoker invoker = rootInvoker; if (unitOfWorkMethods.size() > 0) { invoker = new UnitOfWorkInvoker(invoker, unitOfWorkMethods, sessionFactory); } return invoker; }
java
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)) { unitOfWorkMethodsBuilder.put(m.getName(), m.getAnnotation(UnitOfWork.class)); } } ImmutableMap<String, UnitOfWork> unitOfWorkMethods = unitOfWorkMethodsBuilder.build(); Invoker invoker = rootInvoker; if (unitOfWorkMethods.size() > 0) { invoker = new UnitOfWorkInvoker(invoker, unitOfWorkMethods, sessionFactory); } return invoker; }
[ "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", ")", ")", "{", "unitOfWorkMethodsBuilder", ".", "put", "(", "m", ".", "getName", "(", ")", ",", "m", ".", "getAnnotation", "(", "UnitOfWork", ".", "class", ")", ")", ";", "}", "}", "ImmutableMap", "<", "String", ",", "UnitOfWork", ">", "unitOfWorkMethods", "=", "unitOfWorkMethodsBuilder", ".", "build", "(", ")", ";", "Invoker", "invoker", "=", "rootInvoker", ";", "if", "(", "unitOfWorkMethods", ".", "size", "(", ")", ">", "0", ")", "{", "invoker", "=", "new", "UnitOfWorkInvoker", "(", "invoker", ",", "unitOfWorkMethods", ",", "sessionFactory", ")", ";", "}", "return", "invoker", ";", "}" ]
Factory method for creating UnitOfWorkInvoker.
[ "Factory", "method", "for", "creating", "UnitOfWorkInvoker", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/UnitOfWorkInvokerFactory.java#L15-L34
6,745
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/AbstractBuilder.java
AbstractBuilder.cxfOutFaultInterceptors
@SuppressWarnings("unchecked") public AbstractBuilder cxfOutFaultInterceptors(Interceptor<? extends Message> ... interceptors) { this.cxfOutFaultInterceptors = ImmutableList.<Interceptor<? extends Message>>builder() .add(interceptors).build(); return this; }
java
@SuppressWarnings("unchecked") public AbstractBuilder cxfOutFaultInterceptors(Interceptor<? extends Message> ... interceptors) { this.cxfOutFaultInterceptors = ImmutableList.<Interceptor<? extends Message>>builder() .add(interceptors).build(); return this; }
[ "@", "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. @param interceptors CXF interceptors. @return EndpointBuilder instance.
[ "Add", "CXF", "interceptors", "to", "the", "outgoing", "fault", "interceptor", "chain", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/AbstractBuilder.java#L82-L88
6,746
j256/simplecsv
src/main/java/com/j256/simplecsv/converter/ConverterUtils.java
ConverterUtils.addInternalConverters
public static void addInternalConverters(Map<Class<?>, Converter<?, ?>> converterMap) { converterMap.put(BigDecimal.class, BigDecimalConverter.getSingleton()); converterMap.put(BigInteger.class, BigIntegerConverter.getSingleton()); converterMap.put(Boolean.class, BooleanConverter.getSingleton()); converterMap.put(boolean.class, BooleanConverter.getSingleton()); converterMap.put(Byte.class, ByteConverter.getSingleton()); converterMap.put(byte.class, ByteConverter.getSingleton()); converterMap.put(Character.class, CharacterConverter.getSingleton()); converterMap.put(char.class, CharacterConverter.getSingleton()); converterMap.put(Date.class, DateConverter.getSingleton()); converterMap.put(Double.class, DoubleConverter.getSingleton()); converterMap.put(double.class, DoubleConverter.getSingleton()); converterMap.put(Enum.class, EnumConverter.getSingleton()); converterMap.put(Float.class, FloatConverter.getSingleton()); converterMap.put(float.class, FloatConverter.getSingleton()); converterMap.put(Integer.class, IntegerConverter.getSingleton()); converterMap.put(int.class, IntegerConverter.getSingleton()); converterMap.put(Long.class, LongConverter.getSingleton()); converterMap.put(long.class, LongConverter.getSingleton()); converterMap.put(Short.class, ShortConverter.getSingleton()); converterMap.put(short.class, ShortConverter.getSingleton()); converterMap.put(String.class, StringConverter.getSingleton()); converterMap.put(UUID.class, UuidConverter.getSingleton()); }
java
public static void addInternalConverters(Map<Class<?>, Converter<?, ?>> converterMap) { converterMap.put(BigDecimal.class, BigDecimalConverter.getSingleton()); converterMap.put(BigInteger.class, BigIntegerConverter.getSingleton()); converterMap.put(Boolean.class, BooleanConverter.getSingleton()); converterMap.put(boolean.class, BooleanConverter.getSingleton()); converterMap.put(Byte.class, ByteConverter.getSingleton()); converterMap.put(byte.class, ByteConverter.getSingleton()); converterMap.put(Character.class, CharacterConverter.getSingleton()); converterMap.put(char.class, CharacterConverter.getSingleton()); converterMap.put(Date.class, DateConverter.getSingleton()); converterMap.put(Double.class, DoubleConverter.getSingleton()); converterMap.put(double.class, DoubleConverter.getSingleton()); converterMap.put(Enum.class, EnumConverter.getSingleton()); converterMap.put(Float.class, FloatConverter.getSingleton()); converterMap.put(float.class, FloatConverter.getSingleton()); converterMap.put(Integer.class, IntegerConverter.getSingleton()); converterMap.put(int.class, IntegerConverter.getSingleton()); converterMap.put(Long.class, LongConverter.getSingleton()); converterMap.put(long.class, LongConverter.getSingleton()); converterMap.put(Short.class, ShortConverter.getSingleton()); converterMap.put(short.class, ShortConverter.getSingleton()); converterMap.put(String.class, StringConverter.getSingleton()); converterMap.put(UUID.class, UuidConverter.getSingleton()); }
[ "public", "static", "void", "addInternalConverters", "(", "Map", "<", "Class", "<", "?", ">", ",", "Converter", "<", "?", ",", "?", ">", ">", "converterMap", ")", "{", "converterMap", ".", "put", "(", "BigDecimal", ".", "class", ",", "BigDecimalConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "BigInteger", ".", "class", ",", "BigIntegerConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Boolean", ".", "class", ",", "BooleanConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "boolean", ".", "class", ",", "BooleanConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Byte", ".", "class", ",", "ByteConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "byte", ".", "class", ",", "ByteConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Character", ".", "class", ",", "CharacterConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "char", ".", "class", ",", "CharacterConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Date", ".", "class", ",", "DateConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Double", ".", "class", ",", "DoubleConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "double", ".", "class", ",", "DoubleConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Enum", ".", "class", ",", "EnumConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Float", ".", "class", ",", "FloatConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "float", ".", "class", ",", "FloatConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Integer", ".", "class", ",", "IntegerConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "int", ".", "class", ",", "IntegerConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Long", ".", "class", ",", "LongConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "long", ".", "class", ",", "LongConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "Short", ".", "class", ",", "ShortConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "short", ".", "class", ",", "ShortConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "String", ".", "class", ",", "StringConverter", ".", "getSingleton", "(", ")", ")", ";", "converterMap", ".", "put", "(", "UUID", ".", "class", ",", "UuidConverter", ".", "getSingleton", "(", ")", ")", ";", "}" ]
Add internal converters to the map.
[ "Add", "internal", "converters", "to", "the", "map", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/converter/ConverterUtils.java#L20-L43
6,747
j256/simplecsv
src/main/java/com/j256/simplecsv/converter/ConverterUtils.java
ConverterUtils.constructConverter
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 for CSV converter class: " + clazz, e); } try { return constructor.newInstance(); } catch (Exception e) { throw new IllegalArgumentException("Could not construct new CSV converter: " + clazz, e); } }
java
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 for CSV converter class: " + clazz, e); } try { return constructor.newInstance(); } catch (Exception e) { throw new IllegalArgumentException("Could not construct new CSV converter: " + clazz, e); } }
[ "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 for CSV converter class: \"", "+", "clazz", ",", "e", ")", ";", "}", "try", "{", "return", "constructor", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not construct new CSV converter: \"", "+", "clazz", ",", "e", ")", ";", "}", "}" ]
Construct a converter instance.
[ "Construct", "a", "converter", "instance", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/converter/ConverterUtils.java#L48-L61
6,748
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSBundle.java
JAXWSBundle.publishEndpoint
public Endpoint publishEndpoint(EndpointBuilder endpointBuilder) { checkArgument(endpointBuilder != null, "EndpointBuilder is null"); return this.jaxwsEnvironment.publishEndpoint(endpointBuilder); }
java
public Endpoint publishEndpoint(EndpointBuilder endpointBuilder) { checkArgument(endpointBuilder != null, "EndpointBuilder is null"); return this.jaxwsEnvironment.publishEndpoint(endpointBuilder); }
[ "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. @param endpointBuilder EndpointBuilder. @return javax.xml.ws.Endpoint
[ "Publish", "JAX", "-", "WS", "endpoint", ".", "Endpoint", "will", "be", "published", "relative", "to", "the", "CXF", "servlet", "path", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSBundle.java#L83-L86
6,749
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSBundle.java
JAXWSBundle.getClient
public <T> T getClient(ClientBuilder<T> clientBuilder) { checkArgument(clientBuilder != null, "ClientBuilder is null"); return jaxwsEnvironment.getClient(clientBuilder); }
java
public <T> T getClient(ClientBuilder<T> clientBuilder) { checkArgument(clientBuilder != null, "ClientBuilder is null"); return jaxwsEnvironment.getClient(clientBuilder); }
[ "public", "<", "T", ">", "T", "getClient", "(", "ClientBuilder", "<", "T", ">", "clientBuilder", ")", "{", "checkArgument", "(", "clientBuilder", "!=", "null", ",", "\"ClientBuilder is null\"", ")", ";", "return", "jaxwsEnvironment", ".", "getClient", "(", "clientBuilder", ")", ";", "}" ]
Factory method for creating JAX-WS clients. @param clientBuilder ClientBuilder. @param <T> Service interface type. @return Client proxy.
[ "Factory", "method", "for", "creating", "JAX", "-", "WS", "clients", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSBundle.java#L176-L179
6,750
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/InstrumentedInvokerFactory.java
InstrumentedInvokerFactory.timed
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(), annotation.absolute(), m); Timer timer = metricRegistry.timer(name); timers.put(m.getName(), timer); } return new InstrumentedInvokers.TimedInvoker(invoker, timers.build()); }
java
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(), annotation.absolute(), m); Timer timer = metricRegistry.timer(name); timers.put(m.getName(), timer); } return new InstrumentedInvokers.TimedInvoker(invoker, timers.build()); }
[ "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", "(", ")", ",", "annotation", ".", "absolute", "(", ")", ",", "m", ")", ";", "Timer", "timer", "=", "metricRegistry", ".", "timer", "(", "name", ")", ";", "timers", ".", "put", "(", "m", ".", "getName", "(", ")", ",", "timer", ")", ";", "}", "return", "new", "InstrumentedInvokers", ".", "TimedInvoker", "(", "invoker", ",", "timers", ".", "build", "(", ")", ")", ";", "}" ]
Factory method for TimedInvoker.
[ "Factory", "method", "for", "TimedInvoker", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/InstrumentedInvokerFactory.java#L28-L40
6,751
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/InstrumentedInvokerFactory.java
InstrumentedInvokerFactory.metered
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(), annotation.absolute(), m); Meter meter = metricRegistry.meter(name); meters.put(m.getName(), meter); } return new InstrumentedInvokers.MeteredInvoker(invoker, meters.build()); }
java
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(), annotation.absolute(), m); Meter meter = metricRegistry.meter(name); meters.put(m.getName(), meter); } return new InstrumentedInvokers.MeteredInvoker(invoker, meters.build()); }
[ "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", "(", ")", ",", "annotation", ".", "absolute", "(", ")", ",", "m", ")", ";", "Meter", "meter", "=", "metricRegistry", ".", "meter", "(", "name", ")", ";", "meters", ".", "put", "(", "m", ".", "getName", "(", ")", ",", "meter", ")", ";", "}", "return", "new", "InstrumentedInvokers", ".", "MeteredInvoker", "(", "invoker", ",", "meters", ".", "build", "(", ")", ")", ";", "}" ]
Factory method for MeteredInvoker.
[ "Factory", "method", "for", "MeteredInvoker", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/InstrumentedInvokerFactory.java#L45-L57
6,752
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/InstrumentedInvokerFactory.java
InstrumentedInvokerFactory.exceptionMetered
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); final String name = chooseName( annotation.name(), annotation.absolute(), m, ExceptionMetered.DEFAULT_NAME_SUFFIX); Meter meter = metricRegistry.meter(name); meters.put(m.getName(), new InstrumentedInvokers.ExceptionMeter(meter, annotation.cause())); } return new InstrumentedInvokers.ExceptionMeteredInvoker(invoker, meters.build()); }
java
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); final String name = chooseName( annotation.name(), annotation.absolute(), m, ExceptionMetered.DEFAULT_NAME_SUFFIX); Meter meter = metricRegistry.meter(name); meters.put(m.getName(), new InstrumentedInvokers.ExceptionMeter(meter, annotation.cause())); } return new InstrumentedInvokers.ExceptionMeteredInvoker(invoker, meters.build()); }
[ "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", ")", ";", "final", "String", "name", "=", "chooseName", "(", "annotation", ".", "name", "(", ")", ",", "annotation", ".", "absolute", "(", ")", ",", "m", ",", "ExceptionMetered", ".", "DEFAULT_NAME_SUFFIX", ")", ";", "Meter", "meter", "=", "metricRegistry", ".", "meter", "(", "name", ")", ";", "meters", ".", "put", "(", "m", ".", "getName", "(", ")", ",", "new", "InstrumentedInvokers", ".", "ExceptionMeter", "(", "meter", ",", "annotation", ".", "cause", "(", ")", ")", ")", ";", "}", "return", "new", "InstrumentedInvokers", ".", "ExceptionMeteredInvoker", "(", "invoker", ",", "meters", ".", "build", "(", ")", ")", ";", "}" ]
Factory method for ExceptionMeteredInvoker.
[ "Factory", "method", "for", "ExceptionMeteredInvoker", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/InstrumentedInvokerFactory.java#L62-L80
6,753
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/InstrumentedInvokerFactory.java
InstrumentedInvokerFactory.create
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.isAnnotationPresent(Timed.class)) { timedmethods.add(m); } if (m.isAnnotationPresent(Metered.class)) { meteredmethods.add(m); } if (m.isAnnotationPresent(ExceptionMetered.class)) { exceptionmeteredmethods.add(m); } } Invoker invoker = rootInvoker; if (timedmethods.size() > 0) { invoker = this.timed(invoker, timedmethods); } if (meteredmethods.size() > 0) { invoker = this.metered(invoker, meteredmethods); } if (exceptionmeteredmethods.size() > 0) { invoker = this.exceptionMetered(invoker, exceptionmeteredmethods); } return invoker; }
java
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.isAnnotationPresent(Timed.class)) { timedmethods.add(m); } if (m.isAnnotationPresent(Metered.class)) { meteredmethods.add(m); } if (m.isAnnotationPresent(ExceptionMetered.class)) { exceptionmeteredmethods.add(m); } } Invoker invoker = rootInvoker; if (timedmethods.size() > 0) { invoker = this.timed(invoker, timedmethods); } if (meteredmethods.size() > 0) { invoker = this.metered(invoker, meteredmethods); } if (exceptionmeteredmethods.size() > 0) { invoker = this.exceptionMetered(invoker, exceptionmeteredmethods); } return invoker; }
[ "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", ".", "isAnnotationPresent", "(", "Timed", ".", "class", ")", ")", "{", "timedmethods", ".", "add", "(", "m", ")", ";", "}", "if", "(", "m", ".", "isAnnotationPresent", "(", "Metered", ".", "class", ")", ")", "{", "meteredmethods", ".", "add", "(", "m", ")", ";", "}", "if", "(", "m", ".", "isAnnotationPresent", "(", "ExceptionMetered", ".", "class", ")", ")", "{", "exceptionmeteredmethods", ".", "add", "(", "m", ")", ";", "}", "}", "Invoker", "invoker", "=", "rootInvoker", ";", "if", "(", "timedmethods", ".", "size", "(", ")", ">", "0", ")", "{", "invoker", "=", "this", ".", "timed", "(", "invoker", ",", "timedmethods", ")", ";", "}", "if", "(", "meteredmethods", ".", "size", "(", ")", ">", "0", ")", "{", "invoker", "=", "this", ".", "metered", "(", "invoker", ",", "meteredmethods", ")", ";", "}", "if", "(", "exceptionmeteredmethods", ".", "size", "(", ")", ">", "0", ")", "{", "invoker", "=", "this", ".", "exceptionMetered", "(", "invoker", ",", "exceptionmeteredmethods", ")", ";", "}", "return", "invoker", ";", "}" ]
Factory method for creating instrumented invoker chain.
[ "Factory", "method", "for", "creating", "instrumented", "invoker", "chain", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/InstrumentedInvokerFactory.java#L107-L143
6,754
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSEnvironment.java
JAXWSEnvironment.publishEndpoint
public Endpoint publishEndpoint(EndpointBuilder endpointBuilder) { checkArgument(endpointBuilder != null, "EndpointBuilder is null"); EndpointImpl cxfendpoint = new EndpointImpl(bus, endpointBuilder.getService()); if(endpointBuilder.publishedEndpointUrl() != null) { cxfendpoint.setPublishedEndpointUrl(endpointBuilder.publishedEndpointUrl()); } else if(publishedEndpointUrlPrefix != null) { cxfendpoint.setPublishedEndpointUrl(publishedEndpointUrlPrefix + endpointBuilder.getPath()); } cxfendpoint.publish(endpointBuilder.getPath()); // MTOM support if (endpointBuilder.isMtomEnabled()) { ((SOAPBinding)cxfendpoint.getBinding()).setMTOMEnabled(true); } Invoker invoker = cxfendpoint.getService().getInvoker(); // validating invoker ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); invoker = this.createValidatingInvoker(invoker, vf.getValidator()); if (endpointBuilder.getSessionFactory() != null) { // Add invoker to handle UnitOfWork annotations. Note that this invoker is set up before // instrumented invoker(s) in order for instrumented invoker(s) to wrap "unit of work" invoker. invoker = unitOfWorkInvokerBuilder.create( endpointBuilder.getService(), invoker, endpointBuilder.getSessionFactory()); cxfendpoint.getService().setInvoker(invoker); } // Replace CXF service invoker with instrumented invoker(s) invoker = instrumentedInvokerBuilder.create(endpointBuilder.getService(), invoker); cxfendpoint.getService().setInvoker(invoker); if (endpointBuilder.getAuthentication() != null) { // Configure CXF in interceptor to handle basic authentication BasicAuthenticationInterceptor basicAuthInterceptor = this.createBasicAuthenticationInterceptor(); basicAuthInterceptor.setAuthenticator(endpointBuilder.getAuthentication()); cxfendpoint.getInInterceptors().add(basicAuthInterceptor); } // CXF interceptors if (endpointBuilder.getCxfInInterceptors() != null) { cxfendpoint.getInInterceptors().addAll(endpointBuilder.getCxfInInterceptors()); } if (endpointBuilder.getCxfInFaultInterceptors() != null) { cxfendpoint.getInFaultInterceptors().addAll(endpointBuilder.getCxfInFaultInterceptors()); } if (endpointBuilder.getCxfOutInterceptors() != null) { cxfendpoint.getOutInterceptors().addAll(endpointBuilder.getCxfOutInterceptors()); } if (endpointBuilder.getCxfOutFaultInterceptors() != null) { cxfendpoint.getOutFaultInterceptors().addAll(endpointBuilder.getCxfOutFaultInterceptors()); } if (endpointBuilder.getProperties() != null) { cxfendpoint.getProperties().putAll( endpointBuilder.getProperties()); } return cxfendpoint; }
java
public Endpoint publishEndpoint(EndpointBuilder endpointBuilder) { checkArgument(endpointBuilder != null, "EndpointBuilder is null"); EndpointImpl cxfendpoint = new EndpointImpl(bus, endpointBuilder.getService()); if(endpointBuilder.publishedEndpointUrl() != null) { cxfendpoint.setPublishedEndpointUrl(endpointBuilder.publishedEndpointUrl()); } else if(publishedEndpointUrlPrefix != null) { cxfendpoint.setPublishedEndpointUrl(publishedEndpointUrlPrefix + endpointBuilder.getPath()); } cxfendpoint.publish(endpointBuilder.getPath()); // MTOM support if (endpointBuilder.isMtomEnabled()) { ((SOAPBinding)cxfendpoint.getBinding()).setMTOMEnabled(true); } Invoker invoker = cxfendpoint.getService().getInvoker(); // validating invoker ValidatorFactory vf = Validation.buildDefaultValidatorFactory(); invoker = this.createValidatingInvoker(invoker, vf.getValidator()); if (endpointBuilder.getSessionFactory() != null) { // Add invoker to handle UnitOfWork annotations. Note that this invoker is set up before // instrumented invoker(s) in order for instrumented invoker(s) to wrap "unit of work" invoker. invoker = unitOfWorkInvokerBuilder.create( endpointBuilder.getService(), invoker, endpointBuilder.getSessionFactory()); cxfendpoint.getService().setInvoker(invoker); } // Replace CXF service invoker with instrumented invoker(s) invoker = instrumentedInvokerBuilder.create(endpointBuilder.getService(), invoker); cxfendpoint.getService().setInvoker(invoker); if (endpointBuilder.getAuthentication() != null) { // Configure CXF in interceptor to handle basic authentication BasicAuthenticationInterceptor basicAuthInterceptor = this.createBasicAuthenticationInterceptor(); basicAuthInterceptor.setAuthenticator(endpointBuilder.getAuthentication()); cxfendpoint.getInInterceptors().add(basicAuthInterceptor); } // CXF interceptors if (endpointBuilder.getCxfInInterceptors() != null) { cxfendpoint.getInInterceptors().addAll(endpointBuilder.getCxfInInterceptors()); } if (endpointBuilder.getCxfInFaultInterceptors() != null) { cxfendpoint.getInFaultInterceptors().addAll(endpointBuilder.getCxfInFaultInterceptors()); } if (endpointBuilder.getCxfOutInterceptors() != null) { cxfendpoint.getOutInterceptors().addAll(endpointBuilder.getCxfOutInterceptors()); } if (endpointBuilder.getCxfOutFaultInterceptors() != null) { cxfendpoint.getOutFaultInterceptors().addAll(endpointBuilder.getCxfOutFaultInterceptors()); } if (endpointBuilder.getProperties() != null) { cxfendpoint.getProperties().putAll( endpointBuilder.getProperties()); } return cxfendpoint; }
[ "public", "Endpoint", "publishEndpoint", "(", "EndpointBuilder", "endpointBuilder", ")", "{", "checkArgument", "(", "endpointBuilder", "!=", "null", ",", "\"EndpointBuilder is null\"", ")", ";", "EndpointImpl", "cxfendpoint", "=", "new", "EndpointImpl", "(", "bus", ",", "endpointBuilder", ".", "getService", "(", ")", ")", ";", "if", "(", "endpointBuilder", ".", "publishedEndpointUrl", "(", ")", "!=", "null", ")", "{", "cxfendpoint", ".", "setPublishedEndpointUrl", "(", "endpointBuilder", ".", "publishedEndpointUrl", "(", ")", ")", ";", "}", "else", "if", "(", "publishedEndpointUrlPrefix", "!=", "null", ")", "{", "cxfendpoint", ".", "setPublishedEndpointUrl", "(", "publishedEndpointUrlPrefix", "+", "endpointBuilder", ".", "getPath", "(", ")", ")", ";", "}", "cxfendpoint", ".", "publish", "(", "endpointBuilder", ".", "getPath", "(", ")", ")", ";", "// MTOM support", "if", "(", "endpointBuilder", ".", "isMtomEnabled", "(", ")", ")", "{", "(", "(", "SOAPBinding", ")", "cxfendpoint", ".", "getBinding", "(", ")", ")", ".", "setMTOMEnabled", "(", "true", ")", ";", "}", "Invoker", "invoker", "=", "cxfendpoint", ".", "getService", "(", ")", ".", "getInvoker", "(", ")", ";", "// validating invoker", "ValidatorFactory", "vf", "=", "Validation", ".", "buildDefaultValidatorFactory", "(", ")", ";", "invoker", "=", "this", ".", "createValidatingInvoker", "(", "invoker", ",", "vf", ".", "getValidator", "(", ")", ")", ";", "if", "(", "endpointBuilder", ".", "getSessionFactory", "(", ")", "!=", "null", ")", "{", "// Add invoker to handle UnitOfWork annotations. Note that this invoker is set up before", "// instrumented invoker(s) in order for instrumented invoker(s) to wrap \"unit of work\" invoker.", "invoker", "=", "unitOfWorkInvokerBuilder", ".", "create", "(", "endpointBuilder", ".", "getService", "(", ")", ",", "invoker", ",", "endpointBuilder", ".", "getSessionFactory", "(", ")", ")", ";", "cxfendpoint", ".", "getService", "(", ")", ".", "setInvoker", "(", "invoker", ")", ";", "}", "// Replace CXF service invoker with instrumented invoker(s)", "invoker", "=", "instrumentedInvokerBuilder", ".", "create", "(", "endpointBuilder", ".", "getService", "(", ")", ",", "invoker", ")", ";", "cxfendpoint", ".", "getService", "(", ")", ".", "setInvoker", "(", "invoker", ")", ";", "if", "(", "endpointBuilder", ".", "getAuthentication", "(", ")", "!=", "null", ")", "{", "// Configure CXF in interceptor to handle basic authentication", "BasicAuthenticationInterceptor", "basicAuthInterceptor", "=", "this", ".", "createBasicAuthenticationInterceptor", "(", ")", ";", "basicAuthInterceptor", ".", "setAuthenticator", "(", "endpointBuilder", ".", "getAuthentication", "(", ")", ")", ";", "cxfendpoint", ".", "getInInterceptors", "(", ")", ".", "add", "(", "basicAuthInterceptor", ")", ";", "}", "// CXF interceptors", "if", "(", "endpointBuilder", ".", "getCxfInInterceptors", "(", ")", "!=", "null", ")", "{", "cxfendpoint", ".", "getInInterceptors", "(", ")", ".", "addAll", "(", "endpointBuilder", ".", "getCxfInInterceptors", "(", ")", ")", ";", "}", "if", "(", "endpointBuilder", ".", "getCxfInFaultInterceptors", "(", ")", "!=", "null", ")", "{", "cxfendpoint", ".", "getInFaultInterceptors", "(", ")", ".", "addAll", "(", "endpointBuilder", ".", "getCxfInFaultInterceptors", "(", ")", ")", ";", "}", "if", "(", "endpointBuilder", ".", "getCxfOutInterceptors", "(", ")", "!=", "null", ")", "{", "cxfendpoint", ".", "getOutInterceptors", "(", ")", ".", "addAll", "(", "endpointBuilder", ".", "getCxfOutInterceptors", "(", ")", ")", ";", "}", "if", "(", "endpointBuilder", ".", "getCxfOutFaultInterceptors", "(", ")", "!=", "null", ")", "{", "cxfendpoint", ".", "getOutFaultInterceptors", "(", ")", ".", "addAll", "(", "endpointBuilder", ".", "getCxfOutFaultInterceptors", "(", ")", ")", ";", "}", "if", "(", "endpointBuilder", ".", "getProperties", "(", ")", "!=", "null", ")", "{", "cxfendpoint", ".", "getProperties", "(", ")", ".", "putAll", "(", "endpointBuilder", ".", "getProperties", "(", ")", ")", ";", "}", "return", "cxfendpoint", ";", "}" ]
Publish JAX-WS server side endpoint. Returns javax.xml.ws.Endpoint to enable further customization.
[ "Publish", "JAX", "-", "WS", "server", "side", "endpoint", ".", "Returns", "javax", ".", "xml", ".", "ws", ".", "Endpoint", "to", "enable", "further", "customization", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSEnvironment.java#L103-L169
6,755
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSEnvironment.java
JAXWSEnvironment.getClient
public <T> T getClient(ClientBuilder<T> clientBuilder) { JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean(); proxyFactory.setServiceClass(clientBuilder.getServiceClass()); proxyFactory.setAddress(clientBuilder.getAddress()); // JAX-WS handlers if (clientBuilder.getHandlers() != null) { for (Handler h : clientBuilder.getHandlers()) { proxyFactory.getHandlers().add(h); } } // ClientProxyFactoryBean bindingId if (clientBuilder.getBindingId() != null) { proxyFactory.setBindingId(clientBuilder.getBindingId()); } // CXF interceptors if (clientBuilder.getCxfInInterceptors() != null) { proxyFactory.getInInterceptors().addAll(clientBuilder.getCxfInInterceptors()); } if (clientBuilder.getCxfInFaultInterceptors() != null) { proxyFactory.getInFaultInterceptors().addAll(clientBuilder.getCxfInFaultInterceptors()); } if (clientBuilder.getCxfOutInterceptors() != null) { proxyFactory.getOutInterceptors().addAll(clientBuilder.getCxfOutInterceptors()); } if (clientBuilder.getCxfOutFaultInterceptors() != null) { proxyFactory.getOutFaultInterceptors().addAll(clientBuilder.getCxfOutFaultInterceptors()); } T proxy = clientBuilder.getServiceClass().cast(proxyFactory.create()); // MTOM support if (clientBuilder.isMtomEnabled()) { BindingProvider bp = (BindingProvider)proxy; SOAPBinding binding = (SOAPBinding)bp.getBinding(); binding.setMTOMEnabled(true); } HTTPConduit http = (HTTPConduit)ClientProxy.getClient(proxy).getConduit(); HTTPClientPolicy client = http.getClient(); client.setConnectionTimeout(clientBuilder.getConnectTimeout()); client.setReceiveTimeout(clientBuilder.getReceiveTimeout()); return proxy; }
java
public <T> T getClient(ClientBuilder<T> clientBuilder) { JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean(); proxyFactory.setServiceClass(clientBuilder.getServiceClass()); proxyFactory.setAddress(clientBuilder.getAddress()); // JAX-WS handlers if (clientBuilder.getHandlers() != null) { for (Handler h : clientBuilder.getHandlers()) { proxyFactory.getHandlers().add(h); } } // ClientProxyFactoryBean bindingId if (clientBuilder.getBindingId() != null) { proxyFactory.setBindingId(clientBuilder.getBindingId()); } // CXF interceptors if (clientBuilder.getCxfInInterceptors() != null) { proxyFactory.getInInterceptors().addAll(clientBuilder.getCxfInInterceptors()); } if (clientBuilder.getCxfInFaultInterceptors() != null) { proxyFactory.getInFaultInterceptors().addAll(clientBuilder.getCxfInFaultInterceptors()); } if (clientBuilder.getCxfOutInterceptors() != null) { proxyFactory.getOutInterceptors().addAll(clientBuilder.getCxfOutInterceptors()); } if (clientBuilder.getCxfOutFaultInterceptors() != null) { proxyFactory.getOutFaultInterceptors().addAll(clientBuilder.getCxfOutFaultInterceptors()); } T proxy = clientBuilder.getServiceClass().cast(proxyFactory.create()); // MTOM support if (clientBuilder.isMtomEnabled()) { BindingProvider bp = (BindingProvider)proxy; SOAPBinding binding = (SOAPBinding)bp.getBinding(); binding.setMTOMEnabled(true); } HTTPConduit http = (HTTPConduit)ClientProxy.getClient(proxy).getConduit(); HTTPClientPolicy client = http.getClient(); client.setConnectionTimeout(clientBuilder.getConnectTimeout()); client.setReceiveTimeout(clientBuilder.getReceiveTimeout()); return proxy; }
[ "public", "<", "T", ">", "T", "getClient", "(", "ClientBuilder", "<", "T", ">", "clientBuilder", ")", "{", "JaxWsProxyFactoryBean", "proxyFactory", "=", "new", "JaxWsProxyFactoryBean", "(", ")", ";", "proxyFactory", ".", "setServiceClass", "(", "clientBuilder", ".", "getServiceClass", "(", ")", ")", ";", "proxyFactory", ".", "setAddress", "(", "clientBuilder", ".", "getAddress", "(", ")", ")", ";", "// JAX-WS handlers", "if", "(", "clientBuilder", ".", "getHandlers", "(", ")", "!=", "null", ")", "{", "for", "(", "Handler", "h", ":", "clientBuilder", ".", "getHandlers", "(", ")", ")", "{", "proxyFactory", ".", "getHandlers", "(", ")", ".", "add", "(", "h", ")", ";", "}", "}", "// ClientProxyFactoryBean bindingId", "if", "(", "clientBuilder", ".", "getBindingId", "(", ")", "!=", "null", ")", "{", "proxyFactory", ".", "setBindingId", "(", "clientBuilder", ".", "getBindingId", "(", ")", ")", ";", "}", "// CXF interceptors", "if", "(", "clientBuilder", ".", "getCxfInInterceptors", "(", ")", "!=", "null", ")", "{", "proxyFactory", ".", "getInInterceptors", "(", ")", ".", "addAll", "(", "clientBuilder", ".", "getCxfInInterceptors", "(", ")", ")", ";", "}", "if", "(", "clientBuilder", ".", "getCxfInFaultInterceptors", "(", ")", "!=", "null", ")", "{", "proxyFactory", ".", "getInFaultInterceptors", "(", ")", ".", "addAll", "(", "clientBuilder", ".", "getCxfInFaultInterceptors", "(", ")", ")", ";", "}", "if", "(", "clientBuilder", ".", "getCxfOutInterceptors", "(", ")", "!=", "null", ")", "{", "proxyFactory", ".", "getOutInterceptors", "(", ")", ".", "addAll", "(", "clientBuilder", ".", "getCxfOutInterceptors", "(", ")", ")", ";", "}", "if", "(", "clientBuilder", ".", "getCxfOutFaultInterceptors", "(", ")", "!=", "null", ")", "{", "proxyFactory", ".", "getOutFaultInterceptors", "(", ")", ".", "addAll", "(", "clientBuilder", ".", "getCxfOutFaultInterceptors", "(", ")", ")", ";", "}", "T", "proxy", "=", "clientBuilder", ".", "getServiceClass", "(", ")", ".", "cast", "(", "proxyFactory", ".", "create", "(", ")", ")", ";", "// MTOM support", "if", "(", "clientBuilder", ".", "isMtomEnabled", "(", ")", ")", "{", "BindingProvider", "bp", "=", "(", "BindingProvider", ")", "proxy", ";", "SOAPBinding", "binding", "=", "(", "SOAPBinding", ")", "bp", ".", "getBinding", "(", ")", ";", "binding", ".", "setMTOMEnabled", "(", "true", ")", ";", "}", "HTTPConduit", "http", "=", "(", "HTTPConduit", ")", "ClientProxy", ".", "getClient", "(", "proxy", ")", ".", "getConduit", "(", ")", ";", "HTTPClientPolicy", "client", "=", "http", ".", "getClient", "(", ")", ";", "client", ".", "setConnectionTimeout", "(", "clientBuilder", ".", "getConnectTimeout", "(", ")", ")", ";", "client", ".", "setReceiveTimeout", "(", "clientBuilder", ".", "getReceiveTimeout", "(", ")", ")", ";", "return", "proxy", ";", "}" ]
JAX-WS client factory @param clientBuilder ClientBuilder. @param <T> Service interface type. @return JAX-WS client proxy.
[ "JAX", "-", "WS", "client", "factory" ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSEnvironment.java#L177-L224
6,756
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.readAll
public List<T> readAll(File file, Collection<ParseError> parseErrors) throws IOException, ParseException { checkEntityConfig(); return readAll(new FileReader(file), parseErrors); }
java
public List<T> readAll(File file, Collection<ParseError> parseErrors) throws IOException, ParseException { checkEntityConfig(); return readAll(new FileReader(file), parseErrors); }
[ "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. @param file Where to read the header and entities from. It will be closed when the method returns. @param parseErrors If not null, any errors will be added to the collection and null will be returned. If validateHeader is true and the header does not match then no additional lines will be returned. If this is null then a ParseException will be thrown on parsing problems. @return A list of entities read in or null if validateHeader is true and the first-line header was not valid. @throws ParseException Thrown on any parsing problems. If parseErrors is not null then parse errors will be added there and an exception should not be thrown. @throws IOException If there are any IO exceptions thrown when reading.
[ "Read", "in", "all", "of", "the", "entities", "in", "the", "file", "passed", "in", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L156-L159
6,757
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.readAll
public List<T> readAll(Reader reader, Collection<ParseError> parseErrors) throws IOException, ParseException { checkEntityConfig(); BufferedReader bufferedReader = new BufferedReaderLineCounter(reader); try { ParseError parseError = null; // we do this to reuse the parse error objects if we can if (parseErrors != null) { parseError = new ParseError(); } if (firstLineHeader) { if (readHeader(bufferedReader, parseError) == null) { if (parseError != null && parseError.isError()) { parseErrors.add(parseError); } return null; } } return readRows(bufferedReader, parseErrors); } finally { bufferedReader.close(); } }
java
public List<T> readAll(Reader reader, Collection<ParseError> parseErrors) throws IOException, ParseException { checkEntityConfig(); BufferedReader bufferedReader = new BufferedReaderLineCounter(reader); try { ParseError parseError = null; // we do this to reuse the parse error objects if we can if (parseErrors != null) { parseError = new ParseError(); } if (firstLineHeader) { if (readHeader(bufferedReader, parseError) == null) { if (parseError != null && parseError.isError()) { parseErrors.add(parseError); } return null; } } return readRows(bufferedReader, parseErrors); } finally { bufferedReader.close(); } }
[ "public", "List", "<", "T", ">", "readAll", "(", "Reader", "reader", ",", "Collection", "<", "ParseError", ">", "parseErrors", ")", "throws", "IOException", ",", "ParseException", "{", "checkEntityConfig", "(", ")", ";", "BufferedReader", "bufferedReader", "=", "new", "BufferedReaderLineCounter", "(", "reader", ")", ";", "try", "{", "ParseError", "parseError", "=", "null", ";", "// we do this to reuse the parse error objects if we can", "if", "(", "parseErrors", "!=", "null", ")", "{", "parseError", "=", "new", "ParseError", "(", ")", ";", "}", "if", "(", "firstLineHeader", ")", "{", "if", "(", "readHeader", "(", "bufferedReader", ",", "parseError", ")", "==", "null", ")", "{", "if", "(", "parseError", "!=", "null", "&&", "parseError", ".", "isError", "(", ")", ")", "{", "parseErrors", ".", "add", "(", "parseError", ")", ";", "}", "return", "null", ";", "}", "}", "return", "readRows", "(", "bufferedReader", ",", "parseErrors", ")", ";", "}", "finally", "{", "bufferedReader", ".", "close", "(", ")", ";", "}", "}" ]
Read in all of the entities in the reader passed in. It will use an internal buffered reader. @param reader Where to read the header and entities from. It will be closed when the method returns. @param parseErrors If not null, any errors will be added to the collection and null will be returned. If validateHeader is true and the header does not match then no additional lines will be returned. If this is null then a ParseException will be thrown on parsing problems. @return A list of entities read in or null if parseErrors is not null. @throws ParseException Thrown on any parsing problems. If parseErrors is not null then parse errors will be added there and an exception should not be thrown. @throws IOException If there are any IO exceptions thrown when reading.
[ "Read", "in", "all", "of", "the", "entities", "in", "the", "reader", "passed", "in", ".", "It", "will", "use", "an", "internal", "buffered", "reader", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L177-L198
6,758
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.readHeader
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 { parseError.setErrorType(ErrorType.NO_HEADER); parseError.setLineNumber(getLineNumber(bufferedReader)); return null; } } String[] columns = processHeader(header, parseError, getLineNumber(bufferedReader)); if (columns == null) { return null; } else if (headerValidation && !validateHeaderColumns(columns, parseError, getLineNumber(bufferedReader))) { if (parseError == null) { throw new ParseException("header line is not valid: " + header, 0); } else { return null; } } return columns; }
java
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 { parseError.setErrorType(ErrorType.NO_HEADER); parseError.setLineNumber(getLineNumber(bufferedReader)); return null; } } String[] columns = processHeader(header, parseError, getLineNumber(bufferedReader)); if (columns == null) { return null; } else if (headerValidation && !validateHeaderColumns(columns, parseError, getLineNumber(bufferedReader))) { if (parseError == null) { throw new ParseException("header line is not valid: " + header, 0); } else { return null; } } return columns; }
[ "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", "{", "parseError", ".", "setErrorType", "(", "ErrorType", ".", "NO_HEADER", ")", ";", "parseError", ".", "setLineNumber", "(", "getLineNumber", "(", "bufferedReader", ")", ")", ";", "return", "null", ";", "}", "}", "String", "[", "]", "columns", "=", "processHeader", "(", "header", ",", "parseError", ",", "getLineNumber", "(", "bufferedReader", ")", ")", ";", "if", "(", "columns", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "headerValidation", "&&", "!", "validateHeaderColumns", "(", "columns", ",", "parseError", ",", "getLineNumber", "(", "bufferedReader", ")", ")", ")", "{", "if", "(", "parseError", "==", "null", ")", "{", "throw", "new", "ParseException", "(", "\"header line is not valid: \"", "+", "header", ",", "0", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "return", "columns", ";", "}" ]
Read in a line and process it as a CSV header. @param bufferedReader Where to read the header from. It needs to be closed by the caller. Consider using {@link BufferedReaderLineCounter} to populate the line-number for parse errors. @param parseError If not null, this will be set with the first parse error and it will return null. If this is null then a ParseException will be thrown instead. @return Array of header column names or null on error. @throws ParseException Thrown on any parsing problems. If parseError is not null then the error will be added there and an exception should not be thrown. @throws IOException If there are any IO exceptions thrown when reading.
[ "Read", "in", "a", "line", "and", "process", "it", "as", "a", "CSV", "header", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L216-L240
6,759
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.readRows
public List<T> readRows(BufferedReader bufferedReader, Collection<ParseError> parseErrors) throws IOException, ParseException { checkEntityConfig(); ParseError parseError = null; // we do this to reuse the parse error objects if we can if (parseErrors != null) { parseError = new ParseError(); } List<T> results = new ArrayList<T>(); while (true) { if (parseError != null) { parseError.reset(); } T result = readRow(bufferedReader, parseError); if (result != null) { results.add(result); } else if (parseError != null && parseError.isError()) { // if there was an error then add it to the list parseErrors.add(parseError); // once we use it, we need to create another one parseError = new ParseError(); } else { // if no result and no error then EOF return results; } } }
java
public List<T> readRows(BufferedReader bufferedReader, Collection<ParseError> parseErrors) throws IOException, ParseException { checkEntityConfig(); ParseError parseError = null; // we do this to reuse the parse error objects if we can if (parseErrors != null) { parseError = new ParseError(); } List<T> results = new ArrayList<T>(); while (true) { if (parseError != null) { parseError.reset(); } T result = readRow(bufferedReader, parseError); if (result != null) { results.add(result); } else if (parseError != null && parseError.isError()) { // if there was an error then add it to the list parseErrors.add(parseError); // once we use it, we need to create another one parseError = new ParseError(); } else { // if no result and no error then EOF return results; } } }
[ "public", "List", "<", "T", ">", "readRows", "(", "BufferedReader", "bufferedReader", ",", "Collection", "<", "ParseError", ">", "parseErrors", ")", "throws", "IOException", ",", "ParseException", "{", "checkEntityConfig", "(", ")", ";", "ParseError", "parseError", "=", "null", ";", "// we do this to reuse the parse error objects if we can", "if", "(", "parseErrors", "!=", "null", ")", "{", "parseError", "=", "new", "ParseError", "(", ")", ";", "}", "List", "<", "T", ">", "results", "=", "new", "ArrayList", "<", "T", ">", "(", ")", ";", "while", "(", "true", ")", "{", "if", "(", "parseError", "!=", "null", ")", "{", "parseError", ".", "reset", "(", ")", ";", "}", "T", "result", "=", "readRow", "(", "bufferedReader", ",", "parseError", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "results", ".", "add", "(", "result", ")", ";", "}", "else", "if", "(", "parseError", "!=", "null", "&&", "parseError", ".", "isError", "(", ")", ")", "{", "// if there was an error then add it to the list", "parseErrors", ".", "add", "(", "parseError", ")", ";", "// once we use it, we need to create another one", "parseError", "=", "new", "ParseError", "(", ")", ";", "}", "else", "{", "// if no result and no error then EOF", "return", "results", ";", "}", "}", "}" ]
Read in all of the entities in the reader passed in but without the header. @param bufferedReader Where to read the entries from. It needs to be closed by the caller. Consider using {@link BufferedReaderLineCounter} to populate the line-number for parse errors. @param parseErrors If not null, any errors will be added to the collection and null will be returned. If validateHeader is true and the header does not match then no additional lines will be returned. If this is null then a ParseException will be thrown on parsing problems. @return A list of entities read in or null if parseErrors is not null. @throws ParseException Thrown on any parsing problems. If parseErrors is not null then parse errors will be added there and an exception should not be thrown. @throws IOException If there are any IO exceptions thrown when reading.
[ "Read", "in", "all", "of", "the", "entities", "in", "the", "reader", "passed", "in", "but", "without", "the", "header", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L259-L285
6,760
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.readRow
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)); } }
java
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)); } }
[ "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. @param bufferedReader Where to read the row from. It needs to be closed by the caller. Consider using {@link BufferedReaderLineCounter} to populate the line-number for parse errors. @param parseError If not null, this will be set with the first parse error and it will return null. If this is null then a ParseException will be thrown instead. @return Entity read in or null on EOF or error. Check {@link ParseError#isError()} to see if it was an error or EOF. @throws ParseException Thrown on any parsing problems. If parseError is not null then the error will be added there and an exception should not be thrown. @throws IOException If there are any IO exceptions thrown when reading.
[ "Read", "an", "entity", "line", "from", "the", "reader", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L304-L312
6,761
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.validateHeader
public boolean validateHeader(String line, ParseError parseError) throws ParseException { checkEntityConfig(); String[] columns = processHeader(line, parseError); return validateHeaderColumns(columns, parseError, 1); }
java
public boolean validateHeader(String line, ParseError parseError) throws ParseException { checkEntityConfig(); String[] columns = processHeader(line, parseError); return validateHeaderColumns(columns, parseError, 1); }
[ "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. @param line Line to process to get our validate our header. @param parseError If not null, this will be set with the first parse error and it will return null. If this is null then a ParseException will be thrown instead. @return true if the header matched the column names configured here otherwise false. @throws ParseException Thrown on any parsing problems. If parseError is not null then the error will be added there and an exception should not be thrown.
[ "Validate", "the", "header", "row", "against", "the", "configured", "header", "columns", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L327-L331
6,762
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.processHeader
public String[] processHeader(String line, ParseError parseError) throws ParseException { checkEntityConfig(); try { return processHeader(line, parseError, 1); } catch (IOException e) { // this won't happen because processRow won't do any IO return null; } }
java
public String[] processHeader(String line, ParseError parseError) throws ParseException { checkEntityConfig(); try { return processHeader(line, parseError, 1); } catch (IOException e) { // this won't happen because processRow won't do any IO return null; } }
[ "public", "String", "[", "]", "processHeader", "(", "String", "line", ",", "ParseError", "parseError", ")", "throws", "ParseException", "{", "checkEntityConfig", "(", ")", ";", "try", "{", "return", "processHeader", "(", "line", ",", "parseError", ",", "1", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// this won't happen because processRow won't do any IO", "return", "null", ";", "}", "}" ]
Process a header line and divide it up into a series of quoted columns. @param line Line to process looking for header. @param parseError If not null, this will be set with the first parse error and it will return null. If this is null then a ParseException will be thrown instead. @return Returns an array of processed header names entity or null if an error and parseError has been set. The array will be the same length as the number of configured columns so some elements may be null. @throws ParseException Thrown on any parsing problems. If parseError is not null then the error will be added there and an exception should not be thrown.
[ "Process", "a", "header", "line", "and", "divide", "it", "up", "into", "a", "series", "of", "quoted", "columns", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L365-L373
6,763
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.processRow
public T processRow(String line, ParseError parseError) throws ParseException { checkEntityConfig(); try { return processRow(line, null, parseError, 1); } catch (IOException e) { // this won't happen because processRow won't do any IO return null; } }
java
public T processRow(String line, ParseError parseError) throws ParseException { checkEntityConfig(); try { return processRow(line, null, parseError, 1); } catch (IOException e) { // this won't happen because processRow won't do any IO return null; } }
[ "public", "T", "processRow", "(", "String", "line", ",", "ParseError", "parseError", ")", "throws", "ParseException", "{", "checkEntityConfig", "(", ")", ";", "try", "{", "return", "processRow", "(", "line", ",", "null", ",", "parseError", ",", "1", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// this won't happen because processRow won't do any IO", "return", "null", ";", "}", "}" ]
Read and process a line and return the associated entity. @param line to process to build our entity. @param parseError If not null, this will be set with the first parse error and it will return null. If this is null then a ParseException will be thrown instead. @return Returns a processed entity or null if an error and parseError has been set. @throws ParseException Thrown on any parsing problems. If parseError is not null then the error will be added there and an exception should not be thrown.
[ "Read", "and", "process", "a", "line", "and", "return", "the", "associated", "entity", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L388-L396
6,764
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.writeAll
public void writeAll(File file, Collection<T> entities, boolean writeHeader) throws IOException { writeAll(new FileWriter(file), entities, writeHeader); }
java
public void writeAll(File file, Collection<T> entities, boolean writeHeader) throws IOException { writeAll(new FileWriter(file), entities, writeHeader); }
[ "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. @param file Where to write the header and entities. @param entities Collection of entities to write to the writer. @param writeHeader Set to true to write header at the start of the output file. @throws IOException If there are any IO exceptions thrown when writing.
[ "Write", "a", "collection", "of", "entities", "to", "the", "writer", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L410-L412
6,765
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.writeAll
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(bufferedWriter, entity, true); } } finally { bufferedWriter.close(); } }
java
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(bufferedWriter, entity, true); } } finally { bufferedWriter.close(); } }
[ "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", "(", "bufferedWriter", ",", "entity", ",", "true", ")", ";", "}", "}", "finally", "{", "bufferedWriter", ".", "close", "(", ")", ";", "}", "}" ]
Write a header and then the collection of entities to the writer. @param writer Where to write the header and entities. It will be closed before this method returns. @param entities Collection of entities to write to the writer. @param writeHeader Set to true to write header at the start of the writer. @throws IOException If there are any IO exceptions thrown when writing.
[ "Write", "a", "header", "and", "then", "the", "collection", "of", "entities", "to", "the", "writer", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L426-L439
6,766
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.writeHeader
public void writeHeader(BufferedWriter bufferedWriter, boolean appendLineTermination) throws IOException { checkEntityConfig(); bufferedWriter.write(buildHeaderLine(appendLineTermination)); }
java
public void writeHeader(BufferedWriter bufferedWriter, boolean appendLineTermination) throws IOException { checkEntityConfig(); bufferedWriter.write(buildHeaderLine(appendLineTermination)); }
[ "public", "void", "writeHeader", "(", "BufferedWriter", "bufferedWriter", ",", "boolean", "appendLineTermination", ")", "throws", "IOException", "{", "checkEntityConfig", "(", ")", ";", "bufferedWriter", ".", "write", "(", "buildHeaderLine", "(", "appendLineTermination", ")", ")", ";", "}" ]
Write the header line to the writer. @param bufferedWriter Where to write our header information. @param appendLineTermination Set to true to add the newline to the end of the line. @throws IOException If there are any IO exceptions thrown when writing.
[ "Write", "the", "header", "line", "to", "the", "writer", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L451-L454
6,767
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.writeRow
public void writeRow(BufferedWriter bufferedWriter, T entity, boolean appendLineTermination) throws IOException { checkEntityConfig(); String line = buildLine(entity, appendLineTermination); bufferedWriter.write(line); }
java
public void writeRow(BufferedWriter bufferedWriter, T entity, boolean appendLineTermination) throws IOException { checkEntityConfig(); String line = buildLine(entity, appendLineTermination); bufferedWriter.write(line); }
[ "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. @param bufferedWriter Where to write our header information. @param entity The entity we are writing to the buffered writer. @param appendLineTermination Set to true to add the newline to the end of the line. @throws IOException If there are any IO exceptions thrown when writing.
[ "Write", "an", "entity", "row", "to", "the", "writer", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L468-L472
6,768
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.buildHeaderLine
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.getColumnName(); // need to protect the column if it contains a quote if (header.indexOf(columnQuote) >= 0) { writeQuoted(sb, header); continue; } sb.append(columnQuote); sb.append(header); sb.append(columnQuote); } if (appendLineTermination) { sb.append(lineTermination); } return sb.toString(); }
java
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.getColumnName(); // need to protect the column if it contains a quote if (header.indexOf(columnQuote) >= 0) { writeQuoted(sb, header); continue; } sb.append(columnQuote); sb.append(header); sb.append(columnQuote); } if (appendLineTermination) { sb.append(lineTermination); } return sb.toString(); }
[ "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", ".", "getColumnName", "(", ")", ";", "// need to protect the column if it contains a quote", "if", "(", "header", ".", "indexOf", "(", "columnQuote", ")", ">=", "0", ")", "{", "writeQuoted", "(", "sb", ",", "header", ")", ";", "continue", ";", "}", "sb", ".", "append", "(", "columnQuote", ")", ";", "sb", ".", "append", "(", "header", ")", ";", "sb", ".", "append", "(", "columnQuote", ")", ";", "}", "if", "(", "appendLineTermination", ")", "{", "sb", ".", "append", "(", "lineTermination", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Build and return a header string made up of quoted column names. @param appendLineTermination Set to true to add the newline to the end of the line.
[ "Build", "and", "return", "a", "header", "string", "made", "up", "of", "quoted", "column", "names", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L480-L504
6,769
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.buildLine
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 { value = columnInfo.getValue(entity); } catch (Exception e) { throw new IllegalStateException("Could not get value from entity field: " + columnInfo); } @SuppressWarnings("unchecked") Converter<Object, Object> castConverter = (Converter<Object, Object>) columnInfo.getConverter(); String str = castConverter.javaToString(columnInfo, value); boolean needsQuotes = columnInfo.isNeedsQuotes(); if (str == null) { if (needsQuotes) { sb.append(columnQuote).append(columnQuote); } continue; } // need to protect the column if it contains a quote if (str.indexOf(columnQuote) >= 0) { writeQuoted(sb, str); continue; } if (!needsQuotes) { for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (ch == columnSeparator || ch == '\r' || ch == '\n' || ch == '\t' || ch == '\b') { needsQuotes = true; break; } } } if (needsQuotes) { sb.append(columnQuote); } sb.append(str); if (needsQuotes) { sb.append(columnQuote); } } if (appendLineTermination) { sb.append(lineTermination); } return sb.toString(); }
java
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 { value = columnInfo.getValue(entity); } catch (Exception e) { throw new IllegalStateException("Could not get value from entity field: " + columnInfo); } @SuppressWarnings("unchecked") Converter<Object, Object> castConverter = (Converter<Object, Object>) columnInfo.getConverter(); String str = castConverter.javaToString(columnInfo, value); boolean needsQuotes = columnInfo.isNeedsQuotes(); if (str == null) { if (needsQuotes) { sb.append(columnQuote).append(columnQuote); } continue; } // need to protect the column if it contains a quote if (str.indexOf(columnQuote) >= 0) { writeQuoted(sb, str); continue; } if (!needsQuotes) { for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (ch == columnSeparator || ch == '\r' || ch == '\n' || ch == '\t' || ch == '\b') { needsQuotes = true; break; } } } if (needsQuotes) { sb.append(columnQuote); } sb.append(str); if (needsQuotes) { sb.append(columnQuote); } } if (appendLineTermination) { sb.append(lineTermination); } return sb.toString(); }
[ "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", "{", "value", "=", "columnInfo", ".", "getValue", "(", "entity", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not get value from entity field: \"", "+", "columnInfo", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Converter", "<", "Object", ",", "Object", ">", "castConverter", "=", "(", "Converter", "<", "Object", ",", "Object", ">", ")", "columnInfo", ".", "getConverter", "(", ")", ";", "String", "str", "=", "castConverter", ".", "javaToString", "(", "columnInfo", ",", "value", ")", ";", "boolean", "needsQuotes", "=", "columnInfo", ".", "isNeedsQuotes", "(", ")", ";", "if", "(", "str", "==", "null", ")", "{", "if", "(", "needsQuotes", ")", "{", "sb", ".", "append", "(", "columnQuote", ")", ".", "append", "(", "columnQuote", ")", ";", "}", "continue", ";", "}", "// need to protect the column if it contains a quote", "if", "(", "str", ".", "indexOf", "(", "columnQuote", ")", ">=", "0", ")", "{", "writeQuoted", "(", "sb", ",", "str", ")", ";", "continue", ";", "}", "if", "(", "!", "needsQuotes", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "ch", "=", "str", ".", "charAt", "(", "i", ")", ";", "if", "(", "ch", "==", "columnSeparator", "||", "ch", "==", "'", "'", "||", "ch", "==", "'", "'", "||", "ch", "==", "'", "'", "||", "ch", "==", "'", "'", ")", "{", "needsQuotes", "=", "true", ";", "break", ";", "}", "}", "}", "if", "(", "needsQuotes", ")", "{", "sb", ".", "append", "(", "columnQuote", ")", ";", "}", "sb", ".", "append", "(", "str", ")", ";", "if", "(", "needsQuotes", ")", "{", "sb", ".", "append", "(", "columnQuote", ")", ";", "}", "}", "if", "(", "appendLineTermination", ")", "{", "sb", ".", "append", "(", "lineTermination", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Convert the entity into a string of column values. @param appendLineTermination Set to true to add the newline to the end of the line.
[ "Convert", "the", "entity", "into", "a", "string", "of", "column", "values", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L512-L564
6,770
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.extractAndAssignValue
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) { assignParseErrorFields(parseError, columnInfo, columnStr); // either error or no value return; } try { columnInfo.setValue(target, value); } catch (Exception e) { parseError.setErrorType(ErrorType.INTERNAL_ERROR); parseError .setMessage("setting value for field '" + columnInfo.getFieldName() + "' error: " + e.getMessage()); assignParseErrorFields(parseError, columnInfo, columnStr); parseError.setLinePos(linePos); } }
java
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) { assignParseErrorFields(parseError, columnInfo, columnStr); // either error or no value return; } try { columnInfo.setValue(target, value); } catch (Exception e) { parseError.setErrorType(ErrorType.INTERNAL_ERROR); parseError .setMessage("setting value for field '" + columnInfo.getFieldName() + "' error: " + e.getMessage()); assignParseErrorFields(parseError, columnInfo, columnStr); parseError.setLinePos(linePos); } }
[ "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", ")", "{", "assignParseErrorFields", "(", "parseError", ",", "columnInfo", ",", "columnStr", ")", ";", "// either error or no value", "return", ";", "}", "try", "{", "columnInfo", ".", "setValue", "(", "target", ",", "value", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "parseError", ".", "setErrorType", "(", "ErrorType", ".", "INTERNAL_ERROR", ")", ";", "parseError", ".", "setMessage", "(", "\"setting value for field '\"", "+", "columnInfo", ".", "getFieldName", "(", ")", "+", "\"' error: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "assignParseErrorFields", "(", "parseError", ",", "columnInfo", ",", "columnStr", ")", ";", "parseError", ".", "setLinePos", "(", "linePos", ")", ";", "}", "}" ]
Extract a value from the line, convert it into its java equivalent, and assign it to our target object.
[ "Extract", "a", "value", "from", "the", "line", "convert", "it", "into", "its", "java", "equivalent", "and", "assign", "it", "to", "our", "target", "object", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L1418-L1435
6,771
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.extractValue
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.isAlwaysTrimInput()) { columnStr = columnStr.trim(); } if (columnStr.isEmpty() && columnInfo.getDefaultValue() != null) { columnStr = columnInfo.getDefaultValue(); } if (columnStr.isEmpty() && columnInfo.isMustNotBeBlank()) { parseError.setErrorType(ErrorType.MUST_NOT_BE_BLANK); parseError.setMessage("field '" + columnInfo.getFieldName() + "' must not be blank"); assignParseErrorFields(parseError, columnInfo, columnStr); parseError.setLinePos(linePos); return null; } try { return converter.stringToJava(line, lineNumber, linePos, columnInfo, columnStr, parseError); } catch (ParseException e) { parseError.setErrorType(ErrorType.INVALID_FORMAT); parseError.setMessage("field '" + columnInfo.getFieldName() + "' parse-error: " + e.getMessage()); parseError.setLinePos(linePos); return null; } catch (Exception e) { parseError.setErrorType(ErrorType.INTERNAL_ERROR); parseError.setMessage("field '" + columnInfo.getFieldName() + "' error: " + e.getMessage()); parseError.setLinePos(linePos); return null; } }
java
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.isAlwaysTrimInput()) { columnStr = columnStr.trim(); } if (columnStr.isEmpty() && columnInfo.getDefaultValue() != null) { columnStr = columnInfo.getDefaultValue(); } if (columnStr.isEmpty() && columnInfo.isMustNotBeBlank()) { parseError.setErrorType(ErrorType.MUST_NOT_BE_BLANK); parseError.setMessage("field '" + columnInfo.getFieldName() + "' must not be blank"); assignParseErrorFields(parseError, columnInfo, columnStr); parseError.setLinePos(linePos); return null; } try { return converter.stringToJava(line, lineNumber, linePos, columnInfo, columnStr, parseError); } catch (ParseException e) { parseError.setErrorType(ErrorType.INVALID_FORMAT); parseError.setMessage("field '" + columnInfo.getFieldName() + "' parse-error: " + e.getMessage()); parseError.setLinePos(linePos); return null; } catch (Exception e) { parseError.setErrorType(ErrorType.INTERNAL_ERROR); parseError.setMessage("field '" + columnInfo.getFieldName() + "' error: " + e.getMessage()); parseError.setLinePos(linePos); return null; } }
[ "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", ".", "isAlwaysTrimInput", "(", ")", ")", "{", "columnStr", "=", "columnStr", ".", "trim", "(", ")", ";", "}", "if", "(", "columnStr", ".", "isEmpty", "(", ")", "&&", "columnInfo", ".", "getDefaultValue", "(", ")", "!=", "null", ")", "{", "columnStr", "=", "columnInfo", ".", "getDefaultValue", "(", ")", ";", "}", "if", "(", "columnStr", ".", "isEmpty", "(", ")", "&&", "columnInfo", ".", "isMustNotBeBlank", "(", ")", ")", "{", "parseError", ".", "setErrorType", "(", "ErrorType", ".", "MUST_NOT_BE_BLANK", ")", ";", "parseError", ".", "setMessage", "(", "\"field '\"", "+", "columnInfo", ".", "getFieldName", "(", ")", "+", "\"' must not be blank\"", ")", ";", "assignParseErrorFields", "(", "parseError", ",", "columnInfo", ",", "columnStr", ")", ";", "parseError", ".", "setLinePos", "(", "linePos", ")", ";", "return", "null", ";", "}", "try", "{", "return", "converter", ".", "stringToJava", "(", "line", ",", "lineNumber", ",", "linePos", ",", "columnInfo", ",", "columnStr", ",", "parseError", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "parseError", ".", "setErrorType", "(", "ErrorType", ".", "INVALID_FORMAT", ")", ";", "parseError", ".", "setMessage", "(", "\"field '\"", "+", "columnInfo", ".", "getFieldName", "(", ")", "+", "\"' parse-error: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "parseError", ".", "setLinePos", "(", "linePos", ")", ";", "return", "null", ";", "}", "catch", "(", "Exception", "e", ")", "{", "parseError", ".", "setErrorType", "(", "ErrorType", ".", "INTERNAL_ERROR", ")", ";", "parseError", ".", "setMessage", "(", "\"field '\"", "+", "columnInfo", ".", "getFieldName", "(", ")", "+", "\"' error: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "parseError", ".", "setLinePos", "(", "linePos", ")", ";", "return", "null", ";", "}", "}" ]
Extract a value from the line and convert it into its java equivalent.
[ "Extract", "a", "value", "from", "the", "line", "and", "convert", "it", "into", "its", "java", "equivalent", "." ]
964fe53073c43e2a311341e3f8fd2c94372f60cb
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L1440-L1471
6,772
roskart/dropwizard-jaxws
dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/ClientBuilder.java
ClientBuilder.handlers
public ClientBuilder<T> handlers(Handler... handlers) { this.handlers = ImmutableList.<Handler>builder().add(handlers).build(); return this; }
java
public ClientBuilder<T> handlers(Handler... handlers) { this.handlers = ImmutableList.<Handler>builder().add(handlers).build(); return this; }
[ "public", "ClientBuilder", "<", "T", ">", "handlers", "(", "Handler", "...", "handlers", ")", "{", "this", ".", "handlers", "=", "ImmutableList", ".", "<", "Handler", ">", "builder", "(", ")", ".", "add", "(", "handlers", ")", ".", "build", "(", ")", ";", "return", "this", ";", "}" ]
Add client side JAX-WS handlers. @param handlers JAX-WS handlers. @return ClientBuilder instance.
[ "Add", "client", "side", "JAX", "-", "WS", "handlers", "." ]
972eb63ba9626f3282d4a1d6127dc2b60b28f2bc
https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/ClientBuilder.java#L85-L88
6,773
stokito/gag
gag-agent/src/main/java/com/github/stokito/gag/agent/GagTransformer.java
GagTransformer.premain
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.addTransformer(transformer); }
java
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.addTransformer(transformer); }
[ "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", ".", "addTransformer", "(", "transformer", ")", ";", "}" ]
An instrumentation agent needs to have a premain method.
[ "An", "instrumentation", "agent", "needs", "to", "have", "a", "premain", "method", "." ]
a09cc41e499307aba88c0169d1eb4a2b1a65a161
https://github.com/stokito/gag/blob/a09cc41e499307aba88c0169d1eb4a2b1a65a161/gag-agent/src/main/java/com/github/stokito/gag/agent/GagTransformer.java#L62-L72
6,774
bartprokop/rxtx
src/main/java/gnu/io/RXTXCommDriver.java
RXTXCommDriver.initialize
@Override public void initialize() { deviceDirectory = getDeviceDirectory(); /* First try to register ports specified in the properties file. If that doesn't exist, then scan for ports. */ for (int PortType = CommPortIdentifier.PORT_SERIAL; PortType <= CommPortIdentifier.PORT_PARALLEL; PortType++) { if (!registerSpecifiedPorts(PortType)) { if (!registerKnownPorts(PortType)) { registerScannedPorts(PortType); } } } }
java
@Override public void initialize() { deviceDirectory = getDeviceDirectory(); /* First try to register ports specified in the properties file. If that doesn't exist, then scan for ports. */ for (int PortType = CommPortIdentifier.PORT_SERIAL; PortType <= CommPortIdentifier.PORT_PARALLEL; PortType++) { if (!registerSpecifiedPorts(PortType)) { if (!registerKnownPorts(PortType)) { registerScannedPorts(PortType); } } } }
[ "@", "Override", "public", "void", "initialize", "(", ")", "{", "deviceDirectory", "=", "getDeviceDirectory", "(", ")", ";", "/*\n First try to register ports specified in the properties\n file. If that doesn't exist, then scan for ports.\n */", "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
[ "Determine", "the", "OS", "and", "where", "the", "OS", "has", "the", "devices", "located" ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/RXTXCommDriver.java#L282-L297
6,775
bartprokop/rxtx
src/main/java/gnu/io/CommPortIdentifier.java
CommPortIdentifier.AddIdentifierToList
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 = CommPortIndex; while (index.next != null) { index = index.next; LOGGER.fine("CommPortIdentifier:AddIdentifierToList() index.next"); } index.next = cpi; } } }
java
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 = CommPortIndex; while (index.next != null) { index = index.next; LOGGER.fine("CommPortIdentifier:AddIdentifierToList() index.next"); } index.next = cpi; } } }
[ "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", "=", "CommPortIndex", ";", "while", "(", "index", ".", "next", "!=", "null", ")", "{", "index", "=", "index", ".", "next", ";", "LOGGER", ".", "fine", "(", "\"CommPortIdentifier:AddIdentifierToList() index.next\"", ")", ";", "}", "index", ".", "next", "=", "cpi", ";", "}", "}", "}" ]
by implementing its own linked list functionallity
[ "by", "implementing", "its", "own", "linked", "list", "functionallity" ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/CommPortIdentifier.java#L201-L216
6,776
bartprokop/rxtx
src/main/java/gnu/io/CommPortIdentifier.java
CommPortIdentifier.getPortIdentifier
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 (c); } LOGGER.fine("not found!" + p.getName()); throw new NoSuchPortException(); }
java
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 (c); } LOGGER.fine("not found!" + p.getName()); throw new NoSuchPortException(); }
[ "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", "(", "c", ")", ";", "}", "LOGGER", ".", "fine", "(", "\"not found!\"", "+", "p", ".", "getName", "(", ")", ")", ";", "throw", "new", "NoSuchPortException", "(", ")", ";", "}" ]
Gets communication port identifier @param p - port for which identifier object is returned @return - port identifier object @throws NoSuchPortException - in case the non existing serial port found
[ "Gets", "communication", "port", "identifier" ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/CommPortIdentifier.java#L315-L331
6,777
bartprokop/rxtx
src/main/java/gnu/io/CommPortIdentifier.java
CommPortIdentifier.getPortIdentifiers
static public Enumeration<CommPortIdentifier> getPortIdentifiers() { LOGGER.fine("static CommPortIdentifier:getPortIdentifiers()"); //Do not allow anybody get any ports while we are re-initializing //because the CommPortIndex points to invalid instances during that time synchronized (Sync) { //Remember old ports in order to restore them for ownership events later HashMap oldPorts = new HashMap(); CommPortIdentifier p = CommPortIndex; while (p != null) { oldPorts.put(p.portName, p); p = p.next; } CommPortIndex = null; try { //Initialize RXTX: This leads to detecting all ports //and writing them into our CommPortIndex through our method //{@link #addPortName(java.lang.String, int, gnu.io.CommDriver)} //This works while lock on Sync is held CommDriver RXTXDriver = (CommDriver) Class.forName("gnu.io.RXTXCommDriver").newInstance(); RXTXDriver.initialize(); //Restore old CommPortIdentifier objects where possible, //in order to support proper ownership event handling. //Clients might still have references to old identifiers! CommPortIdentifier curPort = CommPortIndex; CommPortIdentifier prevPort = null; while (curPort != null) { CommPortIdentifier matchingOldPort = (CommPortIdentifier) oldPorts.get(curPort.portName); if (matchingOldPort != null && matchingOldPort.portType == curPort.portType) { //replace new port by old one matchingOldPort.RXTXDriver = curPort.RXTXDriver; matchingOldPort.next = curPort.next; if (prevPort == null) { CommPortIndex = matchingOldPort; } else { prevPort.next = matchingOldPort; } prevPort = matchingOldPort; } else { prevPort = curPort; } curPort = curPort.next; } } catch (Throwable e) { System.err.println(e + " thrown while loading " + "gnu.io.RXTXCommDriver"); System.err.flush(); } } return new CommPortEnumerator(); }
java
static public Enumeration<CommPortIdentifier> getPortIdentifiers() { LOGGER.fine("static CommPortIdentifier:getPortIdentifiers()"); //Do not allow anybody get any ports while we are re-initializing //because the CommPortIndex points to invalid instances during that time synchronized (Sync) { //Remember old ports in order to restore them for ownership events later HashMap oldPorts = new HashMap(); CommPortIdentifier p = CommPortIndex; while (p != null) { oldPorts.put(p.portName, p); p = p.next; } CommPortIndex = null; try { //Initialize RXTX: This leads to detecting all ports //and writing them into our CommPortIndex through our method //{@link #addPortName(java.lang.String, int, gnu.io.CommDriver)} //This works while lock on Sync is held CommDriver RXTXDriver = (CommDriver) Class.forName("gnu.io.RXTXCommDriver").newInstance(); RXTXDriver.initialize(); //Restore old CommPortIdentifier objects where possible, //in order to support proper ownership event handling. //Clients might still have references to old identifiers! CommPortIdentifier curPort = CommPortIndex; CommPortIdentifier prevPort = null; while (curPort != null) { CommPortIdentifier matchingOldPort = (CommPortIdentifier) oldPorts.get(curPort.portName); if (matchingOldPort != null && matchingOldPort.portType == curPort.portType) { //replace new port by old one matchingOldPort.RXTXDriver = curPort.RXTXDriver; matchingOldPort.next = curPort.next; if (prevPort == null) { CommPortIndex = matchingOldPort; } else { prevPort.next = matchingOldPort; } prevPort = matchingOldPort; } else { prevPort = curPort; } curPort = curPort.next; } } catch (Throwable e) { System.err.println(e + " thrown while loading " + "gnu.io.RXTXCommDriver"); System.err.flush(); } } return new CommPortEnumerator(); }
[ "static", "public", "Enumeration", "<", "CommPortIdentifier", ">", "getPortIdentifiers", "(", ")", "{", "LOGGER", ".", "fine", "(", "\"static CommPortIdentifier:getPortIdentifiers()\"", ")", ";", "//Do not allow anybody get any ports while we are re-initializing", "//because the CommPortIndex points to invalid instances during that time", "synchronized", "(", "Sync", ")", "{", "//Remember old ports in order to restore them for ownership events later", "HashMap", "oldPorts", "=", "new", "HashMap", "(", ")", ";", "CommPortIdentifier", "p", "=", "CommPortIndex", ";", "while", "(", "p", "!=", "null", ")", "{", "oldPorts", ".", "put", "(", "p", ".", "portName", ",", "p", ")", ";", "p", "=", "p", ".", "next", ";", "}", "CommPortIndex", "=", "null", ";", "try", "{", "//Initialize RXTX: This leads to detecting all ports", "//and writing them into our CommPortIndex through our method", "//{@link #addPortName(java.lang.String, int, gnu.io.CommDriver)}", "//This works while lock on Sync is held", "CommDriver", "RXTXDriver", "=", "(", "CommDriver", ")", "Class", ".", "forName", "(", "\"gnu.io.RXTXCommDriver\"", ")", ".", "newInstance", "(", ")", ";", "RXTXDriver", ".", "initialize", "(", ")", ";", "//Restore old CommPortIdentifier objects where possible, ", "//in order to support proper ownership event handling.", "//Clients might still have references to old identifiers!", "CommPortIdentifier", "curPort", "=", "CommPortIndex", ";", "CommPortIdentifier", "prevPort", "=", "null", ";", "while", "(", "curPort", "!=", "null", ")", "{", "CommPortIdentifier", "matchingOldPort", "=", "(", "CommPortIdentifier", ")", "oldPorts", ".", "get", "(", "curPort", ".", "portName", ")", ";", "if", "(", "matchingOldPort", "!=", "null", "&&", "matchingOldPort", ".", "portType", "==", "curPort", ".", "portType", ")", "{", "//replace new port by old one", "matchingOldPort", ".", "RXTXDriver", "=", "curPort", ".", "RXTXDriver", ";", "matchingOldPort", ".", "next", "=", "curPort", ".", "next", ";", "if", "(", "prevPort", "==", "null", ")", "{", "CommPortIndex", "=", "matchingOldPort", ";", "}", "else", "{", "prevPort", ".", "next", "=", "matchingOldPort", ";", "}", "prevPort", "=", "matchingOldPort", ";", "}", "else", "{", "prevPort", "=", "curPort", ";", "}", "curPort", "=", "curPort", ".", "next", ";", "}", "}", "catch", "(", "Throwable", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", "+", "\" thrown while loading \"", "+", "\"gnu.io.RXTXCommDriver\"", ")", ";", "System", ".", "err", ".", "flush", "(", ")", ";", "}", "}", "return", "new", "CommPortEnumerator", "(", ")", ";", "}" ]
Returns an enumeration of port identifiers which represent the communication ports currently available on the system. @return enumeration of available communication ports
[ "Returns", "an", "enumeration", "of", "port", "identifiers", "which", "represent", "the", "communication", "ports", "currently", "available", "on", "the", "system", "." ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/CommPortIdentifier.java#L339-L389
6,778
bartprokop/rxtx
src/main/java/gnu/io/CommPortIdentifier.java
CommPortIdentifier.open
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) { //assume ownership inside the synchronized block this.Available = false; this.Owner = TheOwner; } } if (!isAvailable) { long waitTimeEnd = System.currentTimeMillis() + i; //fire the ownership event outside the synchronized block fireOwnershipEvent(CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); long waitTimeCurr; synchronized (this) { while (!Available && (waitTimeCurr = System.currentTimeMillis()) < waitTimeEnd) { try { wait(waitTimeEnd - waitTimeCurr); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } } isAvailable = this.Available; if (isAvailable) { //assume ownership inside the synchronized block this.Available = false; this.Owner = TheOwner; } } } if (!isAvailable) { throw new gnu.io.PortInUseException(getCurrentOwner()); } //At this point, the CommPortIdentifier is owned by us. try { if (commPort == null) { commPort = RXTXDriver.getCommPort(portName, portType); } if (commPort != null) { fireOwnershipEvent(CommPortOwnershipListener.PORT_OWNED); return commPort; } else { String err_msg; try { err_msg = native_psmisc_report_owner(portName); } catch (Throwable t) { err_msg = "Port " + portName + " already owned... unable to open."; } throw new gnu.io.PortInUseException(err_msg); } } finally { if (commPort == null) { //something went wrong reserving the commport -> unown the port synchronized (this) { this.Available = true; this.Owner = null; } } } }
java
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) { //assume ownership inside the synchronized block this.Available = false; this.Owner = TheOwner; } } if (!isAvailable) { long waitTimeEnd = System.currentTimeMillis() + i; //fire the ownership event outside the synchronized block fireOwnershipEvent(CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); long waitTimeCurr; synchronized (this) { while (!Available && (waitTimeCurr = System.currentTimeMillis()) < waitTimeEnd) { try { wait(waitTimeEnd - waitTimeCurr); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } } isAvailable = this.Available; if (isAvailable) { //assume ownership inside the synchronized block this.Available = false; this.Owner = TheOwner; } } } if (!isAvailable) { throw new gnu.io.PortInUseException(getCurrentOwner()); } //At this point, the CommPortIdentifier is owned by us. try { if (commPort == null) { commPort = RXTXDriver.getCommPort(portName, portType); } if (commPort != null) { fireOwnershipEvent(CommPortOwnershipListener.PORT_OWNED); return commPort; } else { String err_msg; try { err_msg = native_psmisc_report_owner(portName); } catch (Throwable t) { err_msg = "Port " + portName + " already owned... unable to open."; } throw new gnu.io.PortInUseException(err_msg); } } finally { if (commPort == null) { //something went wrong reserving the commport -> unown the port synchronized (this) { this.Available = true; this.Owner = null; } } } }
[ "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", ")", "{", "//assume ownership inside the synchronized block", "this", ".", "Available", "=", "false", ";", "this", ".", "Owner", "=", "TheOwner", ";", "}", "}", "if", "(", "!", "isAvailable", ")", "{", "long", "waitTimeEnd", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "i", ";", "//fire the ownership event outside the synchronized block", "fireOwnershipEvent", "(", "CommPortOwnershipListener", ".", "PORT_OWNERSHIP_REQUESTED", ")", ";", "long", "waitTimeCurr", ";", "synchronized", "(", "this", ")", "{", "while", "(", "!", "Available", "&&", "(", "waitTimeCurr", "=", "System", ".", "currentTimeMillis", "(", ")", ")", "<", "waitTimeEnd", ")", "{", "try", "{", "wait", "(", "waitTimeEnd", "-", "waitTimeCurr", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "break", ";", "}", "}", "isAvailable", "=", "this", ".", "Available", ";", "if", "(", "isAvailable", ")", "{", "//assume ownership inside the synchronized block", "this", ".", "Available", "=", "false", ";", "this", ".", "Owner", "=", "TheOwner", ";", "}", "}", "}", "if", "(", "!", "isAvailable", ")", "{", "throw", "new", "gnu", ".", "io", ".", "PortInUseException", "(", "getCurrentOwner", "(", ")", ")", ";", "}", "//At this point, the CommPortIdentifier is owned by us.", "try", "{", "if", "(", "commPort", "==", "null", ")", "{", "commPort", "=", "RXTXDriver", ".", "getCommPort", "(", "portName", ",", "portType", ")", ";", "}", "if", "(", "commPort", "!=", "null", ")", "{", "fireOwnershipEvent", "(", "CommPortOwnershipListener", ".", "PORT_OWNED", ")", ";", "return", "commPort", ";", "}", "else", "{", "String", "err_msg", ";", "try", "{", "err_msg", "=", "native_psmisc_report_owner", "(", "portName", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "err_msg", "=", "\"Port \"", "+", "portName", "+", "\" already owned... unable to open.\"", ";", "}", "throw", "new", "gnu", ".", "io", ".", "PortInUseException", "(", "err_msg", ")", ";", "}", "}", "finally", "{", "if", "(", "commPort", "==", "null", ")", "{", "//something went wrong reserving the commport -> unown the port", "synchronized", "(", "this", ")", "{", "this", ".", "Available", "=", "true", ";", "this", ".", "Owner", "=", "null", ";", "}", "}", "}", "}" ]
not written in java? I can't see where this request is done.
[ "not", "written", "in", "java?", "I", "can", "t", "see", "where", "this", "request", "is", "done", "." ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/CommPortIdentifier.java#L457-L521
6,779
bartprokop/rxtx
src/main/java/gnu/io/CommPortIdentifier.java
CommPortIdentifier.removePortOwnershipListener
public void removePortOwnershipListener(CommPortOwnershipListener c) { LOGGER.fine("CommPortIdentifier:removePortOwnershipListener()"); /* why is this called twice? */ if (ownershipListener != null) { ownershipListener.removeElement(c); } }
java
public void removePortOwnershipListener(CommPortOwnershipListener c) { LOGGER.fine("CommPortIdentifier:removePortOwnershipListener()"); /* why is this called twice? */ if (ownershipListener != null) { ownershipListener.removeElement(c); } }
[ "public", "void", "removePortOwnershipListener", "(", "CommPortOwnershipListener", "c", ")", "{", "LOGGER", ".", "fine", "(", "\"CommPortIdentifier:removePortOwnershipListener()\"", ")", ";", "/* why is this called twice? */", "if", "(", "ownershipListener", "!=", "null", ")", "{", "ownershipListener", ".", "removeElement", "(", "c", ")", ";", "}", "}" ]
removes PortOwnership listener @param c - listener to remove
[ "removes", "PortOwnership", "listener" ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/CommPortIdentifier.java#L528-L534
6,780
bartprokop/rxtx
src/main/java/gnu/io/CommPortIdentifier.java
CommPortIdentifier.internalClosePort
void internalClosePort() { synchronized (this) { LOGGER.fine("CommPortIdentifier:internalClosePort()"); Owner = null; Available = true; // TODO (by Alexander Graf) to set the commPort to null is // incompatible with the idea behind the architecture of the // constructor, where commPort is assigned by the driver once // in a virtual machines lifetime. commPort = null; /* this tosses null pointer?? */ notifyAll(); } fireOwnershipEvent(CommPortOwnershipListener.PORT_UNOWNED); }
java
void internalClosePort() { synchronized (this) { LOGGER.fine("CommPortIdentifier:internalClosePort()"); Owner = null; Available = true; // TODO (by Alexander Graf) to set the commPort to null is // incompatible with the idea behind the architecture of the // constructor, where commPort is assigned by the driver once // in a virtual machines lifetime. commPort = null; /* this tosses null pointer?? */ notifyAll(); } fireOwnershipEvent(CommPortOwnershipListener.PORT_UNOWNED); }
[ "void", "internalClosePort", "(", ")", "{", "synchronized", "(", "this", ")", "{", "LOGGER", ".", "fine", "(", "\"CommPortIdentifier:internalClosePort()\"", ")", ";", "Owner", "=", "null", ";", "Available", "=", "true", ";", "// TODO (by Alexander Graf) to set the commPort to null is", "// incompatible with the idea behind the architecture of the", "// constructor, where commPort is assigned by the driver once", "// in a virtual machines lifetime.", "commPort", "=", "null", ";", "/* this tosses null pointer?? */", "notifyAll", "(", ")", ";", "}", "fireOwnershipEvent", "(", "CommPortOwnershipListener", ".", "PORT_UNOWNED", ")", ";", "}" ]
clean up the Ownership information and send the event
[ "clean", "up", "the", "Ownership", "information", "and", "send", "the", "event" ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/CommPortIdentifier.java#L539-L553
6,781
bartprokop/rxtx
src/main/java/gnu/io/RXTXPort.java
RXTXPort.removeEventListener
public void removeEventListener() { logger.fine("RXTXPort:removeEventListener() called"); waitForTheNativeCodeSilly(); //if( monThread != null && monThread.isAlive() ) if (monThreadisInterrupted == true) { logger.fine(" RXTXPort:removeEventListener() already interrupted"); monThread = null; SPEventListener = null; return; } else if (monThread != null && monThread.isAlive()) { logger.fine(" RXTXPort:Interrupt=true"); monThreadisInterrupted = true; /* Notify all threads in this PID that something is up They will call back to see if its their thread using isInterrupted(). */ logger.fine(" RXTXPort:calling interruptEventLoop"); interruptEventLoop(); logger.fine(" RXTXPort:calling monThread.join()"); try { // wait a reasonable moment for the death of the monitor thread monThread.join(3000); } catch (InterruptedException ex) { // somebody called interrupt() on us (ie wants us to abort) // we dont propagate InterruptedExceptions so lets re-set the flag Thread.currentThread().interrupt(); return; } { logger.fine(" MonThread is still alive!"); } } monThread = null; SPEventListener = null; MonitorThreadLock = false; MonitorThreadAlive = false; monThreadisInterrupted = true; logger.fine("RXTXPort:removeEventListener() returning"); }
java
public void removeEventListener() { logger.fine("RXTXPort:removeEventListener() called"); waitForTheNativeCodeSilly(); //if( monThread != null && monThread.isAlive() ) if (monThreadisInterrupted == true) { logger.fine(" RXTXPort:removeEventListener() already interrupted"); monThread = null; SPEventListener = null; return; } else if (monThread != null && monThread.isAlive()) { logger.fine(" RXTXPort:Interrupt=true"); monThreadisInterrupted = true; /* Notify all threads in this PID that something is up They will call back to see if its their thread using isInterrupted(). */ logger.fine(" RXTXPort:calling interruptEventLoop"); interruptEventLoop(); logger.fine(" RXTXPort:calling monThread.join()"); try { // wait a reasonable moment for the death of the monitor thread monThread.join(3000); } catch (InterruptedException ex) { // somebody called interrupt() on us (ie wants us to abort) // we dont propagate InterruptedExceptions so lets re-set the flag Thread.currentThread().interrupt(); return; } { logger.fine(" MonThread is still alive!"); } } monThread = null; SPEventListener = null; MonitorThreadLock = false; MonitorThreadAlive = false; monThreadisInterrupted = true; logger.fine("RXTXPort:removeEventListener() returning"); }
[ "public", "void", "removeEventListener", "(", ")", "{", "logger", ".", "fine", "(", "\"RXTXPort:removeEventListener() called\"", ")", ";", "waitForTheNativeCodeSilly", "(", ")", ";", "//if( monThread != null && monThread.isAlive() )", "if", "(", "monThreadisInterrupted", "==", "true", ")", "{", "logger", ".", "fine", "(", "\"\tRXTXPort:removeEventListener() already interrupted\"", ")", ";", "monThread", "=", "null", ";", "SPEventListener", "=", "null", ";", "return", ";", "}", "else", "if", "(", "monThread", "!=", "null", "&&", "monThread", ".", "isAlive", "(", ")", ")", "{", "logger", ".", "fine", "(", "\"\tRXTXPort:Interrupt=true\"", ")", ";", "monThreadisInterrupted", "=", "true", ";", "/*\n Notify all threads in this PID that something is up\n They will call back to see if its their thread\n using isInterrupted().\n */", "logger", ".", "fine", "(", "\"\tRXTXPort:calling interruptEventLoop\"", ")", ";", "interruptEventLoop", "(", ")", ";", "logger", ".", "fine", "(", "\"\tRXTXPort:calling monThread.join()\"", ")", ";", "try", "{", "// wait a reasonable moment for the death of the monitor thread", "monThread", ".", "join", "(", "3000", ")", ";", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "// somebody called interrupt() on us (ie wants us to abort)", "// we dont propagate InterruptedExceptions so lets re-set the flag ", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "return", ";", "}", "{", "logger", ".", "fine", "(", "\"\tMonThread is still alive!\"", ")", ";", "}", "}", "monThread", "=", "null", ";", "SPEventListener", "=", "null", ";", "MonitorThreadLock", "=", "false", ";", "MonitorThreadAlive", "=", "false", ";", "monThreadisInterrupted", "=", "true", ";", "logger", ".", "fine", "(", "\"RXTXPort:removeEventListener() returning\"", ")", ";", "}" ]
Remove the serial port event listener
[ "Remove", "the", "serial", "port", "event", "listener" ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/RXTXPort.java#L829-L876
6,782
bartprokop/rxtx
src/main/java/name/prokop/bart/rxtx/Demo1.java
Demo1.getSerialPortList
public static String[] getSerialPortList() { Enumeration portList; portList = CommPortIdentifier.getPortIdentifiers(); int serialPortCount = 0; while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { serialPortCount++; } } String[] retVal = new String[serialPortCount]; serialPortCount = 0; portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { retVal[serialPortCount++] = portId.getName(); } } return retVal; }
java
public static String[] getSerialPortList() { Enumeration portList; portList = CommPortIdentifier.getPortIdentifiers(); int serialPortCount = 0; while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { serialPortCount++; } } String[] retVal = new String[serialPortCount]; serialPortCount = 0; portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { retVal[serialPortCount++] = portId.getName(); } } return retVal; }
[ "public", "static", "String", "[", "]", "getSerialPortList", "(", ")", "{", "Enumeration", "portList", ";", "portList", "=", "CommPortIdentifier", ".", "getPortIdentifiers", "(", ")", ";", "int", "serialPortCount", "=", "0", ";", "while", "(", "portList", ".", "hasMoreElements", "(", ")", ")", "{", "CommPortIdentifier", "portId", "=", "(", "CommPortIdentifier", ")", "portList", ".", "nextElement", "(", ")", ";", "if", "(", "portId", ".", "getPortType", "(", ")", "==", "CommPortIdentifier", ".", "PORT_SERIAL", ")", "{", "serialPortCount", "++", ";", "}", "}", "String", "[", "]", "retVal", "=", "new", "String", "[", "serialPortCount", "]", ";", "serialPortCount", "=", "0", ";", "portList", "=", "CommPortIdentifier", ".", "getPortIdentifiers", "(", ")", ";", "while", "(", "portList", ".", "hasMoreElements", "(", ")", ")", "{", "CommPortIdentifier", "portId", "=", "(", "CommPortIdentifier", ")", "portList", ".", "nextElement", "(", ")", ";", "if", "(", "portId", ".", "getPortType", "(", ")", "==", "CommPortIdentifier", ".", "PORT_SERIAL", ")", "{", "retVal", "[", "serialPortCount", "++", "]", "=", "portId", ".", "getName", "(", ")", ";", "}", "}", "return", "retVal", ";", "}" ]
Zwraca liste portow szeregowych @return Zwraca liste portow szeregowych. Zwracana jest tablica string�w. Stringi te mo�na u�y� w funkcji getSerialPort
[ "Zwraca", "liste", "portow", "szeregowych" ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/name/prokop/bart/rxtx/Demo1.java#L83-L107
6,783
bartprokop/rxtx
src/main/java/name/prokop/bart/rxtx/Demo1.java
Demo1.getParallelPortList
public static String[] getParallelPortList() { Enumeration portList; portList = CommPortIdentifier.getPortIdentifiers(); int serialPortCount = 0; while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_PARALLEL) { serialPortCount++; } } String[] retVal = new String[serialPortCount]; serialPortCount = 0; portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_PARALLEL) { retVal[serialPortCount++] = portId.getName(); } } return retVal; }
java
public static String[] getParallelPortList() { Enumeration portList; portList = CommPortIdentifier.getPortIdentifiers(); int serialPortCount = 0; while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_PARALLEL) { serialPortCount++; } } String[] retVal = new String[serialPortCount]; serialPortCount = 0; portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_PARALLEL) { retVal[serialPortCount++] = portId.getName(); } } return retVal; }
[ "public", "static", "String", "[", "]", "getParallelPortList", "(", ")", "{", "Enumeration", "portList", ";", "portList", "=", "CommPortIdentifier", ".", "getPortIdentifiers", "(", ")", ";", "int", "serialPortCount", "=", "0", ";", "while", "(", "portList", ".", "hasMoreElements", "(", ")", ")", "{", "CommPortIdentifier", "portId", "=", "(", "CommPortIdentifier", ")", "portList", ".", "nextElement", "(", ")", ";", "if", "(", "portId", ".", "getPortType", "(", ")", "==", "CommPortIdentifier", ".", "PORT_PARALLEL", ")", "{", "serialPortCount", "++", ";", "}", "}", "String", "[", "]", "retVal", "=", "new", "String", "[", "serialPortCount", "]", ";", "serialPortCount", "=", "0", ";", "portList", "=", "CommPortIdentifier", ".", "getPortIdentifiers", "(", ")", ";", "while", "(", "portList", ".", "hasMoreElements", "(", ")", ")", "{", "CommPortIdentifier", "portId", "=", "(", "CommPortIdentifier", ")", "portList", ".", "nextElement", "(", ")", ";", "if", "(", "portId", ".", "getPortType", "(", ")", "==", "CommPortIdentifier", ".", "PORT_PARALLEL", ")", "{", "retVal", "[", "serialPortCount", "++", "]", "=", "portId", ".", "getName", "(", ")", ";", "}", "}", "return", "retVal", ";", "}" ]
Zwraca liste portow rownoleglych @return Zwraca liste portow rownoleglych
[ "Zwraca", "liste", "portow", "rownoleglych" ]
7b2c7857c262743e9dd15e9779c880b93c650890
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/name/prokop/bart/rxtx/Demo1.java#L114-L138
6,784
motown-io/motown
ocpi/ocpi-identification-authorization-plugin/src/main/java/io/motown/ocpi/persistence/repository/OcpiRepository.java
OcpiRepository.getTokenSyncDate
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) .setParameter("subscriptionId", subscriptionId) .getResultList(); if (!list.isEmpty()) { return list.get(0); } return null; } finally { entityManager.close(); } }
java
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) .setParameter("subscriptionId", subscriptionId) .getResultList(); if (!list.isEmpty()) { return list.get(0); } return null; } finally { entityManager.close(); } }
[ "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", ")", ".", "setParameter", "(", "\"subscriptionId\"", ",", "subscriptionId", ")", ".", "getResultList", "(", ")", ";", "if", "(", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "return", "list", ".", "get", "(", "0", ")", ";", "}", "return", "null", ";", "}", "finally", "{", "entityManager", ".", "close", "(", ")", ";", "}", "}" ]
get the date the tokens where last synced for the subscriptionId passed as argument getTokenSyncDate @param subscriptionId @return
[ "get", "the", "date", "the", "tokens", "where", "last", "synced", "for", "the", "subscriptionId", "passed", "as", "argument" ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpi/ocpi-identification-authorization-plugin/src/main/java/io/motown/ocpi/persistence/repository/OcpiRepository.java#L165-L180
6,785
motown-io/motown
ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/OcppJsonService.java
OcppJsonService.changeConfiguration
public void changeConfiguration(ChargingStationId chargingStationId, ConfigurationItem configurationItem, CorrelationToken correlationToken) { Changeconfiguration changeConfigurationRequest = new Changeconfiguration(); changeConfigurationRequest.setKey(configurationItem.getKey()); changeConfigurationRequest.setValue(configurationItem.getValue()); responseHandlers.put(correlationToken.getToken(), new ChangeConfigurationResponseHandler(configurationItem, correlationToken)); WampMessage wampMessage = new WampMessage(WampMessage.CALL, correlationToken.getToken(), MessageProcUri.CHANGE_CONFIGURATION, changeConfigurationRequest); sendWampMessage(wampMessage, chargingStationId); }
java
public void changeConfiguration(ChargingStationId chargingStationId, ConfigurationItem configurationItem, CorrelationToken correlationToken) { Changeconfiguration changeConfigurationRequest = new Changeconfiguration(); changeConfigurationRequest.setKey(configurationItem.getKey()); changeConfigurationRequest.setValue(configurationItem.getValue()); responseHandlers.put(correlationToken.getToken(), new ChangeConfigurationResponseHandler(configurationItem, correlationToken)); WampMessage wampMessage = new WampMessage(WampMessage.CALL, correlationToken.getToken(), MessageProcUri.CHANGE_CONFIGURATION, changeConfigurationRequest); sendWampMessage(wampMessage, chargingStationId); }
[ "public", "void", "changeConfiguration", "(", "ChargingStationId", "chargingStationId", ",", "ConfigurationItem", "configurationItem", ",", "CorrelationToken", "correlationToken", ")", "{", "Changeconfiguration", "changeConfigurationRequest", "=", "new", "Changeconfiguration", "(", ")", ";", "changeConfigurationRequest", ".", "setKey", "(", "configurationItem", ".", "getKey", "(", ")", ")", ";", "changeConfigurationRequest", ".", "setValue", "(", "configurationItem", ".", "getValue", "(", ")", ")", ";", "responseHandlers", ".", "put", "(", "correlationToken", ".", "getToken", "(", ")", ",", "new", "ChangeConfigurationResponseHandler", "(", "configurationItem", ",", "correlationToken", ")", ")", ";", "WampMessage", "wampMessage", "=", "new", "WampMessage", "(", "WampMessage", ".", "CALL", ",", "correlationToken", ".", "getToken", "(", ")", ",", "MessageProcUri", ".", "CHANGE_CONFIGURATION", ",", "changeConfigurationRequest", ")", ";", "sendWampMessage", "(", "wampMessage", ",", "chargingStationId", ")", ";", "}" ]
Send a request to a charging station to change a configuration item. @param chargingStationId the charging station's id. @param configurationItem the configuration item to change. @param correlationToken the token to correlate commands and events that belong together.
[ "Send", "a", "request", "to", "a", "charging", "station", "to", "change", "a", "configuration", "item", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/OcppJsonService.java#L111-L120
6,786
motown-io/motown
ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/OcppJsonService.java
OcppJsonService.convertAuthenticationStatus
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 = IdTagInfo_.Status.EXPIRED; break; case CONCURRENT_TX: result = IdTagInfo_.Status.CONCURRENT_TX; break; case BLOCKED: result = IdTagInfo_.Status.BLOCKED; break; default: result = IdTagInfo_.Status.INVALID; break; } return result; }
java
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 = IdTagInfo_.Status.EXPIRED; break; case CONCURRENT_TX: result = IdTagInfo_.Status.CONCURRENT_TX; break; case BLOCKED: result = IdTagInfo_.Status.BLOCKED; break; default: result = IdTagInfo_.Status.INVALID; break; } return result; }
[ "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", "=", "IdTagInfo_", ".", "Status", ".", "EXPIRED", ";", "break", ";", "case", "CONCURRENT_TX", ":", "result", "=", "IdTagInfo_", ".", "Status", ".", "CONCURRENT_TX", ";", "break", ";", "case", "BLOCKED", ":", "result", "=", "IdTagInfo_", ".", "Status", ".", "BLOCKED", ";", "break", ";", "default", ":", "result", "=", "IdTagInfo_", ".", "Status", ".", "INVALID", ";", "break", ";", "}", "return", "result", ";", "}" ]
Converts the AuthenticationStatus into an OCPPJ specific status @param status the authentication status. @return the OCPP/J status.
[ "Converts", "the", "AuthenticationStatus", "into", "an", "OCPPJ", "specific", "status" ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/OcppJsonService.java#L241-L264
6,787
motown-io/motown
vas/v10-soap/src/main/java/io/motown/vas/v10/soap/VasConversionService.java
VasConversionService.getVasRepresentation
public ChargePoint getVasRepresentation(ChargingStation chargingStation) { ChargePoint chargePoint = new ChargePoint(); chargePoint.setAddress(chargingStation.getAddress()); chargePoint.getChargingCapabilities().addAll(getChargingCapabilities(chargingStation)); chargePoint.setChargingMode(getVasChargingMode(chargingStation.getChargeMode())); chargePoint.setCity(chargingStation.getCity()); chargePoint.setConnectors(chargingStation.getNumberOfEvses()); chargePoint.setConnectorsFree(chargingStation.getNumberOfFreeEvses()); chargePoint.getConnectorTypes().addAll(getConnectorTypes(chargingStation)); chargePoint.setCoordinates(getCoordinates(chargingStation)); chargePoint.setCountry(chargingStation.getCountry()); chargePoint.setHasFixedCable(chargingStation.isHasFixedCable()); chargePoint.setIsReservable(chargingStation.isReservable()); chargePoint.getOpeningPeriod().addAll(getOpeningPeriod(chargingStation)); chargePoint.setOperator(chargingStation.getOperator()); chargePoint.setPostalCode(chargingStation.getPostalCode()); chargePoint.setPublic(getPublic(chargingStation)); chargePoint.setRegion(chargingStation.getRegion()); chargePoint.setStatus(getStatus(chargingStation)); chargePoint.setUid(chargingStation.getId()); return chargePoint; }
java
public ChargePoint getVasRepresentation(ChargingStation chargingStation) { ChargePoint chargePoint = new ChargePoint(); chargePoint.setAddress(chargingStation.getAddress()); chargePoint.getChargingCapabilities().addAll(getChargingCapabilities(chargingStation)); chargePoint.setChargingMode(getVasChargingMode(chargingStation.getChargeMode())); chargePoint.setCity(chargingStation.getCity()); chargePoint.setConnectors(chargingStation.getNumberOfEvses()); chargePoint.setConnectorsFree(chargingStation.getNumberOfFreeEvses()); chargePoint.getConnectorTypes().addAll(getConnectorTypes(chargingStation)); chargePoint.setCoordinates(getCoordinates(chargingStation)); chargePoint.setCountry(chargingStation.getCountry()); chargePoint.setHasFixedCable(chargingStation.isHasFixedCable()); chargePoint.setIsReservable(chargingStation.isReservable()); chargePoint.getOpeningPeriod().addAll(getOpeningPeriod(chargingStation)); chargePoint.setOperator(chargingStation.getOperator()); chargePoint.setPostalCode(chargingStation.getPostalCode()); chargePoint.setPublic(getPublic(chargingStation)); chargePoint.setRegion(chargingStation.getRegion()); chargePoint.setStatus(getStatus(chargingStation)); chargePoint.setUid(chargingStation.getId()); return chargePoint; }
[ "public", "ChargePoint", "getVasRepresentation", "(", "ChargingStation", "chargingStation", ")", "{", "ChargePoint", "chargePoint", "=", "new", "ChargePoint", "(", ")", ";", "chargePoint", ".", "setAddress", "(", "chargingStation", ".", "getAddress", "(", ")", ")", ";", "chargePoint", ".", "getChargingCapabilities", "(", ")", ".", "addAll", "(", "getChargingCapabilities", "(", "chargingStation", ")", ")", ";", "chargePoint", ".", "setChargingMode", "(", "getVasChargingMode", "(", "chargingStation", ".", "getChargeMode", "(", ")", ")", ")", ";", "chargePoint", ".", "setCity", "(", "chargingStation", ".", "getCity", "(", ")", ")", ";", "chargePoint", ".", "setConnectors", "(", "chargingStation", ".", "getNumberOfEvses", "(", ")", ")", ";", "chargePoint", ".", "setConnectorsFree", "(", "chargingStation", ".", "getNumberOfFreeEvses", "(", ")", ")", ";", "chargePoint", ".", "getConnectorTypes", "(", ")", ".", "addAll", "(", "getConnectorTypes", "(", "chargingStation", ")", ")", ";", "chargePoint", ".", "setCoordinates", "(", "getCoordinates", "(", "chargingStation", ")", ")", ";", "chargePoint", ".", "setCountry", "(", "chargingStation", ".", "getCountry", "(", ")", ")", ";", "chargePoint", ".", "setHasFixedCable", "(", "chargingStation", ".", "isHasFixedCable", "(", ")", ")", ";", "chargePoint", ".", "setIsReservable", "(", "chargingStation", ".", "isReservable", "(", ")", ")", ";", "chargePoint", ".", "getOpeningPeriod", "(", ")", ".", "addAll", "(", "getOpeningPeriod", "(", "chargingStation", ")", ")", ";", "chargePoint", ".", "setOperator", "(", "chargingStation", ".", "getOperator", "(", ")", ")", ";", "chargePoint", ".", "setPostalCode", "(", "chargingStation", ".", "getPostalCode", "(", ")", ")", ";", "chargePoint", ".", "setPublic", "(", "getPublic", "(", "chargingStation", ")", ")", ";", "chargePoint", ".", "setRegion", "(", "chargingStation", ".", "getRegion", "(", ")", ")", ";", "chargePoint", ".", "setStatus", "(", "getStatus", "(", "chargingStation", ")", ")", ";", "chargePoint", ".", "setUid", "(", "chargingStation", ".", "getId", "(", ")", ")", ";", "return", "chargePoint", ";", "}" ]
Creates a VAS representation of a charging station. @param chargingStation charging station. @return VAS representation of the charging station.
[ "Creates", "a", "VAS", "representation", "of", "a", "charging", "station", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/vas/v10-soap/src/main/java/io/motown/vas/v10/soap/VasConversionService.java#L40-L62
6,788
motown-io/motown
vas/view-model/src/main/java/io/motown/vas/viewmodel/VasEventHandler.java
VasEventHandler.updateReservableForChargingStation
private void updateReservableForChargingStation(ChargingStationId chargingStationId, boolean reservable) { ChargingStation chargingStation = getChargingStation(chargingStationId); if (chargingStation != null) { chargingStation.setReservable(reservable); chargingStationRepository.createOrUpdate(chargingStation); } }
java
private void updateReservableForChargingStation(ChargingStationId chargingStationId, boolean reservable) { ChargingStation chargingStation = getChargingStation(chargingStationId); if (chargingStation != null) { chargingStation.setReservable(reservable); chargingStationRepository.createOrUpdate(chargingStation); } }
[ "private", "void", "updateReservableForChargingStation", "(", "ChargingStationId", "chargingStationId", ",", "boolean", "reservable", ")", "{", "ChargingStation", "chargingStation", "=", "getChargingStation", "(", "chargingStationId", ")", ";", "if", "(", "chargingStation", "!=", "null", ")", "{", "chargingStation", ".", "setReservable", "(", "reservable", ")", ";", "chargingStationRepository", ".", "createOrUpdate", "(", "chargingStation", ")", ";", "}", "}" ]
Updates the 'reservable' property of the charging station. If the charging station cannot be found in the repository an error is logged. @param chargingStationId charging station identifier. @param reservable true if the charging station is reservable, false otherwise.
[ "Updates", "the", "reservable", "property", "of", "the", "charging", "station", ".", "If", "the", "charging", "station", "cannot", "be", "found", "in", "the", "repository", "an", "error", "is", "logged", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/vas/view-model/src/main/java/io/motown/vas/viewmodel/VasEventHandler.java#L251-L258
6,789
motown-io/motown
ocpp/v15-soap/src/main/java/io/motown/ocpp/v15/soap/chargepoint/ChargingStationOcpp15SoapClient.java
ChargingStationOcpp15SoapClient.reset
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 hasReset; switch (response.getStatus()) { case ACCEPTED: LOG.info("Reset was accepted"); hasReset = true; break; case REJECTED: LOG.info("Reset was rejected"); hasReset = false; break; default: throw new AssertionError("Unknown ResetStatus: " + response.getStatus()); } return hasReset; }
java
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 hasReset; switch (response.getStatus()) { case ACCEPTED: LOG.info("Reset was accepted"); hasReset = true; break; case REJECTED: LOG.info("Reset was rejected"); hasReset = false; break; default: throw new AssertionError("Unknown ResetStatus: " + response.getStatus()); } return hasReset; }
[ "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", "hasReset", ";", "switch", "(", "response", ".", "getStatus", "(", ")", ")", "{", "case", "ACCEPTED", ":", "LOG", ".", "info", "(", "\"Reset was accepted\"", ")", ";", "hasReset", "=", "true", ";", "break", ";", "case", "REJECTED", ":", "LOG", ".", "info", "(", "\"Reset was rejected\"", ")", ";", "hasReset", "=", "false", ";", "break", ";", "default", ":", "throw", "new", "AssertionError", "(", "\"Unknown ResetStatus: \"", "+", "response", ".", "getStatus", "(", ")", ")", ";", "}", "return", "hasReset", ";", "}" ]
Reset a charging station. @param id the charging station's id. @param type the type of reset (i.e. soft or hard). @return true if the charging station has reset, false if it hasn't.
[ "Reset", "a", "charging", "station", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/v15-soap/src/main/java/io/motown/ocpp/v15/soap/chargepoint/ChargingStationOcpp15SoapClient.java#L408-L432
6,790
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.updateEvseStatus
private void updateEvseStatus(ChargingStation chargingStation, String componentId, ComponentStatus status) { for (Evse evse : chargingStation.getEvses()) { if (evse.getEvseId().equals(componentId)) { evse.setStatus(status); } } }
java
private void updateEvseStatus(ChargingStation chargingStation, String componentId, ComponentStatus status) { for (Evse evse : chargingStation.getEvses()) { if (evse.getEvseId().equals(componentId)) { evse.setStatus(status); } } }
[ "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. @param chargingStation charging stationidentifier. @param componentId component identifier. @param status new status.
[ "Updates", "the", "status", "of", "a", "Evse", "in", "the", "charging", "station", "object", "if", "the", "evse", "id", "matches", "the", "component", "id", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L352-L358
6,791
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.updateChargingStationAvailability
private void updateChargingStationAvailability(ChargingStationId chargingStationId, Availability availability) { ChargingStation chargingStation = repository.findOne(chargingStationId.getId()); if (chargingStation != null) { chargingStation.setAvailability(availability); repository.createOrUpdate(chargingStation); } }
java
private void updateChargingStationAvailability(ChargingStationId chargingStationId, Availability availability) { ChargingStation chargingStation = repository.findOne(chargingStationId.getId()); if (chargingStation != null) { chargingStation.setAvailability(availability); repository.createOrUpdate(chargingStation); } }
[ "private", "void", "updateChargingStationAvailability", "(", "ChargingStationId", "chargingStationId", ",", "Availability", "availability", ")", "{", "ChargingStation", "chargingStation", "=", "repository", ".", "findOne", "(", "chargingStationId", ".", "getId", "(", ")", ")", ";", "if", "(", "chargingStation", "!=", "null", ")", "{", "chargingStation", ".", "setAvailability", "(", "availability", ")", ";", "repository", ".", "createOrUpdate", "(", "chargingStation", ")", ";", "}", "}" ]
Updates the charging station's availability. @param chargingStationId the charging station's id. @param availability the charging station's new availability.
[ "Updates", "the", "charging", "station", "s", "availability", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L366-L373
6,792
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.updateComponentAvailability
private void updateComponentAvailability(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, Availability availability) { if (!component.equals(ChargingStationComponent.EVSE) || !(componentId instanceof EvseId)) { return; } ChargingStation chargingStation = repository.findOne(chargingStationId.getId()); if (chargingStation != null) { for (Evse evse : chargingStation.getEvses()) { if (evse.getEvseId().equals(componentId.getId())) { evse.setAvailability(availability); break; } } repository.createOrUpdate(chargingStation); } }
java
private void updateComponentAvailability(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, Availability availability) { if (!component.equals(ChargingStationComponent.EVSE) || !(componentId instanceof EvseId)) { return; } ChargingStation chargingStation = repository.findOne(chargingStationId.getId()); if (chargingStation != null) { for (Evse evse : chargingStation.getEvses()) { if (evse.getEvseId().equals(componentId.getId())) { evse.setAvailability(availability); break; } } repository.createOrUpdate(chargingStation); } }
[ "private", "void", "updateComponentAvailability", "(", "ChargingStationId", "chargingStationId", ",", "ComponentId", "componentId", ",", "ChargingStationComponent", "component", ",", "Availability", "availability", ")", "{", "if", "(", "!", "component", ".", "equals", "(", "ChargingStationComponent", ".", "EVSE", ")", "||", "!", "(", "componentId", "instanceof", "EvseId", ")", ")", "{", "return", ";", "}", "ChargingStation", "chargingStation", "=", "repository", ".", "findOne", "(", "chargingStationId", ".", "getId", "(", ")", ")", ";", "if", "(", "chargingStation", "!=", "null", ")", "{", "for", "(", "Evse", "evse", ":", "chargingStation", ".", "getEvses", "(", ")", ")", "{", "if", "(", "evse", ".", "getEvseId", "(", ")", ".", "equals", "(", "componentId", ".", "getId", "(", ")", ")", ")", "{", "evse", ".", "setAvailability", "(", "availability", ")", ";", "break", ";", "}", "}", "repository", ".", "createOrUpdate", "(", "chargingStation", ")", ";", "}", "}" ]
Updates a charging station's component availability. @param chargingStationId the charging station's id. @param componentId the component's id. @param component the component type. @param availability the the charging station's new availability.
[ "Updates", "a", "charging", "station", "s", "component", "availability", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L383-L399
6,793
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.updateChargingStationOpeningTimes
private boolean updateChargingStationOpeningTimes(ChargingStationOpeningTimesChangedEvent event, boolean clear) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { if (!event.getOpeningTimes().isEmpty()) { if (clear) { chargingStation.getOpeningTimes().clear(); } for (OpeningTime coreOpeningTime : event.getOpeningTimes()) { Day dayOfWeek = coreOpeningTime.getDay(); String timeStart = String.format(TIME_FORMAT, coreOpeningTime.getTimeStart().getHourOfDay(), coreOpeningTime.getTimeStart().getMinutesInHour()); String timeStop = String.format(TIME_FORMAT, coreOpeningTime.getTimeStop().getHourOfDay(), coreOpeningTime.getTimeStop().getMinutesInHour()); io.motown.operatorapi.viewmodel.persistence.entities.OpeningTime openingTime = new io.motown.operatorapi.viewmodel.persistence.entities.OpeningTime(dayOfWeek, timeStart, timeStop); chargingStation.getOpeningTimes().add(openingTime); } repository.createOrUpdate(chargingStation); } } else { LOG.error("operator api repo COULD NOT FIND CHARGEPOINT {} and update its opening times", event.getChargingStationId()); } return chargingStation != null; }
java
private boolean updateChargingStationOpeningTimes(ChargingStationOpeningTimesChangedEvent event, boolean clear) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { if (!event.getOpeningTimes().isEmpty()) { if (clear) { chargingStation.getOpeningTimes().clear(); } for (OpeningTime coreOpeningTime : event.getOpeningTimes()) { Day dayOfWeek = coreOpeningTime.getDay(); String timeStart = String.format(TIME_FORMAT, coreOpeningTime.getTimeStart().getHourOfDay(), coreOpeningTime.getTimeStart().getMinutesInHour()); String timeStop = String.format(TIME_FORMAT, coreOpeningTime.getTimeStop().getHourOfDay(), coreOpeningTime.getTimeStop().getMinutesInHour()); io.motown.operatorapi.viewmodel.persistence.entities.OpeningTime openingTime = new io.motown.operatorapi.viewmodel.persistence.entities.OpeningTime(dayOfWeek, timeStart, timeStop); chargingStation.getOpeningTimes().add(openingTime); } repository.createOrUpdate(chargingStation); } } else { LOG.error("operator api repo COULD NOT FIND CHARGEPOINT {} and update its opening times", event.getChargingStationId()); } return chargingStation != null; }
[ "private", "boolean", "updateChargingStationOpeningTimes", "(", "ChargingStationOpeningTimesChangedEvent", "event", ",", "boolean", "clear", ")", "{", "ChargingStation", "chargingStation", "=", "repository", ".", "findOne", "(", "event", ".", "getChargingStationId", "(", ")", ".", "getId", "(", ")", ")", ";", "if", "(", "chargingStation", "!=", "null", ")", "{", "if", "(", "!", "event", ".", "getOpeningTimes", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "clear", ")", "{", "chargingStation", ".", "getOpeningTimes", "(", ")", ".", "clear", "(", ")", ";", "}", "for", "(", "OpeningTime", "coreOpeningTime", ":", "event", ".", "getOpeningTimes", "(", ")", ")", "{", "Day", "dayOfWeek", "=", "coreOpeningTime", ".", "getDay", "(", ")", ";", "String", "timeStart", "=", "String", ".", "format", "(", "TIME_FORMAT", ",", "coreOpeningTime", ".", "getTimeStart", "(", ")", ".", "getHourOfDay", "(", ")", ",", "coreOpeningTime", ".", "getTimeStart", "(", ")", ".", "getMinutesInHour", "(", ")", ")", ";", "String", "timeStop", "=", "String", ".", "format", "(", "TIME_FORMAT", ",", "coreOpeningTime", ".", "getTimeStop", "(", ")", ".", "getHourOfDay", "(", ")", ",", "coreOpeningTime", ".", "getTimeStop", "(", ")", ".", "getMinutesInHour", "(", ")", ")", ";", "io", ".", "motown", ".", "operatorapi", ".", "viewmodel", ".", "persistence", ".", "entities", ".", "OpeningTime", "openingTime", "=", "new", "io", ".", "motown", ".", "operatorapi", ".", "viewmodel", ".", "persistence", ".", "entities", ".", "OpeningTime", "(", "dayOfWeek", ",", "timeStart", ",", "timeStop", ")", ";", "chargingStation", ".", "getOpeningTimes", "(", ")", ".", "add", "(", "openingTime", ")", ";", "}", "repository", ".", "createOrUpdate", "(", "chargingStation", ")", ";", "}", "}", "else", "{", "LOG", ".", "error", "(", "\"operator api repo COULD NOT FIND CHARGEPOINT {} and update its opening times\"", ",", "event", ".", "getChargingStationId", "(", ")", ")", ";", "}", "return", "chargingStation", "!=", "null", ";", "}" ]
Updates the opening times of the charging station. @param event The event which contains the opening times. @param clear Whether to clear the opening times or not. @return {@code true} if the update has been performed, {@code false} if the charging station can't be found.
[ "Updates", "the", "opening", "times", "of", "the", "charging", "station", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L408-L434
6,794
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.updateChargingStationLocation
private boolean updateChargingStationLocation(ChargingStationLocationChangedEvent event) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { if (event.getCoordinates() != null) { chargingStation.setLatitude(event.getCoordinates().getLatitude()); chargingStation.setLongitude(event.getCoordinates().getLongitude()); } if (event.getAddress() != null) { chargingStation.setAddressLine1(event.getAddress().getAddressLine1()); chargingStation.setAddressLine2(event.getAddress().getAddressLine2()); chargingStation.setPostalCode(event.getAddress().getPostalCode()); chargingStation.setCity(event.getAddress().getCity()); chargingStation.setRegion(event.getAddress().getRegion()); chargingStation.setCountry(event.getAddress().getCountry()); } chargingStation.setAccessibility(event.getAccessibility()); repository.createOrUpdate(chargingStation); } else { LOG.error("operator api repo COULD NOT FIND CHARGEPOINT {} and update its location", event.getChargingStationId()); } return chargingStation != null; }
java
private boolean updateChargingStationLocation(ChargingStationLocationChangedEvent event) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { if (event.getCoordinates() != null) { chargingStation.setLatitude(event.getCoordinates().getLatitude()); chargingStation.setLongitude(event.getCoordinates().getLongitude()); } if (event.getAddress() != null) { chargingStation.setAddressLine1(event.getAddress().getAddressLine1()); chargingStation.setAddressLine2(event.getAddress().getAddressLine2()); chargingStation.setPostalCode(event.getAddress().getPostalCode()); chargingStation.setCity(event.getAddress().getCity()); chargingStation.setRegion(event.getAddress().getRegion()); chargingStation.setCountry(event.getAddress().getCountry()); } chargingStation.setAccessibility(event.getAccessibility()); repository.createOrUpdate(chargingStation); } else { LOG.error("operator api repo COULD NOT FIND CHARGEPOINT {} and update its location", event.getChargingStationId()); } return chargingStation != null; }
[ "private", "boolean", "updateChargingStationLocation", "(", "ChargingStationLocationChangedEvent", "event", ")", "{", "ChargingStation", "chargingStation", "=", "repository", ".", "findOne", "(", "event", ".", "getChargingStationId", "(", ")", ".", "getId", "(", ")", ")", ";", "if", "(", "chargingStation", "!=", "null", ")", "{", "if", "(", "event", ".", "getCoordinates", "(", ")", "!=", "null", ")", "{", "chargingStation", ".", "setLatitude", "(", "event", ".", "getCoordinates", "(", ")", ".", "getLatitude", "(", ")", ")", ";", "chargingStation", ".", "setLongitude", "(", "event", ".", "getCoordinates", "(", ")", ".", "getLongitude", "(", ")", ")", ";", "}", "if", "(", "event", ".", "getAddress", "(", ")", "!=", "null", ")", "{", "chargingStation", ".", "setAddressLine1", "(", "event", ".", "getAddress", "(", ")", ".", "getAddressLine1", "(", ")", ")", ";", "chargingStation", ".", "setAddressLine2", "(", "event", ".", "getAddress", "(", ")", ".", "getAddressLine2", "(", ")", ")", ";", "chargingStation", ".", "setPostalCode", "(", "event", ".", "getAddress", "(", ")", ".", "getPostalCode", "(", ")", ")", ";", "chargingStation", ".", "setCity", "(", "event", ".", "getAddress", "(", ")", ".", "getCity", "(", ")", ")", ";", "chargingStation", ".", "setRegion", "(", "event", ".", "getAddress", "(", ")", ".", "getRegion", "(", ")", ")", ";", "chargingStation", ".", "setCountry", "(", "event", ".", "getAddress", "(", ")", ".", "getCountry", "(", ")", ")", ";", "}", "chargingStation", ".", "setAccessibility", "(", "event", ".", "getAccessibility", "(", ")", ")", ";", "repository", ".", "createOrUpdate", "(", "chargingStation", ")", ";", "}", "else", "{", "LOG", ".", "error", "(", "\"operator api repo COULD NOT FIND CHARGEPOINT {} and update its location\"", ",", "event", ".", "getChargingStationId", "(", ")", ")", ";", "}", "return", "chargingStation", "!=", "null", ";", "}" ]
Updates the location of the charging station. @param event The event which contains the data of the location. @return {@code true} if the update has been performed, {@code false} if the charging station can't be found.
[ "Updates", "the", "location", "of", "the", "charging", "station", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L442-L468
6,795
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.setReservable
private void setReservable(ChargingStationId chargingStationId, boolean reservable) { ChargingStation chargingStation = repository.findOne(chargingStationId.getId()); if (chargingStation != null) { chargingStation.setReservable(reservable); repository.createOrUpdate(chargingStation); } }
java
private void setReservable(ChargingStationId chargingStationId, boolean reservable) { ChargingStation chargingStation = repository.findOne(chargingStationId.getId()); if (chargingStation != null) { chargingStation.setReservable(reservable); repository.createOrUpdate(chargingStation); } }
[ "private", "void", "setReservable", "(", "ChargingStationId", "chargingStationId", ",", "boolean", "reservable", ")", "{", "ChargingStation", "chargingStation", "=", "repository", ".", "findOne", "(", "chargingStationId", ".", "getId", "(", ")", ")", ";", "if", "(", "chargingStation", "!=", "null", ")", "{", "chargingStation", ".", "setReservable", "(", "reservable", ")", ";", "repository", ".", "createOrUpdate", "(", "chargingStation", ")", ";", "}", "}" ]
Makes a charging station reservable or not reservable. @param chargingStationId the charging station to make reservable or not reservable. @param reservable true if reservable, false if not.
[ "Makes", "a", "charging", "station", "reservable", "or", "not", "reservable", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L476-L483
6,796
motown-io/motown
domain/command-authorization/src/main/java/io/motown/domain/commandauthorization/CommandAuthorizationService.java
CommandAuthorizationService.isAuthorized
public boolean isAuthorized(ChargingStationId chargingStationId, UserIdentity userIdentity, Class commandClass) { // first search for this specific authorization boolean isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), commandClass) != null; if (!isAuthorized) { // maybe the user identity has access to 'allPermissions' isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), AllPermissions.class) != null; } return isAuthorized; }
java
public boolean isAuthorized(ChargingStationId chargingStationId, UserIdentity userIdentity, Class commandClass) { // first search for this specific authorization boolean isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), commandClass) != null; if (!isAuthorized) { // maybe the user identity has access to 'allPermissions' isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), AllPermissions.class) != null; } return isAuthorized; }
[ "public", "boolean", "isAuthorized", "(", "ChargingStationId", "chargingStationId", ",", "UserIdentity", "userIdentity", ",", "Class", "commandClass", ")", "{", "// first search for this specific authorization", "boolean", "isAuthorized", "=", "commandAuthorizationRepository", ".", "find", "(", "chargingStationId", ".", "getId", "(", ")", ",", "userIdentity", ".", "getId", "(", ")", ",", "commandClass", ")", "!=", "null", ";", "if", "(", "!", "isAuthorized", ")", "{", "// maybe the user identity has access to 'allPermissions'", "isAuthorized", "=", "commandAuthorizationRepository", ".", "find", "(", "chargingStationId", ".", "getId", "(", ")", ",", "userIdentity", ".", "getId", "(", ")", ",", "AllPermissions", ".", "class", ")", "!=", "null", ";", "}", "return", "isAuthorized", ";", "}" ]
Checks if a user identity has access to a command class for a certain charging station. @param chargingStationId charging station identification. @param userIdentity user identity. @param commandClass command class. @return true if the user is authorized to execute the command for the charging station, false if not.
[ "Checks", "if", "a", "user", "identity", "has", "access", "to", "a", "command", "class", "for", "a", "certain", "charging", "station", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/domain/command-authorization/src/main/java/io/motown/domain/commandauthorization/CommandAuthorizationService.java#L35-L45
6,797
motown-io/motown
utils/soap/src/main/java/io/motown/utils/soap/interceptor/MessageIdHeaderInterceptor.java
MessageIdHeaderInterceptor.messageIdHeaderExists
private Boolean messageIdHeaderExists(List<SoapHeader> headers) { for(SoapHeader header:headers) { if(header.getName().getLocalPart().equalsIgnoreCase(LOCAL_NAME)) { return true; } } return false; }
java
private Boolean messageIdHeaderExists(List<SoapHeader> headers) { for(SoapHeader header:headers) { if(header.getName().getLocalPart().equalsIgnoreCase(LOCAL_NAME)) { return true; } } return false; }
[ "private", "Boolean", "messageIdHeaderExists", "(", "List", "<", "SoapHeader", ">", "headers", ")", "{", "for", "(", "SoapHeader", "header", ":", "headers", ")", "{", "if", "(", "header", ".", "getName", "(", ")", ".", "getLocalPart", "(", ")", ".", "equalsIgnoreCase", "(", "LOCAL_NAME", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if the MessageID header exists in the list of headers. @param headers list of headers @return true if the MessageID header exists, false if not
[ "Checks", "if", "the", "MessageID", "header", "exists", "in", "the", "list", "of", "headers", "." ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/utils/soap/src/main/java/io/motown/utils/soap/interceptor/MessageIdHeaderInterceptor.java#L72-L79
6,798
motown-io/motown
ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/wamp/WampMessageParser.java
WampMessageParser.parseMessage
public WampMessage parseMessage(ChargingStationId chargingStationId, Reader reader) throws IOException { String rawMessage = this.convertToString(reader); String trimmedMessage = this.removeBrackets(rawMessage); //In case a payload is present, it always is the last part of the message int payloadStart = trimmedMessage.indexOf("{"); String payload = payloadStart > 0 ? trimmedMessage.substring(payloadStart) : null; String metaData = payloadStart > 0 ? trimmedMessage.substring(0, payloadStart) : trimmedMessage; String[] metaDataParts = metaData.split(","); int messageType = Integer.parseInt(removeQuotesAndTrim(metaDataParts[0])); String callId = removeQuotes(removeQuotesAndTrim(metaDataParts[1])); WampMessage wampMessage; switch (messageType) { case WampMessage.CALL: MessageProcUri procUri = MessageProcUri.fromValue(removeQuotesAndTrim(metaDataParts[2])); wampMessage = new WampMessage(messageType, callId, procUri, payload); if (wampMessageHandler != null) { wampMessageHandler.handleWampCall(chargingStationId.getId(), rawMessage, callId); } break; case WampMessage.CALL_RESULT: wampMessage = new WampMessage(messageType, callId, payload); if (wampMessageHandler != null) { wampMessageHandler.handleWampCallResult(chargingStationId.getId(), rawMessage, callId); } break; case WampMessage.CALL_ERROR: String errorCode = removeQuotes(metaDataParts[2]); String errorDescription = removeQuotes(metaDataParts[3]); String errorDetails = removeQuotes(metaDataParts[4]); wampMessage = new WampMessage(messageType, callId, errorCode, errorDescription, errorDetails); if (wampMessageHandler != null) { wampMessageHandler.handleWampCallError(chargingStationId.getId(), rawMessage, callId); } break; default: if (wampMessageHandler != null) { wampMessageHandler.handle(chargingStationId.getId(), rawMessage); } throw new IllegalArgumentException(String.format("Unknown WAMP messageType: %s", messageType)); } return wampMessage; }
java
public WampMessage parseMessage(ChargingStationId chargingStationId, Reader reader) throws IOException { String rawMessage = this.convertToString(reader); String trimmedMessage = this.removeBrackets(rawMessage); //In case a payload is present, it always is the last part of the message int payloadStart = trimmedMessage.indexOf("{"); String payload = payloadStart > 0 ? trimmedMessage.substring(payloadStart) : null; String metaData = payloadStart > 0 ? trimmedMessage.substring(0, payloadStart) : trimmedMessage; String[] metaDataParts = metaData.split(","); int messageType = Integer.parseInt(removeQuotesAndTrim(metaDataParts[0])); String callId = removeQuotes(removeQuotesAndTrim(metaDataParts[1])); WampMessage wampMessage; switch (messageType) { case WampMessage.CALL: MessageProcUri procUri = MessageProcUri.fromValue(removeQuotesAndTrim(metaDataParts[2])); wampMessage = new WampMessage(messageType, callId, procUri, payload); if (wampMessageHandler != null) { wampMessageHandler.handleWampCall(chargingStationId.getId(), rawMessage, callId); } break; case WampMessage.CALL_RESULT: wampMessage = new WampMessage(messageType, callId, payload); if (wampMessageHandler != null) { wampMessageHandler.handleWampCallResult(chargingStationId.getId(), rawMessage, callId); } break; case WampMessage.CALL_ERROR: String errorCode = removeQuotes(metaDataParts[2]); String errorDescription = removeQuotes(metaDataParts[3]); String errorDetails = removeQuotes(metaDataParts[4]); wampMessage = new WampMessage(messageType, callId, errorCode, errorDescription, errorDetails); if (wampMessageHandler != null) { wampMessageHandler.handleWampCallError(chargingStationId.getId(), rawMessage, callId); } break; default: if (wampMessageHandler != null) { wampMessageHandler.handle(chargingStationId.getId(), rawMessage); } throw new IllegalArgumentException(String.format("Unknown WAMP messageType: %s", messageType)); } return wampMessage; }
[ "public", "WampMessage", "parseMessage", "(", "ChargingStationId", "chargingStationId", ",", "Reader", "reader", ")", "throws", "IOException", "{", "String", "rawMessage", "=", "this", ".", "convertToString", "(", "reader", ")", ";", "String", "trimmedMessage", "=", "this", ".", "removeBrackets", "(", "rawMessage", ")", ";", "//In case a payload is present, it always is the last part of the message", "int", "payloadStart", "=", "trimmedMessage", ".", "indexOf", "(", "\"{\"", ")", ";", "String", "payload", "=", "payloadStart", ">", "0", "?", "trimmedMessage", ".", "substring", "(", "payloadStart", ")", ":", "null", ";", "String", "metaData", "=", "payloadStart", ">", "0", "?", "trimmedMessage", ".", "substring", "(", "0", ",", "payloadStart", ")", ":", "trimmedMessage", ";", "String", "[", "]", "metaDataParts", "=", "metaData", ".", "split", "(", "\",\"", ")", ";", "int", "messageType", "=", "Integer", ".", "parseInt", "(", "removeQuotesAndTrim", "(", "metaDataParts", "[", "0", "]", ")", ")", ";", "String", "callId", "=", "removeQuotes", "(", "removeQuotesAndTrim", "(", "metaDataParts", "[", "1", "]", ")", ")", ";", "WampMessage", "wampMessage", ";", "switch", "(", "messageType", ")", "{", "case", "WampMessage", ".", "CALL", ":", "MessageProcUri", "procUri", "=", "MessageProcUri", ".", "fromValue", "(", "removeQuotesAndTrim", "(", "metaDataParts", "[", "2", "]", ")", ")", ";", "wampMessage", "=", "new", "WampMessage", "(", "messageType", ",", "callId", ",", "procUri", ",", "payload", ")", ";", "if", "(", "wampMessageHandler", "!=", "null", ")", "{", "wampMessageHandler", ".", "handleWampCall", "(", "chargingStationId", ".", "getId", "(", ")", ",", "rawMessage", ",", "callId", ")", ";", "}", "break", ";", "case", "WampMessage", ".", "CALL_RESULT", ":", "wampMessage", "=", "new", "WampMessage", "(", "messageType", ",", "callId", ",", "payload", ")", ";", "if", "(", "wampMessageHandler", "!=", "null", ")", "{", "wampMessageHandler", ".", "handleWampCallResult", "(", "chargingStationId", ".", "getId", "(", ")", ",", "rawMessage", ",", "callId", ")", ";", "}", "break", ";", "case", "WampMessage", ".", "CALL_ERROR", ":", "String", "errorCode", "=", "removeQuotes", "(", "metaDataParts", "[", "2", "]", ")", ";", "String", "errorDescription", "=", "removeQuotes", "(", "metaDataParts", "[", "3", "]", ")", ";", "String", "errorDetails", "=", "removeQuotes", "(", "metaDataParts", "[", "4", "]", ")", ";", "wampMessage", "=", "new", "WampMessage", "(", "messageType", ",", "callId", ",", "errorCode", ",", "errorDescription", ",", "errorDetails", ")", ";", "if", "(", "wampMessageHandler", "!=", "null", ")", "{", "wampMessageHandler", ".", "handleWampCallError", "(", "chargingStationId", ".", "getId", "(", ")", ",", "rawMessage", ",", "callId", ")", ";", "}", "break", ";", "default", ":", "if", "(", "wampMessageHandler", "!=", "null", ")", "{", "wampMessageHandler", ".", "handle", "(", "chargingStationId", ".", "getId", "(", ")", ",", "rawMessage", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Unknown WAMP messageType: %s\"", ",", "messageType", ")", ")", ";", "}", "return", "wampMessage", ";", "}" ]
Parses a CALL, RESULT, or ERROR message and constructs a WampMessage @param chargingStationId sending the message @param reader containing the message @return WampMessage @throws IOException in case the message could not be read @throws IllegalArgumentException in case an unknown wamp messageType is encountered
[ "Parses", "a", "CALL", "RESULT", "or", "ERROR", "message", "and", "constructs", "a", "WampMessage" ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/wamp/WampMessageParser.java#L42-L86
6,799
motown-io/motown
ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/wamp/WampMessageParser.java
WampMessageParser.convertToString
private String convertToString(Reader reader) throws IOException { StringBuilder stringBuilder = new StringBuilder(); int numChars; char[] chars = new char[50]; do { numChars = reader.read(chars, 0, chars.length); if (numChars > 0) { stringBuilder.append(chars, 0, numChars); } } while (numChars != -1); return stringBuilder.toString(); }
java
private String convertToString(Reader reader) throws IOException { StringBuilder stringBuilder = new StringBuilder(); int numChars; char[] chars = new char[50]; do { numChars = reader.read(chars, 0, chars.length); if (numChars > 0) { stringBuilder.append(chars, 0, numChars); } } while (numChars != -1); return stringBuilder.toString(); }
[ "private", "String", "convertToString", "(", "Reader", "reader", ")", "throws", "IOException", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "int", "numChars", ";", "char", "[", "]", "chars", "=", "new", "char", "[", "50", "]", ";", "do", "{", "numChars", "=", "reader", ".", "read", "(", "chars", ",", "0", ",", "chars", ".", "length", ")", ";", "if", "(", "numChars", ">", "0", ")", "{", "stringBuilder", ".", "append", "(", "chars", ",", "0", ",", "numChars", ")", ";", "}", "}", "while", "(", "numChars", "!=", "-", "1", ")", ";", "return", "stringBuilder", ".", "toString", "(", ")", ";", "}" ]
Constructs a String by reading the characters from the Reader @param reader Reader to read from @return String containing the message @throws IOException in case of read failure
[ "Constructs", "a", "String", "by", "reading", "the", "characters", "from", "the", "Reader" ]
783ccda7c28b273a529ddd47defe8673b1ea365b
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/wamp/WampMessageParser.java#L94-L106