_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q16200
ElevationUtil.getCornerAngle
train
private static float getCornerAngle(@NonNull final Orientation orientation) { switch (orientation) { case TOP_LEFT: return QUARTER_ARC_DEGRESS * 2; case TOP_RIGHT: return QUARTER_ARC_DEGRESS * 3; case BOTTOM_LEFT: return QUARTER_ARC_DEGRESS; case BOTTOM_RIGHT: return 0; default: throw new IllegalArgumentException("Invalid orientation: " + orientation); } }
java
{ "resource": "" }
q16201
ElevationUtil.createElevationShadow
train
public static Bitmap createElevationShadow(@NonNull final Context context, final int elevation, @NonNull final Orientation orientation) { return createElevationShadow(context, elevation, orientation, false); }
java
{ "resource": "" }
q16202
ElevationUtil.createElevationShadow
train
public static Bitmap createElevationShadow(@NonNull final Context context, final int elevation, @NonNull final Orientation orientation, final boolean parallelLight) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); Condition.INSTANCE.ensureAtLeast(elevation, 0, "The elevation must be at least 0"); Condition.INSTANCE.ensureAtMaximum(elevation, MAX_ELEVATION, "The elevation must be at maximum " + MAX_ELEVATION); Condition.INSTANCE.ensureNotNull(orientation, "The orientation may not be null"); switch (orientation) { case LEFT: case TOP: case RIGHT: case BOTTOM: return createEdgeShadow(context, elevation, orientation, parallelLight); case TOP_LEFT: case TOP_RIGHT: case BOTTOM_LEFT: case BOTTOM_RIGHT: return createCornerShadow(context, elevation, orientation, parallelLight); default: throw new IllegalArgumentException("Invalid orientation: " + orientation); } }
java
{ "resource": "" }
q16203
AbstractMardaoMojo.mergeTemplate
train
private void mergeTemplate(String templateFilename, File folder, String javaFilename, boolean overwrite) { final File javaFile = new File(folder, javaFilename); // create destination folder? File destinationFolder = javaFile.getParentFile(); if (false == destinationFolder.exists()) { destinationFolder.mkdirs(); } // up-to-date? if (false == javaFile.exists() || overwrite) { getLog().info("Merging " + templateFilename + " for " + javaFilename); try { final PrintWriter writer = new PrintWriter(javaFile); Template template = Velocity.getTemplate(templateFilename); template.merge(vc, writer); writer.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (ResourceNotFoundException e) { e.printStackTrace(); } catch (ParseErrorException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } else { getLog().info("Skipping " + templateFilename + " for " + javaFilename); } }
java
{ "resource": "" }
q16204
DataUtil.processResource
train
private static void processResource(String resourceName, AbstractProcessor processor) { InputStream lastNameStream = NameDbUsa.class.getClassLoader().getResourceAsStream(resourceName); BufferedReader lastNameReader = new BufferedReader(new InputStreamReader(lastNameStream)); try { int index = 0; while (lastNameReader.ready()) { String line = lastNameReader.readLine(); processor.processLine(line, index++); } } catch (IOException e) { e.printStackTrace(); } }
java
{ "resource": "" }
q16205
AttachedViewRecycler.binarySearch
train
private int binarySearch(@NonNull final List<ItemType> list, @NonNull final ItemType item, @NonNull final Comparator<ItemType> comparator) { int index = Collections.binarySearch(list, item, comparator); if (index < 0) { index = ~index; } return index; }
java
{ "resource": "" }
q16206
AttachedViewRecycler.setComparator
train
public final void setComparator(@Nullable final Comparator<ItemType> comparator) { this.comparator = comparator; if (comparator != null) { if (items.size() > 0) { List<ItemType> newItems = new ArrayList<>(); List<View> views = new ArrayList<>(); for (int i = items.size() - 1; i >= 0; i--) { ItemType item = items.get(i); int index = binarySearch(newItems, item, comparator); newItems.add(index, item); View view = parent.getChildAt(i); parent.removeViewAt(i); views.add(index, view); } parent.removeAllViews(); for (View view : views) { parent.addView(view); } this.items = newItems; getLogger().logDebug(getClass(), "Comparator changed. Views have been reordered"); } else { getLogger().logDebug(getClass(), "Comparator changed"); } } else { getLogger().logDebug(getClass(), "Comparator set to null"); } }
java
{ "resource": "" }
q16207
Client.httpRequest
train
public <T> T httpRequest(HttpMethod method, Class<T> cls, Map<String, Object> params, Object data, String... segments) { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setAccept(Collections .singletonList(MediaType.APPLICATION_JSON)); if (accessToken != null) { String auth = "Bearer " + accessToken; requestHeaders.set("Authorization", auth); log.info("Authorization: " + auth); } String url = path(apiUrl, segments); MediaType contentType = MediaType.APPLICATION_JSON; if (method.equals(HttpMethod.POST) && isEmpty(data) && !isEmpty(params)) { data = encodeParams(params); contentType = MediaType.APPLICATION_FORM_URLENCODED; } else { url = addQueryParams(url, params); } requestHeaders.setContentType(contentType); HttpEntity<?> requestEntity = null; if (method.equals(HttpMethod.POST) || method.equals(HttpMethod.PUT)) { if (isEmpty(data)) { data = JsonNodeFactory.instance.objectNode(); } requestEntity = new HttpEntity<Object>(data, requestHeaders); } else { requestEntity = new HttpEntity<Object>(requestHeaders); } log.info("Client.httpRequest(): url: " + url); ResponseEntity<T> responseEntity = restTemplate.exchange(url, method, requestEntity, cls); log.info("Client.httpRequest(): reponse body: " + responseEntity.getBody().toString()); return responseEntity.getBody(); }
java
{ "resource": "" }
q16208
Client.apiRequest
train
public ApiResponse apiRequest(HttpMethod method, Map<String, Object> params, Object data, String... segments) { ApiResponse response = null; try { response = httpRequest(method, ApiResponse.class, params, data, segments); log.info("Client.apiRequest(): Response: " + response); } catch (HttpClientErrorException e) { log.error("Client.apiRequest(): HTTP error: " + e.getLocalizedMessage()); response = parse(e.getResponseBodyAsString(), ApiResponse.class); if ((response != null) && !isEmpty(response.getError())) { log.error("Client.apiRequest(): Response error: " + response.getError()); if (!isEmpty(response.getException())) { log.error("Client.apiRequest(): Response exception: " + response.getException()); } } } return response; }
java
{ "resource": "" }
q16209
Client.authorizeAppUser
train
public ApiResponse authorizeAppUser(String email, String password) { validateNonEmptyParam(email, "email"); validateNonEmptyParam(password,"password"); assertValidApplicationId(); loggedInUser = null; accessToken = null; currentOrganization = null; Map<String, Object> formData = new HashMap<String, Object>(); formData.put("grant_type", "password"); formData.put("username", email); formData.put("password", password); ApiResponse response = apiRequest(HttpMethod.POST, formData, null, organizationId, applicationId, "token"); if (response == null) { return response; } if (!isEmpty(response.getAccessToken()) && (response.getUser() != null)) { loggedInUser = response.getUser(); accessToken = response.getAccessToken(); currentOrganization = null; log.info("Client.authorizeAppUser(): Access token: " + accessToken); } else { log.info("Client.authorizeAppUser(): Response: " + response); } return response; }
java
{ "resource": "" }
q16210
Client.changePassword
train
public ApiResponse changePassword(String username, String oldPassword, String newPassword) { Map<String, Object> data = new HashMap<String, Object>(); data.put("newpassword", newPassword); data.put("oldpassword", oldPassword); return apiRequest(HttpMethod.POST, null, data, organizationId, applicationId, "users", username, "password"); }
java
{ "resource": "" }
q16211
Client.authorizeAppClient
train
public ApiResponse authorizeAppClient(String clientId, String clientSecret) { validateNonEmptyParam(clientId, "client identifier"); validateNonEmptyParam(clientSecret, "client secret"); assertValidApplicationId(); loggedInUser = null; accessToken = null; currentOrganization = null; Map<String, Object> formData = new HashMap<String, Object>(); formData.put("grant_type", "client_credentials"); formData.put("client_id", clientId); formData.put("client_secret", clientSecret); ApiResponse response = apiRequest(HttpMethod.POST, formData, null, organizationId, applicationId, "token"); if (response == null) { return response; } if (!isEmpty(response.getAccessToken())) { loggedInUser = null; accessToken = response.getAccessToken(); currentOrganization = null; log.info("Client.authorizeAppClient(): Access token: " + accessToken); } else { log.info("Client.authorizeAppClient(): Response: " + response); } return response; }
java
{ "resource": "" }
q16212
Client.createEntity
train
public ApiResponse createEntity(Entity entity) { assertValidApplicationId(); if (isEmpty(entity.getType())) { throw new IllegalArgumentException("Missing entity type"); } ApiResponse response = apiRequest(HttpMethod.POST, null, entity, organizationId, applicationId, entity.getType()); return response; }
java
{ "resource": "" }
q16213
Client.createEntity
train
public ApiResponse createEntity(Map<String, Object> properties) { assertValidApplicationId(); if (isEmpty(properties.get("type"))) { throw new IllegalArgumentException("Missing entity type"); } ApiResponse response = apiRequest(HttpMethod.POST, null, properties, organizationId, applicationId, properties.get("type").toString()); return response; }
java
{ "resource": "" }
q16214
Client.getGroupsForUser
train
public Map<String, Group> getGroupsForUser(String userId) { ApiResponse response = apiRequest(HttpMethod.GET, null, null, organizationId, applicationId, "users", userId, "groups"); Map<String, Group> groupMap = new HashMap<String, Group>(); if (response != null) { List<Group> groups = response.getEntities(Group.class); for (Group group : groups) { groupMap.put(group.getPath(), group); } } return groupMap; }
java
{ "resource": "" }
q16215
Client.queryActivityFeedForUser
train
public Query queryActivityFeedForUser(String userId) { Query q = queryEntitiesRequest(HttpMethod.GET, null, null, organizationId, applicationId, "users", userId, "feed"); return q; }
java
{ "resource": "" }
q16216
Client.postUserActivity
train
public ApiResponse postUserActivity(String userId, Activity activity) { return apiRequest(HttpMethod.POST, null, activity, organizationId, applicationId, "users", userId, "activities"); }
java
{ "resource": "" }
q16217
Client.postUserActivity
train
public ApiResponse postUserActivity(String verb, String title, String content, String category, User user, Entity object, String objectType, String objectName, String objectContent) { Activity activity = Activity.newActivity(verb, title, content, category, user, object, objectType, objectName, objectContent); return postUserActivity(user.getUuid().toString(), activity); }
java
{ "resource": "" }
q16218
Client.postGroupActivity
train
public ApiResponse postGroupActivity(String groupId, Activity activity) { return apiRequest(HttpMethod.POST, null, activity, organizationId, applicationId, "groups", groupId, "activities"); }
java
{ "resource": "" }
q16219
Client.postGroupActivity
train
public ApiResponse postGroupActivity(String groupId, String verb, String title, String content, String category, User user, Entity object, String objectType, String objectName, String objectContent) { Activity activity = Activity.newActivity(verb, title, content, category, user, object, objectType, objectName, objectContent); return postGroupActivity(groupId, activity); }
java
{ "resource": "" }
q16220
Client.queryActivity
train
public Query queryActivity() { Query q = queryEntitiesRequest(HttpMethod.GET, null, null, organizationId, applicationId, "activities"); return q; }
java
{ "resource": "" }
q16221
Client.queryEntitiesRequest
train
public Query queryEntitiesRequest(HttpMethod method, Map<String, Object> params, Object data, String... segments) { ApiResponse response = apiRequest(method, params, data, segments); return new EntityQuery(response, method, params, data, segments); }
java
{ "resource": "" }
q16222
Client.queryUsersForGroup
train
public Query queryUsersForGroup(String groupId) { Query q = queryEntitiesRequest(HttpMethod.GET, null, null, organizationId, applicationId, "groups", groupId, "users"); return q; }
java
{ "resource": "" }
q16223
Client.addUserToGroup
train
public ApiResponse addUserToGroup(String userId, String groupId) { return apiRequest(HttpMethod.POST, null, null, organizationId, applicationId, "groups", groupId, "users", userId); }
java
{ "resource": "" }
q16224
Client.createGroup
train
public ApiResponse createGroup(String groupPath, String groupTitle, String groupName){ Map<String, Object> data = new HashMap<String, Object>(); data.put("type", "group"); data.put("path", groupPath); if (groupTitle != null) { data.put("title", groupTitle); } if(groupName != null){ data.put("name", groupName); } return apiRequest(HttpMethod.POST, null, data, organizationId, applicationId, "groups"); }
java
{ "resource": "" }
q16225
Client.connectEntities
train
public ApiResponse connectEntities(String connectingEntityType, String connectingEntityId, String connectionType, String connectedEntityId) { return apiRequest(HttpMethod.POST, null, null, organizationId, applicationId, connectingEntityType, connectingEntityId, connectionType, connectedEntityId); }
java
{ "resource": "" }
q16226
Client.disconnectEntities
train
public ApiResponse disconnectEntities(String connectingEntityType, String connectingEntityId, String connectionType, String connectedEntityId) { return apiRequest(HttpMethod.DELETE, null, null, organizationId, applicationId, connectingEntityType, connectingEntityId, connectionType, connectedEntityId); }
java
{ "resource": "" }
q16227
Client.queryEntityConnections
train
public Query queryEntityConnections(String connectingEntityType, String connectingEntityId, String connectionType, String ql) { Map<String, Object> params = new HashMap<String, Object>(); params.put("ql", ql); Query q = queryEntitiesRequest(HttpMethod.GET, params, null, organizationId, applicationId, connectingEntityType, connectingEntityId, connectionType); return q; }
java
{ "resource": "" }
q16228
Client.queryEntityConnectionsWithinLocation
train
public Query queryEntityConnectionsWithinLocation( String connectingEntityType, String connectingEntityId, String connectionType, float distance, float lattitude, float longitude, String ql) { Map<String, Object> params = new HashMap<String, Object>(); params.put("ql", makeLocationQL(distance, lattitude, longitude, ql)); Query q = queryEntitiesRequest(HttpMethod.GET, params, null, organizationId, applicationId, connectingEntityType, connectingEntityId, connectionType); return q; }
java
{ "resource": "" }
q16229
Conversions.toData
train
public static Object toData(Literal lit) { if (lit == null) throw new IllegalArgumentException("Can't convert null literal"); if (lit instanceof TypedLiteral) return toData((TypedLiteral)lit); // Untyped literals are xsd:string // Note this isn't strictly correct; language tags will be lost here. return lit.getLexical(); }
java
{ "resource": "" }
q16230
Conversions.toData
train
public static Object toData(TypedLiteral lit) { if (lit == null) throw new IllegalArgumentException("Can't convert null literal"); Conversion<?> c = uriConversions.get(lit.getDataType()); if (c == null) throw new IllegalArgumentException("Don't know how to convert literal of type " + lit.getDataType()); return c.data(lit.getLexical()); }
java
{ "resource": "" }
q16231
Conversions.toLiteral
train
public static TypedLiteral toLiteral(Object value) { if (value == null) throw new IllegalArgumentException("Can't convert null value"); Conversion<?> c = classConversions.get(value.getClass()); if (c != null) return c.literal(value); // The object has an unrecognized type that doesn't translate directly to XSD. // Omitting the datatype would imply a type of xsd:string, so use xsd:anySimpleType instead. // The use of xsd:anySimpleType prevents round-tripping; in the future we could possibly // serialize this as a byte array and use xsd:hexBinary or xsd:base64Binary. return new TypedLiteralImpl(value.toString(), XsdTypes.ANY_SIMPLE_TYPE); }
java
{ "resource": "" }
q16232
XMLSelectResults.readNext
train
protected Map<String,RDFNode> readNext() throws SparqlException { try { // read <result> or </results> int eventType = reader.nextTag(); // if a closing element, then it should be </results> if (eventType == END_ELEMENT) { // already read the final result, so clean up and return nothing if (nameIs(RESULTS)) { cleanup(); return null; } else throw new SparqlException("Bad element closure with: " + reader.getLocalName()); } // we only expect a <result> here testOpen(eventType, RESULT, "Expected a new result. Got :" + ((eventType == END_ELEMENT) ? "/" : "") + reader.getLocalName()); Map<String,RDFNode> result = new HashMap<String,RDFNode>(); // read <binding> list while ((eventType = reader.nextTag()) == START_ELEMENT && nameIs(BINDING)) { // get the name of the binding String name = reader.getAttributeValue(null, VAR_NAME); result.put(name, parseValue()); testClose(reader.nextTag(), BINDING, "Single Binding not closed correctly"); } // a non- <binding> was read, so it should have been a </result> testClose(eventType, RESULT, "Single Result not closed correctly"); return result; } catch (XMLStreamException e) { throw new SparqlException("Error reading from XML stream", e); } }
java
{ "resource": "" }
q16233
DateTime.append
train
private static void append(StringBuilder sb, int val, int width) { String s = Integer.toString(val); for (int i = s.length(); i < width; i++) sb.append('0'); sb.append(s); }
java
{ "resource": "" }
q16234
DateTime.elapsedDays
train
private static long elapsedDays(int year) { int y = year - 1; return DAYS_IN_YEAR * (long)y + div(y, 400) - div(y, 100) + div(y, 4); }
java
{ "resource": "" }
q16235
DateTime.daysInMonth
train
private static int daysInMonth(int year, int month) { assert month >= FIRST_MONTH && month <= LAST_MONTH; int d = DAYS_IN_MONTH[month - 1]; if (month == FEBRUARY && isLeapYear(year)) d++; return d; }
java
{ "resource": "" }
q16236
DateTime.parseMillis
train
private static int parseMillis(Input s) { if (s.index < s.len && s.getChar() == '.') { int startIndex = ++s.index; int ms = parseInt(s); int len = s.index - startIndex; for (; len < 3; len++) ms *= 10; for (; len > 3; len--) ms /= 10; // truncate because it's easier than rounding. return ms; } return 0; }
java
{ "resource": "" }
q16237
DateTime.parseTzOffsetMs
train
private static Integer parseTzOffsetMs(Input s, boolean strict) { if (s.index < s.len) { char c = s.getChar(); s.index++; int sign; if (c == 'Z') { return 0; } else if (c == '+') { sign = 1; } else if (c == '-') { sign = -1; } else { throw new DateFormatException("unexpected character, expected one of [Z+-]", s.str, s.index - 1); } int tzHours = parseField("timezone hours", s, TIME_SEP, 2, 2, strict); if (strict && tzHours > 14) throw new DateFormatException("timezone offset hours out of range [0..14]", s.str, s.index - 2); int tzMin = parseField("timezone minutes", s, null, 2, 2, strict); if (strict && tzMin > 59) throw new DateFormatException("timezone offset hours out of range [0..59]", s.str, s.index - 1); if (strict && tzHours == 14 && tzMin > 0) throw new DateFormatException("timezone offset may not be greater than 14 hours", s.str, s.index - 1); return sign * (tzHours * MINS_IN_HOUR + tzMin) * MS_IN_MIN; } // Reached the end of input with no timezone specified. return null; }
java
{ "resource": "" }
q16238
DateTime.parseField
train
private static int parseField(String field, Input s, Character delim, int minLen, int maxLen, boolean strict) { int startIndex = s.index; int result = parseInt(s); if (startIndex == s.index) throw new DateFormatException("missing value for field '" + field + "'", s.str, startIndex); if (strict) { int len = s.index - startIndex; if (len < minLen) throw new DateFormatException("field '" + field + "' must be at least " + minLen + " digits wide", s.str, startIndex); if (maxLen > 0 && len > maxLen) throw new DateFormatException("field '" + field + "' must be no more than " + minLen + " digits wide", s.str, startIndex); } if (delim != null) { if (s.index >= s.len) throw new DateFormatException("unexpected end of input", s.str, s.index); if (strict && s.getChar() != delim.charValue()) throw new DateFormatException("unexpected character, expected '" + delim + "'", s.str, s.index); s.index++; } return result; }
java
{ "resource": "" }
q16239
DateTime.parseInt
train
private static int parseInt(Input s) { if (s.index >= s.len) throw new DateFormatException("unexpected end of input", s.str, s.index); int result = 0; while (s.index < s.len) { char c = s.getChar(); if (c >= '0' && c <= '9') { if (result >= Integer.MAX_VALUE / 10) throw new ArithmeticException("Field too large."); result = result * 10 + ((int)c - (int)'0'); s.index++; } else { break; } } return result; }
java
{ "resource": "" }
q16240
AppUtil.showAppInfo
train
public static void showAppInfo(@NonNull final Context context, @NonNull final String packageName) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); Condition.INSTANCE.ensureNotNull(packageName, "The package name may not be null"); Condition.INSTANCE.ensureNotEmpty(packageName, "The package name may not be empty"); Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", packageName, null); intent.setData(uri); if (intent.resolveActivity(context.getPackageManager()) == null) { throw new ActivityNotFoundException( "App info for package " + packageName + " not available"); } context.startActivity(intent); }
java
{ "resource": "" }
q16241
ObjectsApi.postPermissionsWithHttpInfo
train
public ApiResponse<Void> postPermissionsWithHttpInfo(String objectType, PostPermissionsData body) throws ApiException { com.squareup.okhttp.Call call = postPermissionsValidateBeforeCall(objectType, body, null, null); return apiClient.execute(call); }
java
{ "resource": "" }
q16242
GameMap.move
train
Optional<PlayerKilled> move(Player player) { Move move = player.getMoves().poll(); if (move != null) { Tile from = tiles[move.getFrom()]; boolean armyBigEnough = from.getArmySize() > 1; boolean tileAndPlayerMatching = from.isOwnedBy(player.getPlayerIndex()); boolean oneStepAway = Stream.of(getTileAbove(from), getTileBelow(from), getTileLeftOf(from), getTileRightOf(from)) .filter(Optional::isPresent).map(Optional::get) .map(Tile::getTileIndex) .anyMatch(neighbourIndex -> neighbourIndex == move.getTo()); if (armyBigEnough && tileAndPlayerMatching && oneStepAway) { int armySize = from.moveFrom(move.half()); return tiles[move.getTo()] .moveTo(armySize, from.getOwnerPlayerIndex().get(), tiles) .map(this::transfer); } else { return move(player); } } return Optional.empty(); }
java
{ "resource": "" }
q16243
GameResult.getPlayerNames
train
public List<String> getPlayerNames() { return lastGameState.getPlayers().stream().map(Player::getUsername).collect(Collectors.toList()); }
java
{ "resource": "" }
q16244
Reflections.getField
train
public static Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException { if (clazz == Object.class) { return null; } try { Field field = clazz.getDeclaredField(fieldName); return field; } catch (NoSuchFieldException e) { return getField(clazz.getSuperclass(), fieldName); } }
java
{ "resource": "" }
q16245
NotificationsApi.connectCall
train
public com.squareup.okhttp.Call connectCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/notifications/connect"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); }
java
{ "resource": "" }
q16246
DelegatingPortletFilterProxy.invokeDelegate
train
protected void invokeDelegate( ActionFilter delegate, ActionRequest request, ActionResponse response, FilterChain filterChain) throws PortletException, IOException { delegate.doFilter(request, response, filterChain); }
java
{ "resource": "" }
q16247
DelegatingPortletFilterProxy.invokeDelegate
train
protected void invokeDelegate( EventFilter delegate, EventRequest request, EventResponse response, FilterChain filterChain) throws PortletException, IOException { delegate.doFilter(request, response, filterChain); }
java
{ "resource": "" }
q16248
DelegatingPortletFilterProxy.invokeDelegate
train
protected void invokeDelegate( RenderFilter delegate, RenderRequest request, RenderResponse response, FilterChain filterChain) throws PortletException, IOException { delegate.doFilter(request, response, filterChain); }
java
{ "resource": "" }
q16249
DelegatingPortletFilterProxy.invokeDelegate
train
protected void invokeDelegate( ResourceFilter delegate, ResourceRequest request, ResourceResponse response, FilterChain filterChain) throws PortletException, IOException { delegate.doFilter(request, response, filterChain); }
java
{ "resource": "" }
q16250
PortletPreAuthenticatedAuthenticationDetailsSource.buildDetails
train
public PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails buildDetails(PortletRequest context) { Collection<? extends GrantedAuthority> userGas = buildGrantedAuthorities(context); PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails result = new PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails(context, userGas); return result; }
java
{ "resource": "" }
q16251
Table._runDML
train
private boolean _runDML(DataManupulationStatement q, boolean isDDL){ boolean readOnly = ConnectionManager.instance().isPoolReadOnly(getPool()); Transaction txn = Database.getInstance().getCurrentTransaction(); if (!readOnly) { q.executeUpdate(); if (Database.getJdbcTypeHelper(getPool()).isAutoCommitOnDDL()) { txn.registerCommit(); }else { txn.commit(); } }else { cat.fine("Pool " + getPool() +" Skipped running" + q.getRealSQL()); } return !readOnly; }
java
{ "resource": "" }
q16252
PortletFilterChainProxy.getFilters
train
private List<PortletFilter> getFilters(PortletRequest request) { for (PortletSecurityFilterChain chain : filterChains) { if (chain.matches(request)) { return chain.getFilters(); } } return null; }
java
{ "resource": "" }
q16253
PortletFilterChainProxy.setFilterChainMap
train
@Deprecated public void setFilterChainMap(Map<RequestMatcher, List<PortletFilter>> filterChainMap) { filterChains = new ArrayList<PortletSecurityFilterChain>(filterChainMap.size()); for (Map.Entry<RequestMatcher,List<PortletFilter>> entry : filterChainMap.entrySet()) { filterChains.add(new DefaultPortletSecurityFilterChain(entry.getKey(), entry.getValue())); } }
java
{ "resource": "" }
q16254
PortletFilterChainProxy.getFilterChainMap
train
@Deprecated public Map<RequestMatcher, List<PortletFilter>> getFilterChainMap() { LinkedHashMap<RequestMatcher, List<PortletFilter>> map = new LinkedHashMap<RequestMatcher, List<PortletFilter>>(); for (PortletSecurityFilterChain chain : filterChains) { map.put(((DefaultPortletSecurityFilterChain)chain).getRequestMatcher(), chain.getFilters()); } return map; }
java
{ "resource": "" }
q16255
FileDisplayer.displaySearchLine
train
private void displaySearchLine(String line, String searchWord) throws IOException { int start = line.indexOf(searchWord); connection.write(line.substring(0,start)); connection.write(ANSI.INVERT_BACKGROUND); connection.write(searchWord); connection.write(ANSI.RESET); connection.write(line.substring(start + searchWord.length(), line.length())); }
java
{ "resource": "" }
q16256
PortletApplicationContextUtils2.getPortletApplicationContext
train
public static PortletApplicationContext getPortletApplicationContext(PortletContext pc, String attrName) { Assert.notNull(pc, "PortletContext must not be null"); Object attr = pc.getAttribute(attrName); if (attr == null) { return null; } if (attr instanceof RuntimeException) { throw (RuntimeException) attr; } if (attr instanceof Error) { throw (Error) attr; } if (attr instanceof Exception) { throw new IllegalStateException((Exception) attr); } if (!(attr instanceof PortletApplicationContext)) { throw new IllegalStateException("Context attribute is not of type PortletApplicationContext: " + attr.getClass() + " - " + attr); } return (PortletApplicationContext) attr; }
java
{ "resource": "" }
q16257
SimpleFileParser.setFile
train
public void setFile(File file) throws IOException { if(!file.isFile()) throw new IllegalArgumentException(file+" must be a file."); else { if(file.getName().endsWith("gz")) initGzReader(file); else initReader(file); } }
java
{ "resource": "" }
q16258
SimpleFileParser.setFileFromAJar
train
public void setFileFromAJar(String fileName) { InputStream is = this.getClass().getResourceAsStream(fileName); if(is != null) { this.fileName = fileName; reader = new InputStreamReader(is); } }
java
{ "resource": "" }
q16259
JsonReaderCodeGenerator.getTypeInfo
train
private TypeInfo getTypeInfo(Map<String, TypeInfo> typeMaps, String path, Class<?> superType) { TypeInfo typeInfo = typeMaps.get(path); if (typeInfo == null) { typeInfo = new TypeInfo(superType); typeMaps.put(path, typeInfo); } return typeInfo; }
java
{ "resource": "" }
q16260
PortletAuthenticationProcessingFilter.successfulAuthentication
train
protected void successfulAuthentication(PortletRequest request, PortletResponse response, Authentication authResult) { if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + authResult); } SecurityContextHolder.getContext().setAuthentication(authResult); // Fire event if (this.eventPublisher != null) { eventPublisher.publishEvent(new InteractiveAuthenticationSuccessEvent(authResult, this.getClass())); } }
java
{ "resource": "" }
q16261
SettingsApi.deleteTemplatesWithHttpInfo
train
public ApiResponse<Templates> deleteTemplatesWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = deleteTemplatesValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<Templates>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16262
SettingsApi.getApiEndpointsWithHttpInfo
train
public ApiResponse<ApiEndpointsSuccess> getApiEndpointsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getApiEndpointsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<ApiEndpointsSuccess>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16263
SettingsApi.getTemplatesWithHttpInfo
train
public ApiResponse<Templates> getTemplatesWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getTemplatesValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<Templates>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16264
SettingsApi.postApiEndpointsWithHttpInfo
train
public ApiResponse<ApiPostEndpointsSuccess> postApiEndpointsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = postApiEndpointsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<ApiPostEndpointsSuccess>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16265
SettingsApi.postTemplatesWithHttpInfo
train
public ApiResponse<Templates> postTemplatesWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = postTemplatesValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<Templates>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16266
SettingsApi.putTemplatesWithHttpInfo
train
public ApiResponse<Templates> putTemplatesWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = putTemplatesValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<Templates>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16267
SessionApi.getLogoutWithHttpInfo
train
public ApiResponse<GetLogout> getLogoutWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getLogoutValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetLogout>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16268
SessionApi.initProvisioningWithHttpInfo
train
public ApiResponse<ApiSuccessResponse> initProvisioningWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = initProvisioningValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16269
Hyaline.dtoFromScratch
train
public static <T> T dtoFromScratch(T entity, DTO dtoTemplate) throws HyalineException { return dtoFromScratch(entity, dtoTemplate, "Hyaline$Proxy$" + System.currentTimeMillis()); }
java
{ "resource": "" }
q16270
Hyaline.dtoFromScratch
train
public static <T> T dtoFromScratch(T entity, DTO dtoTemplate, String proxyClassName) throws HyalineException { try { return createDTO(entity, dtoTemplate, true, proxyClassName); } catch (CannotInstantiateProxyException | DTODefinitionException e) { e.printStackTrace(); throw new HyalineException(); } }
java
{ "resource": "" }
q16271
SamlSettingsApi.getEnabledWithHttpInfo
train
public ApiResponse<GetEnabledResponse> getEnabledWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getEnabledValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetEnabledResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16272
SamlSettingsApi.getLocationsWithHttpInfo
train
public ApiResponse<GetLocationResponse> getLocationsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getLocationsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetLocationResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16273
SamlSettingsApi.postLocationWithHttpInfo
train
public ApiResponse<PostLocationResponse> postLocationWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = postLocationValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<PostLocationResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16274
StatisticsApi.checkMigrateConflictsWithHttpInfo
train
public ApiResponse<GetSubResponse> checkMigrateConflictsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = checkMigrateConflictsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetSubResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16275
StatisticsApi.checkPostMigrateStatisticWithHttpInfo
train
public ApiResponse<CheckPostMigrateStatistic> checkPostMigrateStatisticWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = checkPostMigrateStatisticValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<CheckPostMigrateStatistic>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16276
StatisticsApi.getExportStatisticDefinitionsWithHttpInfo
train
public ApiResponse<GetExportStatisticDefinitions> getExportStatisticDefinitionsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getExportStatisticDefinitionsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetExportStatisticDefinitions>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16277
StatisticsApi.getStatisticDefinitionsWithHttpInfo
train
public ApiResponse<GetStatisticDefinitionsResponse> getStatisticDefinitionsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getStatisticDefinitionsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetStatisticDefinitionsResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16278
StatisticsApi.postImportStatisticDefinitionsWithHttpInfo
train
public ApiResponse<PostImportStatisticDefinitions> postImportStatisticDefinitionsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = postImportStatisticDefinitionsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<PostImportStatisticDefinitions>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16279
StatisticsApi.postStatisticDefinitionsWithHttpInfo
train
public ApiResponse<GetStatisticDefinitionsResponse> postStatisticDefinitionsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = postStatisticDefinitionsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetStatisticDefinitionsResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16280
QueueConfiguration.customGame
train
public static QueueConfiguration customGame(boolean force, String gameId, int team) { return new CustomGameQueueConfiguration(force, gameId, team); }
java
{ "resource": "" }
q16281
PortletRequestContextUtils.getPortletApplicationContext
train
public static PortletApplicationContext getPortletApplicationContext( PortletRequest request, PortletContext portletContext) throws IllegalStateException { PortletApplicationContext portletApplicationContext = (PortletApplicationContext) request.getAttribute( ContribDispatcherPortlet.PORTLET_APPLICATION_CONTEXT_ATTRIBUTE); if (portletApplicationContext == null) { if (portletContext == null) { throw new IllegalStateException("No PortletApplicationContext found: not in a DispatcherPortlet request?"); } portletApplicationContext = PortletApplicationContextUtils2.getRequiredPortletApplicationContext(portletContext); } return portletApplicationContext; }
java
{ "resource": "" }
q16282
PortletRequestContextUtils.getWebApplicationContext
train
public static ApplicationContext getWebApplicationContext( PortletRequest request, PortletContext portletContext) throws IllegalStateException { PortletApplicationContext portletApplicationContext = (PortletApplicationContext) request.getAttribute( ContribDispatcherPortlet.PORTLET_APPLICATION_CONTEXT_ATTRIBUTE); if (portletApplicationContext != null) { return portletApplicationContext; } if (portletContext == null) { throw new IllegalStateException("No PortletApplicationContext found: not in a DispatcherPortlet request?"); } portletApplicationContext = PortletApplicationContextUtils2.getPortletApplicationContext(portletContext); if (portletApplicationContext != null) { return portletApplicationContext; } return PortletApplicationContextUtils.getRequiredWebApplicationContext(portletContext); }
java
{ "resource": "" }
q16283
ProvisioningApi.initializeWithCode
train
public void initializeWithCode(String authCode, String redirectUri) throws ProvisioningApiException { initialize(null, authCode, redirectUri); }
java
{ "resource": "" }
q16284
UpdatableGameState.update
train
public UpdatableGameState update(GameUpdateApiResponse gameUpdateData) { return new UpdatableGameState( gameUpdateData.getTurn(), startData, MapPatcher.patch(gameUpdateData.getMapDiff(), rawMapArray), MapPatcher.patch(gameUpdateData.getCitiesDiff(), rawCitiesArray), gameUpdateData.getGenerals(), createPlayersInfo(startData, gameUpdateData), gameUpdateData.getAttackIndex()); }
java
{ "resource": "" }
q16285
MusicOnHoldApi.getMOHFilesWithHttpInfo
train
public ApiResponse<GetMOHFilesResponse> getMOHFilesWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getMOHFilesValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetMOHFilesResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16286
MusicOnHoldApi.getMOHSettingsWithHttpInfo
train
public ApiResponse<GetMOHSettings> getMOHSettingsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getMOHSettingsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetMOHSettings>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16287
OperationsApi.checkInactivityWithHttpInfo
train
public ApiResponse<PostCheckInactivity> checkInactivityWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = checkInactivityValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<PostCheckInactivity>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16288
OperationsApi.getSubWithHttpInfo
train
public ApiResponse<GetSubResponse> getSubWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getSubValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetSubResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16289
OperationsApi.postImportWithHttpInfo
train
public ApiResponse<PostImportResponse> postImportWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = postImportValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<PostImportResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16290
OperationsApi.postUsersWithHttpInfo
train
public ApiResponse<PostUsers> postUsersWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = postUsersValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<PostUsers>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16291
OperationsApi.postValidateImportWithHttpInfo
train
public ApiResponse<PostValidateImportResponse> postValidateImportWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = postValidateImportValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<PostValidateImportResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16292
OperationsApi.putUsersWithHttpInfo
train
public ApiResponse<PutUsers> putUsersWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = putUsersValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<PutUsers>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16293
PortletContextLoader.determineContextClass
train
protected Class<?> determineContextClass(PortletContext portletContext) { String contextClassName = portletContext.getInitParameter(CONTEXT_CLASS_PARAM); if (contextClassName != null) { try { return ClassUtils.forName(contextClassName, ClassUtils.getDefaultClassLoader()); } catch (ClassNotFoundException ex) { throw new ApplicationContextException( "Failed to load custom context class [" + contextClassName + "]", ex); } } else { contextClassName = defaultStrategies.getProperty(PortletApplicationContext.class.getName()); try { return ClassUtils.forName(contextClassName, PortletContextLoader.class.getClassLoader()); } catch (ClassNotFoundException ex) { throw new ApplicationContextException( "Failed to load default context class [" + contextClassName + "]", ex); } } }
java
{ "resource": "" }
q16294
SystemApi.argsWithHttpInfo
train
public ApiResponse<GetArgsResponse> argsWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = argsValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetArgsResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16295
SystemApi.dynconfigGetConfigWithHttpInfo
train
public ApiResponse<DynconfigGetConfigResponse> dynconfigGetConfigWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = dynconfigGetConfigValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<DynconfigGetConfigResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16296
SystemApi.getConfigWithHttpInfo
train
public ApiResponse<GetConfigResponse> getConfigWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = getConfigValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<GetConfigResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
{ "resource": "" }
q16297
UsersApi.deleteUser
train
public void deleteUser(String userDBID, Boolean keepPlaces) throws ProvisioningApiException { try { ApiSuccessResponse resp = usersApi.deleteUser(userDBID, keepPlaces); if (!resp.getStatus().getCode().equals(0)) { throw new ProvisioningApiException("Error deleting user. Code: " + resp.getStatus().getCode()); } } catch(ApiException e) { throw new ProvisioningApiException("Error deleting user", e); } }
java
{ "resource": "" }
q16298
UsersApi.updateUser
train
public void updateUser(String userDBID, User user) throws ProvisioningApiException { try { ApiSuccessResponse resp = usersApi.updateUser(userDBID, new UpdateUserData().data(Converters.convertUserToUpdateUserDataData(user))); if (!resp.getStatus().getCode().equals(0)) { throw new ProvisioningApiException("Error updating user. Code: " + resp.getStatus().getCode()); } } catch(ApiException e) { throw new ProvisioningApiException("Error updating user", e); } }
java
{ "resource": "" }
q16299
ObjectsApi.searchDnGroups
train
public Results<DnGroup> searchDnGroups(SearchParams searchParams) throws ProvisioningApiException { return searchDnGroups( searchParams.getLimit(), searchParams.getOffset(), searchParams.getSearchTerm(), searchParams.getSearchKey(), searchParams.getMatchMethod(), searchParams.getSortKey(), searchParams.getSortAscending(), searchParams.getSortMethod() ); }
java
{ "resource": "" }