method2testcases stringlengths 118 6.63k |
|---|
### Question:
IdUtils { public static byte[] toBytes(final UUID id) { if (id == null) { return null; } final byte[] buffer = new byte[16]; final ByteBuffer bb = ByteBuffer.wrap(buffer); bb.putLong(id.getMostSignificantBits()); bb.putLong(id.getLeastSignificantBits()); return buffer; } IdUtils(); static UUID create(); s... |
### Question:
IdUtils { public static UUID fromBytes(final byte[] b) { if (b == null || b.length != 16) { return null; } final ByteBuffer bb = ByteBuffer.wrap(b); return new UUID(bb.getLong(), bb.getLong()); } IdUtils(); static UUID create(); static UUID tryParse(final String str); static byte[] toBytes(final UUID id);... |
### Question:
Minitwit { @GET @Path("/public") public Response publicTimeline() { List<Message> messages = dao.getEntityManager() .createQuery("SELECT m FROM Message m ORDER BY m.id DESC", Message.class) .getResultList(); return renderTimeline(messages); } @GET Response timeline(); @GET @Path("/public") Response publi... |
### Question:
IOUtils { public static byte[] toByteArray(final InputStream input) throws IOException { final ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); } IOUtils(); static byte[] toByteArray(final InputStream input); static InputStream toInputStream(fin... |
### Question:
IOUtils { public static InputStream toInputStream(final String str, final Charset charset) { return new ByteArrayInputStream(str.getBytes(charset)); } IOUtils(); static byte[] toByteArray(final InputStream input); static InputStream toInputStream(final String str, final Charset charset); static String toS... |
### Question:
OptionalClasses { OptionalClasses() { throw new UnsupportedOperationException(); } OptionalClasses(); static final Class<Annotation> SERVER_ENDPOINT; static final Class<?> ENTITY_MANAGER_FACTORY; static final Class<?> ENTITY_MANAGER; }### Answer:
@Test public void testOptionalClasses() { assertNotNull(Op... |
### Question:
MinijaxPersistenceUnitInfo implements javax.persistence.spi.PersistenceUnitInfo { @Override public PersistenceUnitTransactionType getTransactionType() { throw new UnsupportedOperationException(); } MinijaxPersistenceUnitInfo(final String name, final String providerClassName); @Override String getPersisten... |
### Question:
MinijaxPersistenceUnitInfo implements javax.persistence.spi.PersistenceUnitInfo { @Override public DataSource getJtaDataSource() { throw new UnsupportedOperationException(); } MinijaxPersistenceUnitInfo(final String name, final String providerClassName); @Override String getPersistenceUnitName(); @Overrid... |
### Question:
MinijaxPersistenceUnitInfo implements javax.persistence.spi.PersistenceUnitInfo { @Override public DataSource getNonJtaDataSource() { throw new UnsupportedOperationException(); } MinijaxPersistenceUnitInfo(final String name, final String providerClassName); @Override String getPersistenceUnitName(); @Over... |
### Question:
MinijaxPersistenceUnitInfo implements javax.persistence.spi.PersistenceUnitInfo { @Override public List<String> getMappingFileNames() { throw new UnsupportedOperationException(); } MinijaxPersistenceUnitInfo(final String name, final String providerClassName); @Override String getPersistenceUnitName(); @Ov... |
### Question:
MinijaxPersistenceUnitInfo implements javax.persistence.spi.PersistenceUnitInfo { @Override public List<URL> getJarFileUrls() { throw new UnsupportedOperationException(); } MinijaxPersistenceUnitInfo(final String name, final String providerClassName); @Override String getPersistenceUnitName(); @Override S... |
### Question:
MinijaxPersistenceUnitInfo implements javax.persistence.spi.PersistenceUnitInfo { @Override public URL getPersistenceUnitRootUrl() { throw new UnsupportedOperationException(); } MinijaxPersistenceUnitInfo(final String name, final String providerClassName); @Override String getPersistenceUnitName(); @Overr... |
### Question:
MinijaxPersistenceUnitInfo implements javax.persistence.spi.PersistenceUnitInfo { @Override public boolean excludeUnlistedClasses() { throw new UnsupportedOperationException(); } MinijaxPersistenceUnitInfo(final String name, final String providerClassName); @Override String getPersistenceUnitName(); @Over... |
### Question:
Minitwit { @GET @Path("/{handle}/follow") @RolesAllowed("user") public Response followUser(@PathParam("handle") String handle) { security.getUserPrincipal().following.add(dao.readByHandle(User.class, handle)); dao.update(security.getUserPrincipal()); return Response.seeOther(URI.create("/")).build(); } @... |
### Question:
CharEscapeUtil { public static String escape(String s) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '=' || c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':' || c == '^' || c == '[' || c == ']' || c == '\"' |... |
### Question:
ManageHousekeepingService implements ChannelEventListener { @Override public void onChannelClose(String remoteAddr, Channel channel) { this.namesrvController.getRouteInfoManager().onChannelDestroy(remoteAddr, channel); } ManageHousekeepingService(NameSrvController namesrvController); @Override void onChan... |
### Question:
ManageHousekeepingService implements ChannelEventListener { @Override public void onChannelException(String remoteAddr, Channel channel) { this.namesrvController.getRouteInfoManager().onChannelDestroy(remoteAddr, channel); } ManageHousekeepingService(NameSrvController namesrvController); @Override void on... |
### Question:
ManageHousekeepingService implements ChannelEventListener { @Override public void onChannelIdle(String remoteAddr, Channel channel) { this.namesrvController.getRouteInfoManager().onChannelDestroy(remoteAddr, channel); } ManageHousekeepingService(NameSrvController namesrvController); @Override void onChann... |
### Question:
RouteInfoManager { public byte[] getGtsManagerInfo() { LiveManageInfo liveManageInfo = new LiveManageInfo(); List<GtsManageLiveAddr> brokerLiveAddrs=this.liveTable.values().stream(). filter(item->Objects.nonNull(item)). map(item-> new GtsManageLiveAddr(item.getGtsManageId(), item.getLastUpdateTimestamp(),... |
### Question:
DefaultRequestProcessor implements NettyRequestProcessor { @Override public RemotingCommand processRequest(ChannelHandlerContext ctx,RemotingCommand request) throws RemotingCommandException { if (log.isDebugEnabled()) { log.debug("receive request, {} {} {}", request.getCode(), RemotingHelper.parseChannelR... |
### Question:
FrequentlyRelatedContentRequestParameterValidator implements SearchRequestParameterValidator { @Override public ValidationMessage validateParameters(Map<String, String> requestParameters) { String id = requestParameters.get(idParameter); if(id == null || id.length()==0) return INVALID_ID_MESSAGE; else ret... |
### Question:
DisruptorBasedRelatedItemIndexRequestProcessor implements RelatedItemIndexRequestProcessor { @Override public IndexRequestPublishingStatus processRequest(Configuration config, ByteBuffer data) { if(canIndex) { try { boolean published = ringBuffer.tryPublishEvent(requestConverter.createConverter(config,dat... |
### Question:
RelatedItemSearch { public RelatedItemSearch copy(Configuration config) { RelatedItemSearch newCopy = new RelatedItemSearch(config,this.getAdditionalSearchCriteria().getNumberOfProperties()); newCopy.setRelatedItemId(this.relatedItemId); newCopy.setMaxResults(this.maxResults); newCopy.setRelatedItemSearch... |
### Question:
RelatedItemSearchFactoryWithSearchLookupKeyFactory implements RelatedItemSearchFactory { @Override public RelatedItemSearch createSearchObject() { return new RelatedItemSearch(configuration); } RelatedItemSearchFactoryWithSearchLookupKeyFactory(Configuration config, RelatedItemSearchLookupKeyGenerator loo... |
### Question:
RelatedItemSearchFactoryWithSearchLookupKeyFactory implements RelatedItemSearchFactory { @Override public RelatedItemSearch newInstance() { return createSearchObject(); } RelatedItemSearchFactoryWithSearchLookupKeyFactory(Configuration config, RelatedItemSearchLookupKeyGenerator lookupKeyGenerator); @Over... |
### Question:
RelatedItemSearchFactoryWithSearchLookupKeyFactory implements RelatedItemSearchFactory { @Override public void populateSearchObject(RelatedItemSearch objectToPopulate, RelatedItemSearchType type, Map<String, String> properties) { objectToPopulate.setStartOfRequestNanos(System.nanoTime()); String sizeKey =... |
### Question:
BasicRelatedItemIndexingMessageConverter implements RelatedItemIndexingMessageConverter { public static RelatedItemInfo[][] relatedIds(RelatedItemInfo[] ids, int length) { int len = length; RelatedItemInfo[][] idSets = new RelatedItemInfo[len][len]; for(int j = 0;j<len;j++) { idSets[0][j] = ids[j]; } for(... |
### Question:
RelatedItemIndexingMessageFactory implements EventFactory<RelatedItemIndexingMessage> { @Override public RelatedItemIndexingMessage newInstance() { return new RelatedItemIndexingMessage(configuration); } RelatedItemIndexingMessageFactory(Configuration configuration); @Override RelatedItemIndexingMessage n... |
### Question:
RelatedItemReferenceMessageFactory implements EventFactory<RelatedItemReference> { @Override public RelatedItemReference newInstance() { return new RelatedItemReference(); } RelatedItemReferenceMessageFactory(); @Override RelatedItemReference newInstance(); }### Answer:
@Test public void testCanCreateRef... |
### Question:
ElasticSearchRelatedItemHttpGetRepository implements RelatedItemGetRepository { public static Map<String,String> processResults(String responseBody) { JSONParser parser = new JSONParser(JSONParser.MODE_RFC4627); try { JSONObject object = (JSONObject)parser.parse(responseBody); Object results = object.get(... |
### Question:
AHCHttpSniffAvailableNodes implements SniffAvailableNodes { @Override public Set<String> getAvailableNodes(String[] hosts) { Set<String> newHosts = new TreeSet<>(); for(String host : hosts) { HttpResult result = AHCRequestExecutor.executeSearch(client, HttpMethod.GET, host, NODE_ENDPOINT, null); if(result... |
### Question:
NodeOrTransportBasedElasticSearchClientFactoryCreator implements ElasticSearchClientFactoryCreator { @Override public ElasticSearchClientFactory getElasticSearchClientConnectionFactory(Configuration configuration) { ElasticSearchClientFactory factory; switch(configuration.getElasticSearchClientType()) { c... |
### Question:
RoundRobinDisruptorBasedRelatedContentSearchRequestProcessorHandler implements RelatedContentSearchRequestProcessorHandler { @Override public void onEvent(RelatedItemSearchRequest event, long sequence, boolean endOfBatch) throws Exception { handleRequest(event,searchRequestExecutor[this.currentIndex++ & m... |
### Question:
RelatedItemSearchRequestTranslator implements IncomingSearchRequestTranslator { @Override public void translateTo(RelatedItemSearchRequest event, long sequence, RelatedItemSearchType type, Map<String,String> params, SearchResponseContext[] contexts) { log.debug("Creating Related Product Search Request {},... |
### Question:
RoundRobinRelatedContentSearchRequestProcessorHandlerFactory implements RelatedContentSearchRequestProcessorHandlerFactory { @Override public RelatedContentSearchRequestProcessorHandler createHandler(Configuration config, RelatedItemSearchResultsToResponseGateway gateway,RelatedItemSearchExecutorFactory s... |
### Question:
DisruptorRelatedItemSearchResultsToResponseGateway implements RelatedItemSearchResultsToResponseGateway { @Override public void storeResponseContextForSearchRequest(SearchRequestLookupKey key, SearchResponseContext[] context) { ringBuffer.publishEvent(storeResponseContextTranslator,key,context); } Disrupt... |
### Question:
DisruptorRelatedItemSearchResultsToResponseGateway implements RelatedItemSearchResultsToResponseGateway { @Override public void sendSearchResultsToResponseContexts(SearchResultEventWithSearchRequestKey[] multipleSearchResults) { ringBuffer.publishEvent(processSearchResultsTranslator,multipleSearchResults)... |
### Question:
MapBasedSearchResponseContextHandlerLookup implements SearchResponseContextHandlerLookup { @Override public SearchResponseContextHandler getHandler(Class responseClassToHandle) { SearchResponseContextHandler handler = mappings.get(responseClassToHandle); return handler == null ? defaultMapping : handler; ... |
### Question:
HttpAsyncSearchResponseContextHandler implements SearchResponseContextHandler<AsyncContext> { @Override public void sendResults(String resultsAsString, String mediaType, SearchResultsEvent results, SearchResponseContext<AsyncContext> sctx) { AsyncContext ctx = sctx.getSearchResponseContext(); HttpServletR... |
### Question:
JsonSmartIndexingRequestConverterFactory implements IndexingRequestConverterFactory { @Override public IndexingRequestConverter createConverter(Configuration configuration, ByteBuffer convertFrom) throws InvalidIndexingRequestException { return new JsonSmartIndexingRequestConverter(configuration,dateCreat... |
### Question:
JsonSmartIndexingRequestConverter implements IndexingRequestConverter { @Override public void translateTo(RelatedItemIndexingMessage convertedTo, long sequence) { convertedTo.setValidMessage(true); convertedTo.setUTCFormattedDate(date); parseProductArray(convertedTo,maxNumberOfAdditionalProperties); parse... |
### Question:
JodaUTCCurrentDateAndHourAndMinuteFormatter implements UTCCurrentDateAndHourAndMinuteFormatter { @Override public String getCurrentDayAndHourAndMinute() { DateTime dt = new DateTime(); DateTime utc =dt.withZone(DateTimeZone.UTC); return formatter.print(utc); } @Override String getCurrentDayAndHourAndMinu... |
### Question:
JodaUTCCurrentDateAndHourAndMinuteFormatter implements UTCCurrentDateAndHourAndMinuteFormatter { @Override public String parseToDateAndHourAndMinute(String dateAndOrTime) { return formatter.print(formatterUTC.parseDateTime(dateAndOrTime)); } @Override String getCurrentDayAndHourAndMinute(); @Override Str... |
### Question:
JodaISO8601UTCCurrentDateAndTimeFormatter implements ISO8601UTCCurrentDateAndTimeFormatter { @Override public String getCurrentDay() { DateTime dt = new DateTime(); DateTime utc =dt.withZone(DateTimeZone.UTC); StringBuilderWriter b = new StringBuilderWriter(24); try { formatter.printTo(b,utc); } catch (IO... |
### Question:
JodaISO8601UTCCurrentDateAndTimeFormatter implements ISO8601UTCCurrentDateAndTimeFormatter { @Override public String formatToUTC(String day) { StringBuilderWriter b = new StringBuilderWriter(24); try { formatterUTCPrinter.printTo(b,formatterUTC.parseDateTime(day)); } catch (IOException e) { } return b.toS... |
### Question:
JodaUTCCurrentDateAndHourFormatter implements UTCCurrentDateAndHourFormatter { @Override public String getCurrentDayAndHour() { DateTime dt = new DateTime(); DateTime utc =dt.withZone(DateTimeZone.UTC); return formatter.print(utc); } @Override String getCurrentDayAndHour(); @Override String parseToDateAn... |
### Question:
JodaUTCCurrentDateAndHourFormatter implements UTCCurrentDateAndHourFormatter { @Override public String parseToDateAndHour(String dateAndOrTime) { return formatter.print(formatterUTC.parseDateTime(dateAndOrTime)); } @Override String getCurrentDayAndHour(); @Override String parseToDateAndHour(String dateAn... |
### Question:
ResizableByteBufferWithMaxArraySizeChecking implements ResizableByteBuffer { @Override public void append(byte b) { checkSizeAndGrow(1); appendNoResize(b); } ResizableByteBufferWithMaxArraySizeChecking(int initialCapacity, int maxCapacity); @Override int size(); @Override void reset(); @Override byte[] ge... |
### Question:
ElasticSearchRelatedItemIndexingRepository implements RelatedItemStorageRepository { @Override @PreDestroy public void shutdown() { log.debug("Shutting down ElasticSearchRelatedItemIndexingRepository"); try { elasticSearchClientFactory.shutdown(); } catch(Exception e) { } } ElasticSearchRelatedItemIndexin... |
### Question:
ElasticSearchRelatedItemHttpIndexingRepository implements RelatedItemStorageRepository { @Override @PreDestroy public void shutdown() { log.debug("Shutting down ElasticSearchRelatedItemIndexingRepository"); try { elasticClient.shutdown(); } catch(Exception e) { } } ElasticSearchRelatedItemHttpIndexingRepo... |
### Question:
HourBasedStorageLocationMapper implements RelatedItemStorageLocationMapper { @Override public String getLocationName(RelatedItem product) { String dateStr = product.getDate(); String date; if(dateStr==null) { date = currentDayFormatter.getCurrentDayAndHour(); } else { date = currentDayFormatter.parseToDat... |
### Question:
MinuteBasedStorageLocationMapper implements RelatedItemStorageLocationMapper { @Override public String getLocationName(RelatedItem product) { String dateStr = product.getDate(); String date; if(dateStr==null) { date = currentDayFormatter.getCurrentDayAndHourAndMinute(); } else { date = currentDayFormatter... |
### Question:
BatchingRelatedItemReferenceEventHandler implements RelatedItemReferenceEventHandler { @Override public void onEvent(RelatedItemReference request, long l, boolean endOfBatch) throws Exception { try { relatedItems.add(request.getReference()); if(endOfBatch || --this.count[COUNTER_POS] == 0) { try { log.deb... |
### Question:
BatchingRelatedItemReferenceEventHandler implements RelatedItemReferenceEventHandler { public void shutdown() { try { storageRepository.shutdown(); } catch(Exception e) { log.error("Problem shutting down storage repository"); } } BatchingRelatedItemReferenceEventHandler(int batchSize,
... |
### Question:
BatchingRelatedItemReferenceEventHanderFactory implements RelatedItemReferenceEventHandlerFactory { @Override public RelatedItemReferenceEventHandler getHandler() { return new BatchingRelatedItemReferenceEventHandler(configuration.getIndexBatchSize(),repository.getRepository(configuration),locationMapper)... |
### Question:
RoundRobinRelatedItemIndexingMessageEventHandler implements RelatedItemIndexingMessageEventHandler { public void shutdown() { if(!shutdown) { shutdown=true; for(RelatedItemReferenceEventHandler handler : handlers) { try { handler.shutdown(); } catch(Exception e) { log.error("Issue terminating handler",e);... |
### Question:
SingleRelatedItemIndexingMessageEventHandler implements RelatedItemIndexingMessageEventHandler { @Override public void onEvent(RelatedItemIndexingMessage request, long l, boolean endOfBatch) throws Exception { if(!request.isValidMessage()) { log.debug("Invalid indexing message. Ignoring message"); return;... |
### Question:
SingleRelatedItemIndexingMessageEventHandler implements RelatedItemIndexingMessageEventHandler { @Override public void shutdown() { if(!shutdown) { shutdown = true; try { storageRepository.shutdown(); } catch(Exception e) { log.warn("Unable to shutdown respository client"); } } } SingleRelatedItemIndexing... |
### Question:
TotalResult { @NonNull public List<CheckInfo> getList() { return mList; } TotalResult(@NonNull List<CheckInfo> list, @CheckingState int checkState); @NonNull List<CheckInfo> getList(); @CheckingState int getCheckState(); }### Answer:
@Test public void getList() throws Exception { assertEquals(totalResult... |
### Question:
TotalResult { @CheckingState public int getCheckState() { return mCheckState; } TotalResult(@NonNull List<CheckInfo> list, @CheckingState int checkState); @NonNull List<CheckInfo> getList(); @CheckingState int getCheckState(); }### Answer:
@Test public void getCheckState() throws Exception { assertEquals... |
### Question:
CheckInfo { @CheckingMethodType public int getTypeCheck() { return mTypeCheck; } CheckInfo(@Nullable Boolean state,@CheckingMethodType int typeCheck); @Nullable Boolean getState(); void setState(@Nullable Boolean state); @CheckingMethodType int getTypeCheck(); void setTypeCheck(int typeCheck); @Override b... |
### Question:
CheckInfo { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof CheckInfo)) return false; CheckInfo checkInfo = (CheckInfo) o; if (mTypeCheck != checkInfo.mTypeCheck) return false; return mState != null ? mState.equals(checkInfo.mState) : checkInfo.mState == null; } ... |
### Question:
CheckInfo { @Override public int hashCode() { int result = mState != null ? mState.hashCode() : 0; result = 31 * result + mTypeCheck; return result; } CheckInfo(@Nullable Boolean state,@CheckingMethodType int typeCheck); @Nullable Boolean getState(); void setState(@Nullable Boolean state); @CheckingMethod... |
### Question:
ChecksHelper { @StringRes public static int getCheckStringId(@CheckingMethodType int typeCheck) { @StringRes int result = 0; switch (typeCheck) { case CH_TYPE_TEST_KEYS: result = R.string.checks_desc_1; break; case CH_TYPE_DEV_KEYS: result = R.string.checks_desc_2; break; case CH_TYPE_NON_RELEASE_KEYS: re... |
### Question:
GmsSecurityException extends SecurityException { public String getPath() { return path; } GmsSecurityException(final String path); GmsSecurityException(final String path, final String message); GmsSecurityException(final String path, final String message, final Throwable throwable); String getPath(); st... |
### Question:
DAOProvider { public BAuthorizationDAO getBAuthorizationDAO() { if (DatabaseDriver.fromJdbcUrl(url) == DatabaseDriver.POSTGRESQL) { return new PostgreSQLBAuthorizationDAO(queryService); } throw new NullPointerException(NOT_IMPLEMENTED_YET); } @Autowired DAOProvider(final QueryService queryService); BAuth... |
### Question:
DAOProvider { public BPermissionDAO getBPermissionDAO() { if (DatabaseDriver.fromJdbcUrl(url) == DatabaseDriver.POSTGRESQL) { return new PostgreSQLBPermissionDAO(queryService); } throw new NullPointerException(NOT_IMPLEMENTED_YET); } @Autowired DAOProvider(final QueryService queryService); BAuthorization... |
### Question:
ConfigurationService { public boolean isApplicationConfigured() { return configurationRepository.count() > 0; } @Autowired ConfigurationService(final BConfigurationRepository configurationRepository,
final EUserRepository userRepository, final EOwnedEntityRepository entity... |
### Question:
ConfigurationService { public boolean isDefaultConfigurationCreated() { BConfiguration isMultiEntity = new BConfiguration( ConfigKey.IS_MULTI_ENTITY_APP_IN_SERVER.toString(), String.valueOf(dc.getIsMultiEntity()) ); BConfiguration isUserRegistrationAllowed = new BConfiguration( String.valueOf(ConfigKey.IS... |
### Question:
ConfigurationService { public boolean isDefaultUserAssignedToEntityWithRole() { EUser u = userRepository.findFirstByUsernameOrEmail(dc.getUserAdminDefaultName(), dc.getUserAdminDefaultEmail()); if (u != null) { EOwnedEntity e = entityRepository.findFirstByUsername(dc.getEntityDefaultUsername()); if (e != ... |
### Question:
ConfigurationService { public Map<String, String> getConfig() { List<BConfiguration> configs = configurationRepository.findAllByKeyEndingWith(IN_SERVER); Map<String, String> map = new HashMap<>(); for (BConfiguration c : configs) { map.put(c.getKey(), c.getValue()); } return map; } @Autowired Configurati... |
### Question:
ConfigurationService { public Map<String, Object> getConfigByUser(final long userId) { final List<BConfiguration> configs = configurationRepository.findAllByUserId(userId); Map<String, Object> map = new HashMap<>(); for (BConfiguration c : configs) { map.put(c.getKey(), c.getValue()); } return map; } @Aut... |
### Question:
ConfigurationService { public void saveConfig(final Map<String, Object> configs) throws NotFoundEntityException, GmsGeneralException { if (configs.get("user") != null) { try { long id = Long.parseLong(configs.remove("user").toString()); saveConfig(configs, id); } catch (NumberFormatException e) { throw Gm... |
### Question:
ConfigurationService { public void setUserRegistrationAllowed(final boolean userRegistrationAllowed) { insertOrUpdateValue(ConfigKey.IS_USER_REGISTRATION_ALLOWED_IN_SERVER, userRegistrationAllowed); this.userRegistrationAllowed = userRegistrationAllowed; } @Autowired ConfigurationService(final BConfigura... |
### Question:
GmsError { public void addError(final String field, final String message) { if (errors.get(field) == null) { LinkedList<String> l = new LinkedList<>(); l.add(message); errors.put(field, l); } else { errors.get(field).add(message); } } GmsError(); void addError(final String field, final String message); vo... |
### Question:
ConfigurationService { public void setIsMultiEntity(final boolean isMultiEntity) { insertOrUpdateValue(ConfigKey.IS_MULTI_ENTITY_APP_IN_SERVER, isMultiEntity); this.multiEntity = isMultiEntity; } @Autowired ConfigurationService(final BConfigurationRepository configurationRepository,
... |
### Question:
ConfigurationService { public Long getLastAccessedEntityIdByUser(final long userId) { String v = getValueByUser(ConfigKey.LAST_ACCESSED_ENTITY.toString(), userId); return v != null ? Long.parseLong(v) : null; } @Autowired ConfigurationService(final BConfigurationRepository configurationRepository,
... |
### Question:
ConfigurationService { public void setLastAccessedEntityIdByUser(final long userId, final long entityId) { insertOrUpdateValue(ConfigKey.LAST_ACCESSED_ENTITY, entityId, userId); } @Autowired ConfigurationService(final BConfigurationRepository configurationRepository,
final... |
### Question:
AppService { public boolean isInitialLoadOK() { if (initialLoadOK == null) { boolean ok = true; if (!configurationService.isApplicationConfigured()) { ok = configurationService.isDefaultConfigurationCreated(); ok = ok && permissionService.areDefaultPermissionsCreatedSuccessfully(); ok = ok && roleService.... |
### Question:
QueryService { public Query createQuery(final String qls) { return entityManager.createQuery(qls); } Query createQuery(final String qls); Query createQuery(final String qls, final Class<?> clazz); Query createNativeQuery(final String sql); Query createNativeQuery(final String sql, final Class<?> clazz); ... |
### Question:
LinkPath { public static String get(final String what) { return String.format("%s.%s.%s", LINK, what, HREF); } private LinkPath(); static String get(final String what); static String getSelf(final String what); static String get(); static final String EMBEDDED; static final String PAGE_SIZE_PARAM_META; s... |
### Question:
QueryService { public Query createNativeQuery(final String sql) { return entityManager.createNativeQuery(sql); } Query createQuery(final String qls); Query createQuery(final String qls, final Class<?> clazz); Query createNativeQuery(final String sql); Query createNativeQuery(final String sql, final Class... |
### Question:
UserService implements UserDetailsService { public EUser createDefaultUser() { EUser u = new EUser( dc.getUserAdminDefaultUsername(), dc.getUserAdminDefaultEmail(), dc.getUserAdminDefaultName(), dc.getUserAdminDefaultLastName(), dc.getUserAdminDefaultPassword() ); u.setEnabled(true); return signUp(u, Emai... |
### Question:
UserService implements UserDetailsService { public List<Long> addRolesToUser(final Long userId, final Long entityId, final Iterable<Long> rolesId) throws NotFoundEntityException { return addRemoveRolesToFromUser(userId, entityId, rolesId, true); } EUser createDefaultUser(); EUser signUp(final EUser u, fi... |
### Question:
UserService implements UserDetailsService { public List<Long> removeRolesFromUser(final Long userId, final Long entityId, final Iterable<Long> rolesId) throws NotFoundEntityException { return addRemoveRolesToFromUser(userId, entityId, rolesId, false); } EUser createDefaultUser(); EUser signUp(final EUser... |
### Question:
UserService implements UserDetailsService { @Override public UserDetails loadUserByUsername(final String usernameOrEmail) { EUser u = userRepository.findFirstByUsernameOrEmail(usernameOrEmail, usernameOrEmail); if (u != null) { return u; } throw new UsernameNotFoundException(msg.getMessage(USER_NOT_FOUND)... |
### Question:
UserService implements UserDetailsService { public String getUserAuthoritiesForToken(final String usernameOrEmail, final String separator) { StringBuilder authBuilder = new StringBuilder(); EUser u = (EUser) loadUserByUsername(usernameOrEmail); if (u != null) { Long entityId = getEntityIdByUser(u); if (en... |
### Question:
UserService implements UserDetailsService { public Map<String, List<BRole>> getRolesForUser(final Long id) throws NotFoundEntityException { EUser u = getUser(id); return authorizationRepository.getRolesForUserOverAllEntities(u.getId()); } EUser createDefaultUser(); EUser signUp(final EUser u, final Email... |
### Question:
UserService implements UserDetailsService { public List<BRole> getRolesForUserOverEntity(final Long userId, final Long entityId) throws NotFoundEntityException { return authorizationRepository.getRolesForUserOverEntity( getUser(userId).getId(), getOwnedEntity(entityId).getId() ); } EUser createDefaultUse... |
### Question:
UserService implements UserDetailsService { public Long getEntityIdByUser(final EUser u) { Long entityId = configService.getLastAccessedEntityIdByUser(u.getId()); if (entityId == null) { BAuthorization anAuth = authorizationRepository.findFirstByUserAndEntityNotNullAndRoleEnabled(u, true); if (anAuth == n... |
### Question:
LinkPath { public static String getSelf(final String what) { return String.format("%s.%s.%s", LINK, SELF, what); } private LinkPath(); static String get(final String what); static String getSelf(final String what); static String get(); static final String EMBEDDED; static final String PAGE_SIZE_PARAM_MET... |
### Question:
OwnedEntityService { public EOwnedEntity createDefaultEntity() { return entityRepository.save(new EOwnedEntity( dc.getEntityDefaultName(), dc.getEntityDefaultUsername(), dc.getEntityDefaultDescription()) ); } EOwnedEntity createDefaultEntity(); EOwnedEntity create(final EOwnedEntity e); }### Answer:
@Te... |
### Question:
OwnedEntityService { public EOwnedEntity create(final EOwnedEntity e) throws GmsGeneralException { if (configService.isMultiEntity()) { return entityRepository.save(e); } throw GmsGeneralException.builder() .messageI18N("entity.add.not_allowed") .finishedOK(true).httpStatus(HttpStatus.CONFLICT) .build(); ... |
### Question:
RoleService { public BRole createDefaultRole() { BRole role = new BRole(dc.getRoleAdminDefaultLabel()); role.setDescription(dc.getRoleAdminDefaultDescription()); role.setEnabled(dc.isRoleAdminDefaultEnabled()); final Iterable<BPermission> permissions = permissionRepository.findAll(); for (BPermission p : ... |
### Question:
RoleService { public List<Long> addPermissionsToRole(final long roleId, final Iterable<Long> permissionsId) throws NotFoundEntityException { return addRemovePermissionToFromRole(roleId, permissionsId, ActionOverRolePermissions.ADD_PERMISSIONS); } BRole createDefaultRole(); List<Long> addPermissionsToRole... |
### Question:
RoleService { public BRole getRole(final long id) throws NotFoundEntityException { Optional<BRole> r = repository.findById(id); if (!r.isPresent()) { throw new NotFoundEntityException(ROLE_NOT_FOUND); } return r.get(); } BRole createDefaultRole(); List<Long> addPermissionsToRole(final long roleId, final ... |
### Question:
RoleService { public List<Long> removePermissionsFromRole(final long roleId, final Iterable<Long> permissionsId) throws NotFoundEntityException { return addRemovePermissionToFromRole(roleId, permissionsId, ActionOverRolePermissions.REMOVE_PERMISSIONS); } BRole createDefaultRole(); List<Long> addPermissio... |
### Question:
RoleService { public List<Long> updatePermissionsInRole(final long roleId, final Iterable<Long> permissionsId) throws NotFoundEntityException { return addRemovePermissionToFromRole(roleId, permissionsId, ActionOverRolePermissions.UPDATE_PERMISSIONS); } BRole createDefaultRole(); List<Long> addPermissions... |
### Question:
PermissionService { public List<BPermission> findPermissionsByUserIdAndEntityId(final long userId, final long entityId) { return repository.findPermissionsByUserIdAndEntityId(userId, entityId); } boolean areDefaultPermissionsCreatedSuccessfully(); List<BPermission> findPermissionsByUserIdAndEntityId(fina... |
### Question:
AuthenticationFacadeImpl implements AuthenticationFacade { @Override public Authentication getAuthentication() { return SecurityContextHolder.getContext().getAuthentication(); } @Override Authentication getAuthentication(); @Override void setAuthentication(final Authentication authentication); }### Answ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.