_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q158600 | ObjectQueryService.generateQuery | train | public String generateQuery(String filter,
Collection<String> attributes, String attributeValue) {
// Build LDAP query for objects having at least one attribute and with
// the given search filter
StringBuilder ldapQuery = new StringBuilder();
ldapQuery.append("(&");
... | java | {
"resource": ""
} |
q158601 | ObjectQueryService.search | train | public List<LDAPEntry> search(LDAPConnection ldapConnection,
String baseDN, String query) throws GuacamoleException {
logger.debug("Searching \"{}\" for objects matching \"{}\".", baseDN, query);
try {
// Search within subtree of given base DN
LDAPSearchResults res... | java | {
"resource": ""
} |
q158602 | AuthenticationService.getLoggableAddress | train | private String getLoggableAddress(HttpServletRequest request) {
// Log X-Forwarded-For, if present and valid
String header = request.getHeader("X-Forwarded-For");
if (header != null && X_FORWARDED_FOR.matcher(header).matches())
return "[" + header + ", " + request.getRemoteAddr() + ... | java | {
"resource": ""
} |
q158603 | AuthenticationService.authenticateUser | train | private AuthenticatedUser authenticateUser(Credentials credentials)
throws GuacamoleException {
GuacamoleCredentialsException authFailure = null;
// Attempt authentication against each AuthenticationProvider
for (AuthenticationProvider authProvider : authProviders) {
// At... | java | {
"resource": ""
} |
q158604 | AuthenticationService.updateAuthenticatedUser | train | private AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser authenticatedUser,
Credentials credentials) throws GuacamoleException {
// Get original AuthenticationProvider
AuthenticationProvider authProvider = authenticatedUser.getAuthenticationProvider();
// Re-authenticate... | java | {
"resource": ""
} |
q158605 | AuthenticationService.getAuthenticatedUser | train | private AuthenticatedUser getAuthenticatedUser(GuacamoleSession existingSession,
Credentials credentials) throws GuacamoleException {
try {
// Re-authenticate user if session exists
if (existingSession != null) {
AuthenticatedUser updatedUser = updateAuthent... | java | {
"resource": ""
} |
q158606 | AuthenticationService.getUserContexts | train | private List<DecoratedUserContext> getUserContexts(GuacamoleSession existingSession,
AuthenticatedUser authenticatedUser, Credentials credentials)
throws GuacamoleException {
List<DecoratedUserContext> userContexts =
new ArrayList<DecoratedUserContext>(authProviders.size... | java | {
"resource": ""
} |
q158607 | AuthenticationService.authenticate | train | public String authenticate(Credentials credentials, String token)
throws GuacamoleException {
// Pull existing session if token provided
GuacamoleSession existingSession;
if (token != null)
existingSession = tokenSessionMap.get(token);
else
existingSessio... | java | {
"resource": ""
} |
q158608 | AuthenticationService.getGuacamoleSession | train | public GuacamoleSession getGuacamoleSession(String authToken)
throws GuacamoleException {
// Try to get the session from the map of logged in users.
GuacamoleSession session = tokenSessionMap.get(authToken);
// Authentication failed.
if (session == null)
... | java | {
"resource": ""
} |
q158609 | AuthenticationService.destroyGuacamoleSession | train | public boolean destroyGuacamoleSession(String authToken) {
// Remove corresponding GuacamoleSession if the token is valid
GuacamoleSession session = tokenSessionMap.remove(authToken);
if (session == null)
return false;
// Invalidate the removed session
session.inval... | java | {
"resource": ""
} |
q158610 | UserTunnel.getActiveConnection | train | public ActiveConnection getActiveConnection() throws GuacamoleException {
// Pull the UUID of the current tunnel
UUID uuid = getUUID();
// Get the directory of active connections
Directory<ActiveConnection> activeConnectionDirectory = userContext.getActiveConnectionDirectory();
... | java | {
"resource": ""
} |
q158611 | ExtensionModule.bindAuthenticationProvider | train | private void bindAuthenticationProvider(
Class<? extends AuthenticationProvider> authenticationProvider,
Set<String> tolerateFailures) {
// Bind authentication provider
logger.debug("[{}] Binding AuthenticationProvider \"{}\".",
boundAuthenticationProviders.size(... | java | {
"resource": ""
} |
q158612 | ExtensionModule.bindAuthenticationProviders | train | private void bindAuthenticationProviders(
Collection<Class<AuthenticationProvider>> authProviders,
Set<String> tolerateFailures) {
// Bind each authentication provider within extension
for (Class<AuthenticationProvider> authenticationProvider : authProviders)
bindAut... | java | {
"resource": ""
} |
q158613 | ExtensionModule.getToleratedAuthenticationProviders | train | private Set<String> getToleratedAuthenticationProviders() {
// Parse list of auth providers whose internal failures should be
// tolerated
try {
return environment.getProperty(SKIP_IF_UNAVAILABLE, Collections.<String>emptySet());
}
// Use empty set by default if pro... | java | {
"resource": ""
} |
q158614 | AuthenticationProviderService.getRadiusChallenge | train | private CredentialsInfo getRadiusChallenge(RadiusPacket challengePacket) {
// Try to get the state attribute - if it's not there, we have a problem
RadiusAttribute stateAttr = challengePacket.findAttribute(Attr_State.TYPE);
if (stateAttr == null) {
logger.error("Something went wrong... | java | {
"resource": ""
} |
q158615 | AuthenticatedUser.init | train | public void init(String username, Credentials credentials) {
this.credentials = credentials;
setIdentifier(username.toLowerCase());
} | java | {
"resource": ""
} |
q158616 | JDBCInjectorProvider.get | train | public Injector get() throws GuacamoleException {
// Return existing Injector if already created
Injector value = injector.get();
if (value != null)
return value;
// Explicitly create and store new Injector only if necessary
injector.compareAndSet(null, create());
... | java | {
"resource": ""
} |
q158617 | PermissionSetResource.updatePermissionSet | train | private <PermissionType extends Permission> void updatePermissionSet(
APIPatch.Operation operation,
PermissionSetPatch<PermissionType> permissionSetPatch,
PermissionType permission) throws GuacamoleException {
// Add or remove permission based on operation
switch (op... | java | {
"resource": ""
} |
q158618 | TicketValidationService.validateTicket | train | public String validateTicket(String ticket, Credentials credentials) throws GuacamoleException {
// Retrieve the configured CAS URL, establish a ticket validator,
// and then attempt to validate the supplied ticket. If that succeeds,
// grab the principal returned by the validator.
URI... | java | {
"resource": ""
} |
q158619 | TicketValidationService.decryptPassword | train | private final String decryptPassword(String encryptedPassword)
throws GuacamoleException {
// If we get nothing, we return nothing.
if (encryptedPassword == null || encryptedPassword.isEmpty()) {
logger.warn("No or empty encrypted password, no password will be available.");
... | java | {
"resource": ""
} |
q158620 | ModeledPermissionService.getPermissionInstances | train | protected Set<PermissionType> getPermissionInstances(Collection<ModelType> models) {
// Create new collection of permissions by manually converting each model
Set<PermissionType> permissions = new HashSet<PermissionType>(models.size());
for (ModelType model : models)
permissions.add... | java | {
"resource": ""
} |
q158621 | ModeledPermissionService.getModelInstances | train | protected Collection<ModelType> getModelInstances(
ModeledPermissions<? extends EntityModel> targetEntity,
Collection<PermissionType> permissions) {
// Create new collection of models by manually converting each permission
Collection<ModelType> models = new ArrayList<ModelType>(... | java | {
"resource": ""
} |
q158622 | SessionRESTService.getSessionResource | train | @Path("/")
public SessionResource getSessionResource(@QueryParam("token") String authToken)
throws GuacamoleException {
// Return a resource exposing the retrieved session
GuacamoleSession session = authenticationService.getGuacamoleSession(authToken);
return sessionResourceFact... | java | {
"resource": ""
} |
q158623 | SharedObjectManager.register | train | public void register(T object) {
// If already invalidated (or invalidation is in progress), avoid adding
// the object unnecessarily - just cleanup now
if (invalidated.get()) {
cleanup(object);
return;
}
// Store provided object
objects.add(obje... | java | {
"resource": ""
} |
q158624 | AbstractPermissionService.getRelevantPermissionSet | train | protected ObjectPermissionSet getRelevantPermissionSet(ModeledUser user,
ModeledPermissions<? extends EntityModel> targetEntity)
throws GuacamoleException {
if (targetEntity.isUser())
return user.getUserPermissions();
if (targetEntity.isUserGroup())
retu... | java | {
"resource": ""
} |
q158625 | AbstractPermissionService.canReadPermissions | train | protected boolean canReadPermissions(ModeledAuthenticatedUser user,
ModeledPermissions<? extends EntityModel> targetEntity)
throws GuacamoleException {
// A user can always read their own permissions
if (targetEntity.isUser(user.getUser().getIdentifier()))
return tru... | java | {
"resource": ""
} |
q158626 | UserService.retrieveAuthenticatedUser | train | public ModeledAuthenticatedUser retrieveAuthenticatedUser(AuthenticationProvider authenticationProvider,
Credentials credentials) throws GuacamoleException {
// Get username and password
String username = credentials.getUsername();
String password = credentials.getPassword();
... | java | {
"resource": ""
} |
q158627 | UserService.retrieveUser | train | public ModeledUser retrieveUser(AuthenticationProvider authenticationProvider,
AuthenticatedUser authenticatedUser) throws GuacamoleException {
// If we already queried this user, return that rather than querying again
if (authenticatedUser instanceof ModeledAuthenticatedUser)
r... | java | {
"resource": ""
} |
q158628 | UserService.resetExpiredPassword | train | public void resetExpiredPassword(ModeledUser user, Credentials credentials)
throws GuacamoleException {
UserModel userModel = user.getModel();
// Get username
String username = user.getIdentifier();
// Pull new password from HTTP request
HttpServletRequest request ... | java | {
"resource": ""
} |
q158629 | UserService.getObjectInstances | train | protected List<ActivityRecord> getObjectInstances(List<ActivityRecordModel> models) {
// Create new list of records by manually converting each model
List<ActivityRecord> objects = new ArrayList<ActivityRecord>(models.size());
for (ActivityRecordModel model : models)
objects.add(get... | java | {
"resource": ""
} |
q158630 | UserService.retrieveHistory | train | public List<ActivityRecord> retrieveHistory(ModeledAuthenticatedUser authenticatedUser,
ModeledUser user) throws GuacamoleException {
String username = user.getIdentifier();
// Retrieve history only if READ permission is granted
if (hasObjectPermission(authenticatedUser, username, ... | java | {
"resource": ""
} |
q158631 | SchemaResource.getProtocols | train | @GET
@Path("protocols")
public Map<String, ProtocolInfo> getProtocols() throws GuacamoleException {
// Get and return a map of all protocols.
Environment env = new LocalEnvironment();
return env.getProtocols();
} | java | {
"resource": ""
} |
q158632 | GuacamoleWebSocketTunnelEndpoint.closeConnection | train | private void closeConnection(Session session, int guacamoleStatusCode,
int webSocketCode) {
try {
CloseCode code = CloseReason.CloseCodes.getCloseCode(webSocketCode);
String message = Integer.toString(guacamoleStatusCode);
session.close(new CloseReason(code, mess... | java | {
"resource": ""
} |
q158633 | DateField.format | train | public static String format(Date date) {
DateFormat dateFormat = new SimpleDateFormat(DateField.FORMAT);
return date == null ? null : dateFormat.format(date);
} | java | {
"resource": ""
} |
q158634 | TunnelResource.getActiveConnection | train | @Path("activeConnection")
public DirectoryObjectResource<ActiveConnection, APIActiveConnection>
getActiveConnection() throws GuacamoleException {
// Pull the UserContext from the tunnel
UserContext userContext = tunnel.getUserContext();
// Fail if the active connection cannot be fo... | java | {
"resource": ""
} |
q158635 | TunnelResource.getStream | train | @Path("streams/{index}/{filename}")
public StreamResource getStream(@PathParam("index") final int streamIndex,
@QueryParam("type") @DefaultValue(DEFAULT_MEDIA_TYPE) String mediaType,
@PathParam("filename") String filename)
throws GuacamoleException {
return new StreamRes... | java | {
"resource": ""
} |
q158636 | ProviderFactory.newInstance | train | static <T> T newInstance(String typeName, Class<? extends T> providerClass) {
T instance = null;
try {
// Attempt to instantiate the provider
instance = providerClass.getConstructor().newInstance();
}
catch (NoSuchMethodException e) {
logger.error("Th... | java | {
"resource": ""
} |
q158637 | ActiveConnectionService.hasObjectPermissions | train | private boolean hasObjectPermissions(ModeledAuthenticatedUser user,
String identifier, ObjectPermission.Type type)
throws GuacamoleException {
ObjectPermissionSet permissionSet = getPermissionSet(user);
return user.getUser().isAdministrator()
||... | java | {
"resource": ""
} |
q158638 | StreamInterceptingTunnel.interceptStream | train | public void interceptStream(int index, OutputStream stream)
throws GuacamoleException {
// Log beginning of intercepted stream
logger.debug("Intercepting output stream #{} of tunnel \"{}\".",
index, getUUID());
try {
outputStreamFilter.interceptStream(in... | java | {
"resource": ""
} |
q158639 | StreamInterceptingTunnel.interceptStream | train | public void interceptStream(int index, InputStream stream)
throws GuacamoleException {
// Log beginning of intercepted stream
logger.debug("Intercepting input stream #{} of tunnel \"{}\".",
index, getUUID());
try {
inputStreamFilter.interceptStream(index... | java | {
"resource": ""
} |
q158640 | PermissionSetPatch.apply | train | public void apply(PermissionSet<PermissionType> permissionSet)
throws GuacamoleException {
// Add any added permissions
if (!addedPermissions.isEmpty())
permissionSet.addPermissions(addedPermissions);
// Remove any removed permissions
if (!removedPermissions.isEmpty... | java | {
"resource": ""
} |
q158641 | StreamResource.getStreamContents | train | @GET
public Response getStreamContents() {
// Intercept all output
StreamingOutput stream = new StreamingOutput() {
@Override
public void write(OutputStream output) throws IOException {
try {
tunnel.interceptStream(streamIndex, output);
... | java | {
"resource": ""
} |
q158642 | StreamResource.setStreamContents | train | @POST
@Consumes(MediaType.WILDCARD)
public void setStreamContents(InputStream data) throws GuacamoleException {
// Send input over stream
tunnel.interceptStream(streamIndex, data);
} | java | {
"resource": ""
} |
q158643 | LDAPConnectionService.createLDAPConnection | train | private LDAPConnection createLDAPConnection() throws GuacamoleException {
// Map encryption method to proper connection and socket factory
EncryptionMethod encryptionMethod = confService.getEncryptionMethod();
switch (encryptionMethod) {
// Unencrypted LDAP connection
c... | java | {
"resource": ""
} |
q158644 | LDAPConnectionService.bindAs | train | public LDAPConnection bindAs(String userDN, String password)
throws GuacamoleException {
// Obtain appropriately-configured LDAPConnection instance
LDAPConnection ldapConnection = createLDAPConnection();
// Configure LDAP connection constraints
LDAPConstraints ldapConstrain... | java | {
"resource": ""
} |
q158645 | LDAPConnectionService.disconnect | train | public void disconnect(LDAPConnection ldapConnection) {
// Attempt disconnect
try {
ldapConnection.disconnect();
}
// Warn if disconnect unexpectedly fails
catch (LDAPException e) {
logger.warn("Unable to disconnect from LDAP server: {}", e.getMessage())... | java | {
"resource": ""
} |
q158646 | ConnectionGroupResource.getConnectionGroupTree | train | @GET
@Path("tree")
public APIConnectionGroup getConnectionGroupTree(
@QueryParam("permission") List<ObjectPermission.Type> permissions)
throws GuacamoleException {
// Retrieve the requested tree, filtering by the given permissions
ConnectionGroupTree tree = new Connectio... | java | {
"resource": ""
} |
q158647 | ConfigurationService.getDigits | train | public int getDigits() throws GuacamoleException {
// Validate legal number of digits
int digits = environment.getProperty(TOTP_DIGITS, 6);
if (digits < 6 || digits > 8)
throw new GuacamoleServerException("TOTP codes may have no fewer "
+ "than 6 digits and no mo... | java | {
"resource": ""
} |
q158648 | ConfigurationService.getMode | train | public TOTPGenerator.Mode getMode() throws GuacamoleException {
return environment.getProperty(TOTP_MODE, TOTPGenerator.Mode.SHA1);
} | java | {
"resource": ""
} |
q158649 | EntityService.retrieveEffectiveGroups | train | @Transactional
public Set<String> retrieveEffectiveGroups(ModeledPermissions<? extends EntityModel> entity,
Collection<String> effectiveGroups) {
// Retrieve the effective user groups of the given entity, recursively if possible
boolean recursive = environment.isRecursiveQuerySupported(... | java | {
"resource": ""
} |
q158650 | MySQLVersion.isAtLeast | train | public boolean isAtLeast(MySQLVersion version) {
// If the databases use different version numbering schemes, the
// version numbers are not comparable
if (isMariaDB != version.isMariaDB)
return false;
// Compare major, minor, and patch number in order of precedence
... | java | {
"resource": ""
} |
q158651 | SimpleUser.addReadPermissions | train | private void addReadPermissions(Set<ObjectPermission> permissions,
Collection<String> identifiers) {
// Add a READ permission to the set for each identifier given
identifiers.forEach(identifier ->
permissions.add(new ObjectPermission(
ObjectPermission.Type.READ,
... | java | {
"resource": ""
} |
q158652 | TSMetaDataObjectTransformation.generateAsResource | train | private static boolean generateAsResource(MetaDataObject metaDataObject) {
if (metaDataObject instanceof MetaResource) {
return true;
}
List<MetaDataObject> subTypes = metaDataObject.getSubTypes(true, false);
if (!subTypes.isEmpty()) {
for (MetaDataObject subType : subTypes) {
if (generateAsResource(s... | java | {
"resource": ""
} |
q158653 | ModuleRegistry.addModule | train | public void addModule(Module module) {
LOGGER.debug("adding module {}", module);
module.setupModule(new ModuleContextImpl(module));
modules.add(module);
} | java | {
"resource": ""
} |
q158654 | TypeParser.addParser | train | public <T> void addParser(Class<T> clazz, StringParser<T> parser) {
parsers.put(clazz, parser);
} | java | {
"resource": ""
} |
q158655 | TypeParser.addMapper | train | public <T> void addMapper(Class<T> clazz, StringMapper<T> mapper) {
addParser(clazz, mapper);
mappers.put(clazz, mapper);
} | java | {
"resource": ""
} |
q158656 | JpaEntityRepositoryBase.getIdFromEntity | train | @SuppressWarnings("unchecked")
protected I getIdFromEntity(EntityManager em, Object entity, ResourceField idField) {
Object pk = em.getEntityManagerFactory().getPersistenceUnitUtil().getIdentifier(entity);
PreconditionUtil.verify(pk != null, "pk not available for entity %s", entity);
if (pk ... | java | {
"resource": ""
} |
q158657 | CrnkBoot.boot | train | public void boot() {
LOGGER.debug("performing setup");
checkNotConfiguredYet();
configured = true;
// Set the properties provider into the registry early
// so that it is available to the modules being bootstrapped
moduleRegistry.setPropertiesProvider(propertiesProvider)... | java | {
"resource": ""
} |
q158658 | JsonApiRequestProcessor.isJsonApiRequest | train | @SuppressWarnings("UnnecessaryLocalVariable")
public static boolean isJsonApiRequest(HttpRequestContext requestContext, boolean acceptPlainJson) {
String method = requestContext.getMethod().toUpperCase();
boolean isPatch = method.equals(HttpMethod.PATCH.toString());
boolean isPost = method.equals(HttpMethod.POST... | java | {
"resource": ""
} |
q158659 | JpaResourceInformationProvider.handleIdOverride | train | private void handleIdOverride(Class<?> resourceClass, List<ResourceField> fields) {
List<ResourceField> idFields = fields.stream()
.filter(field -> field.getResourceFieldType() == ResourceFieldType.ID)
.collect(Collectors.toList());
if (idFields.size() == 2) {
... | java | {
"resource": ""
} |
q158660 | CrnkFeature.registerActionRepositories | train | private void registerActionRepositories(FeatureContext context, CrnkBoot boot) {
ResourceRegistry resourceRegistry = boot.getResourceRegistry();
Collection<RegistryEntry> registryEntries = resourceRegistry.getEntries();
for (RegistryEntry registryEntry : registryEntries) {
ResourceRe... | java | {
"resource": ""
} |
q158661 | IncludeRelationshipLoader.lookupRelatedResource | train | @SuppressWarnings("unchecked")
public Result<Set<Resource>> lookupRelatedResource(IncludeRequest request, Collection<Resource> sourceResources,
ResourceField relationshipField) {
if (sourceResources.isEmpty()) {
return resultFactory.just(Collections.emptySet());
}
// directly load where relat... | java | {
"resource": ""
} |
q158662 | ConstraintViolationExceptionMapper.resolvePath | train | private ResourceRef resolvePath(ConstraintViolation<?> violation) {
Object resource = violation.getRootBean();
Object nodeObject = resource;
ResourceRef ref = new ResourceRef(resource);
Iterator<Node> iterator = violation.getPropertyPath().iterator();
while (iterator.hasNext()) {
Node node = iterator.nex... | java | {
"resource": ""
} |
q158663 | JsonApiResponseFilter.filter | train | @Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
Object response = responseContext.getEntity();
if (response == null) {
if (feature.getBoot().isNullDataResponseEnabled()) {
Document document = new Document();... | java | {
"resource": ""
} |
q158664 | JsonApiResponseFilter.getRegistryEntry | train | private Optional<RegistryEntry> getRegistryEntry(Object response) {
if (response != null) {
Class responseClass = response.getClass();
boolean resourceList = ResourceList.class.isAssignableFrom(responseClass);
if (resourceList) {
ResourceList responseList = (R... | java | {
"resource": ""
} |
q158665 | QueryBuilder.applyDistinct | train | protected int applyDistinct() {
int numAutoSelections = 0;
boolean distinct;
if (query.autoDistinct) {
// distinct for many join/fetches or manual
// in case of ViewQuery we may not need this here, but we need to do
// the selection of order-by columns below
distinct = query.autoDistinct && !query.aut... | java | {
"resource": ""
} |
q158666 | JpaModule.newServerModule | train | @Deprecated
public static JpaModule newServerModule(EntityManagerFactory emFactory, EntityManager em,
TransactionRunner transactionRunner) {
JpaModuleConfig config = new JpaModuleConfig();
config.exposeAllEntities(emFactory);
return new JpaModule(c... | java | {
"resource": ""
} |
q158667 | ResourceInformation.setupManyNesting | train | private boolean setupManyNesting() {
BeanAttributeInformation parentAttribute = null;
BeanAttributeInformation idAttribute = null;
BeanInformation beanInformation = BeanInformation.get(idField.getType());
for (String attributeName : beanInformation.getAttributeNames()) {
Bean... | java | {
"resource": ""
} |
q158668 | ResourceInformation.toIdString | train | public String toIdString(Object id) {
if (id == null) {
return null;
}
return idStringMapper.toString(id);
} | java | {
"resource": ""
} |
q158669 | BaseController.handle | train | @Override
@Deprecated
public final Response handle(JsonPath jsonPath, QueryAdapter queryAdapter, Document requestDocument) {
Result<Response> response = handleAsync(jsonPath, queryAdapter, requestDocument);
PreconditionUtil.verify(response != null, "no response by controller provided");
... | java | {
"resource": ""
} |
q158670 | ClassUtils.getClassFields | train | public static List<Field> getClassFields(Class<?> beanClass) {
Map<String, Field> resultMap = new HashMap<>();
LinkedList<Field> results = new LinkedList<>();
Class<?> currentClass = beanClass;
while (currentClass != null && currentClass != Object.class) {
for (Field field : currentClass.getDeclaredFields()... | java | {
"resource": ""
} |
q158671 | ClassUtils.getAnnotation | train | public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) {
Class<?> currentClass = beanClass;
while (currentClass != null && currentClass != Object.class) {
if (currentClass.isAnnotationPresent(annotationClass)) {
return Optional.of(currentClass.getAnnotati... | java | {
"resource": ""
} |
q158672 | ClassUtils.findClassField | train | public static Field findClassField(Class<?> beanClass, String fieldName) {
Class<?> currentClass = beanClass;
while (currentClass != null && currentClass != Object.class) {
for (Field field : currentClass.getDeclaredFields()) {
if (field.isSynthetic()) {
continue;
}
if (field.getName().equals(f... | java | {
"resource": ""
} |
q158673 | ClassUtils.getClassSetters | train | public static List<Method> getClassSetters(Class<?> beanClass) {
Map<String, Method> result = new HashMap<>();
Class<?> currentClass = beanClass;
while (currentClass != null && currentClass != Object.class) {
for (Method method : currentClass.getDeclaredMethods()) {
if (!method.isSynthetic() && isSetter(m... | java | {
"resource": ""
} |
q158674 | ClassUtils.getRawType | train | @Deprecated
public static Class<?> getRawType(Type type) {
if (type instanceof Class) {
return (Class<?>) type;
} else if (type instanceof ParameterizedType) {
return getRawType(((ParameterizedType) type).getRawType());
} else if (type instanceof TypeVariable<?>) {
return getRawType(((TypeVariable<?>) t... | java | {
"resource": ""
} |
q158675 | SecurityModule.reconfigure | train | public void reconfigure(SecurityConfig config) {
this.config = config;
LOGGER.debug("reconfiguring with {} rules", config.getRules().size());
Map<String, Map<String, ResourcePermission>> newPermissions = new HashMap<>();
for (SecurityRule rule : config.getRules()) {
String ... | java | {
"resource": ""
} |
q158676 | SecurityModule.isUserInRole | train | public boolean isUserInRole(String role) {
if (!isEnabled()) {
throw new IllegalStateException("security module is disabled");
}
checkInit();
SecurityProvider securityProvider = context.getSecurityProvider();
boolean contained = role == ALL_ROLE || securityProvider.is... | java | {
"resource": ""
} |
q158677 | CrnkClient.findModules | train | public void findModules() {
ServiceLoader<ClientModuleFactory> loader = ServiceLoader.load(ClientModuleFactory.class);
Iterator<ClientModuleFactory> iterator = loader.iterator();
while (iterator.hasNext()) {
ClientModuleFactory factory = iterator.next();
Module module = ... | java | {
"resource": ""
} |
q158678 | TypescriptUtils.getNestedTypeContainer | train | public static TSModule getNestedTypeContainer(TSType type, boolean create) {
TSContainerElement parent = (TSContainerElement) type.getParent();
if (parent == null) {
return null;
}
int insertionIndex = parent.getElements().indexOf(type);
return getModule(parent, type.getName(), insertionIndex, create);
} | java | {
"resource": ""
} |
q158679 | TypescriptUtils.toFileName | train | public static String toFileName(String name) {
char[] charArray = name.toCharArray();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < charArray.length; i++) {
if (Character.isUpperCase(charArray[i]) && i > 0 && !Character.isUpperCase(charArray[i - 1])) {
builder.append('.');
}
builde... | java | {
"resource": ""
} |
q158680 | JsonLinksInformation.as | train | @Override
public <L extends LinksInformation> L as(Class<L> linksClass) {
try {
ObjectReader reader = mapper.readerFor(linksClass);
return reader.readValue(data);
} catch (IOException e) {
throw new IllegalStateException(e);
}
} | java | {
"resource": ""
} |
q158681 | OperationsModule.apply | train | public List<OperationResponse> apply(List<Operation> operations, QueryContext queryContext) {
checkAccess(operations, queryContext);
enrichTypeIdInformation(operations);
List<OrderedOperation> orderedOperations = orderStrategy.order(operations);
DefaultOperationFilterChain chain = new DefaultOperationFilterCh... | java | {
"resource": ""
} |
q158682 | OperationsModule.checkAccess | train | private void checkAccess(List<Operation> operations, QueryContext queryContext) {
for (Operation operation : operations) {
checkAccess(operation, queryContext);
}
} | java | {
"resource": ""
} |
q158683 | DocumentMapper.compact | train | private void compact(Document doc, QueryAdapter queryAdapter) {
if (queryAdapter != null && queryAdapter.getCompactMode()) {
if (doc.getIncluded() != null) {
compact(doc.getIncluded());
}
if (doc.getData().isPresent()) {
if (doc.isMultiple()) {
compact(doc.getCollectionData().get());
} else ... | java | {
"resource": ""
} |
q158684 | JpaModuleConfig.addRepository | train | public <T> void addRepository(JpaRepositoryConfig<T> config) {
Class<?> resourceClass = config.getResourceClass();
if (repositoryConfigurationMap.containsKey(resourceClass)) {
throw new IllegalStateException(resourceClass.getName() + " is already registered");
}
repositoryCon... | java | {
"resource": ""
} |
q158685 | JpaModuleConfig.exposeAllEntities | train | public void exposeAllEntities(EntityManagerFactory emf) {
Set<ManagedType<?>> managedTypes = emf.getMetamodel().getManagedTypes();
for (ManagedType<?> managedType : managedTypes) {
Class<?> managedJavaType = managedType.getJavaType();
if (managedJavaType.getAnnotation(Entity.clas... | java | {
"resource": ""
} |
q158686 | JpaRepositoryConfig.builder | train | public static <E> JpaRepositoryConfig.Builder<E> builder(Class<E> entityClass) {
JpaRepositoryConfig.Builder<E> builder = new JpaRepositoryConfig.Builder<>();
builder.entityClass = entityClass;
builder.resourceClass = entityClass;
return builder;
} | java | {
"resource": ""
} |
q158687 | JpaRepositoryConfig.builder | train | public static <E, D> JpaRepositoryConfig.Builder<D> builder(Class<E> entityClass, Class<D> dtoClass,
JpaMapper<E, D> mapper) {
JpaRepositoryConfig.Builder<D> builder = new JpaRepositoryConfig.Builder<>();
builder.entityClass = entityClass;
... | java | {
"resource": ""
} |
q158688 | PreconditionUtil.fail | train | public static void fail(String message, Object... args) {
throw new IllegalStateException(message == null ? "" : String.format(message, args));
} | java | {
"resource": ""
} |
q158689 | ResourceFilterDirectoryImpl.canAccess | train | @Override
public boolean canAccess(ResourceField field, HttpMethod method, QueryContext queryContext, boolean allowIgnore) {
if (field == null) {
return true;
}
FilterBehavior filterBehavior = get(field, method, queryContext);
if (filterBehavior == FilterBehavior.NONE) {
... | java | {
"resource": ""
} |
q158690 | AnyUtils.findAttribute | train | public static MetaAttribute findAttribute(MetaDataObject meta, Object value) {
if (value == null) {
throw new IllegalArgumentException("null as value not supported");
}
for (MetaAttribute attr : meta.getAttributes()) {
if (attr.getName().equals(TYPE_ATTRIBUTE)) {
continue;
}
if (attr.isDerived())... | java | {
"resource": ""
} |
q158691 | ClassManagerImpl.setClassPath | train | @Override
public void setClassPath( URL [] cp ) {
baseClassPath.setPath( cp );
initBaseLoader();
loaderMap = new HashMap();
classLoaderChanged();
} | java | {
"resource": ""
} |
q158692 | ClassManagerImpl.reloadAllClasses | train | @Override
public void reloadAllClasses() throws ClassPathException
{
BshClassPath bcp = new BshClassPath("temp");
bcp.addComponent( baseClassPath );
bcp.addComponent( BshClassPath.getUserClassPath() );
setClassPath( bcp.getPathComponents() );
} | java | {
"resource": ""
} |
q158693 | ClassManagerImpl.reloadClasses | train | @Override
public void reloadClasses( String [] classNames )
throws ClassPathException
{
clearCaches();
// validate that it is a class here?
// init base class loader if there is none...
if ( baseLoader == null )
initBaseLoader();
DiscreteFilesClassL... | java | {
"resource": ""
} |
q158694 | ClassManagerImpl.getClassPath | train | public BshClassPath getClassPath() throws ClassPathException
{
if ( fullClassPath != null )
return fullClassPath;
fullClassPath = new BshClassPath("BeanShell Full Class Path");
fullClassPath.addComponent( BshClassPath.getUserClassPath() );
try {
fullClassPath... | java | {
"resource": ""
} |
q158695 | ClassManagerImpl.classLoaderChanged | train | @Override
protected void classLoaderChanged()
{
Vector toRemove = new Vector(); // safely remove
for ( Enumeration e = listeners.elements(); e.hasMoreElements(); )
{
WeakReference wr = (WeakReference)e.nextElement();
Listener l = (Listener)wr.get();
if... | java | {
"resource": ""
} |
q158696 | CallStack.get | train | public NameSpace get(int depth) {
int size = stack.size();
if ( depth >= size )
return NameSpace.JAVACODE;
return stack.toArray(new NameSpace[size])[size-1-depth];
} | java | {
"resource": ""
} |
q158697 | CallStack.set | train | public synchronized void set(int depth, NameSpace ns) {
stack.set( stack.size()-1-depth, ns );
} | java | {
"resource": ""
} |
q158698 | CallStack.swap | train | public NameSpace swap( NameSpace newTop ) {
NameSpace oldTop = stack.pop();
stack.push(newTop);
return oldTop;
} | java | {
"resource": ""
} |
q158699 | ClassWriter.replaceAsmInstructions | train | private byte[] replaceAsmInstructions(final byte[] classFile, final boolean hasFrames) {
Attribute[] attributes = getAttributePrototypes();
firstField = null;
lastField = null;
firstMethod = null;
lastMethod = null;
firstAttribute = null;
compute = hasFrames ? MethodWriter.COMPUTE_INSERTED_F... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.