Skip to content

Instantly share code, notes, and snippets.

View sizovs's full-sized avatar
🌴
Mentoring software developers @ principal.dev

Eduards Sizovs sizovs

🌴
Mentoring software developers @ principal.dev
View GitHub Profile
for f in $(find ABSOLUTE_PATH_TO_TRAVERSAL_ROOT -name '*.class'); do javap -c $f | sed -En 's/ [a-z]+[a-zA-Z0-9]*\(([a-zA-Z0-9,]+.?)*);/&/p' ; done | wc -l
public class DailyQuestionTemplateRowReader extends OrmRowReader<DailyQuestionTemplate> {
public DailyQuestionTemplateRowReader() {
super(new ColumnMappingBuilder<>(DailyQuestionTemplate.class)
.map("id").reader(new DailyQuestionTemplateIdColumnReader())
.map("text", "question_text")
.map("sponsorText")
.map("displayOn")
.map("createdAt"));
}
@RandomDAO(EntityType.SIMPLE_ENTITY)
@Slave
class DailyQuestionTemplateDAOImpl extends AEntityDAOMySQL<Long, DailyQuestionDTO> implements
DailyQuestionTemplateDAO {
private final DailyQuestionDTORowReader dailyQuestionDTORowReader;
private final DailyQuestionTemplateRowReader dailyQuestionTemplateRowReader;
public DailyQuestionTemplateDAOImpl(IConnectionLookup<Connection> lookup) {
super(lookup);
package fm.ask.domain.impl.question.templating;
import com.rubylight.dao.IDAOInstantiate;
import com.rubylight.dao.composite.CompositeDAOFactory;
import com.rubylight.dao.composite.SingleDAOFactoryInstanstiate;
import com.rubylight.dao.connection.IConnectionLookup;
import com.rubylight.dao.connection.IConnectionLookupFactory;
import com.rubylight.dao.observer.IDAOCallObserver;
import fm.ask.dao.AskfmDBConfigurationProvider;
import fm.ask.dao.EntityType;
@Autowired
@ConfigurableMap(value = "map", keyType = Long, valueType = Long)
private IConfProperty<Map<Long, Long>> map
@Autowired
@ConfigurableProperties(value = "props")
private IConfProperty<Properties> props
@Autowired
@ConfigurableList(value = "list", itemType = Long)
@Autowired
@ConfigurableMap(value = "map")
private IConfProperty<Map<Long, Long>> map
@Autowired
@ConfigurableProperties(value = "props")
private IConfProperty<Properties> props
@Autowired
@ConfigurableList(value = "list")
private static final String DAILY_QUESTION_TEMPLATE_CACHE = "dailyQuestionTemplate";
private final DailyQuestionTemplateDAO dailyQuestionTemplateDAO;
@Cacheable(DAILY_QUESTION_TEMPLATE_CACHE)
@Override
public DailyQuestionTemplate get(DailyQuestionTemplateId dailyQuestionTemplateId) {
DailyQuestionTemplate dailyQuestionTemplate = dailyQuestionTemplateDAO.getById(dailyQuestionTemplateId);
if (dailyQuestionTemplate == null) {
throw new EntityDoesNotExistException(dailyQuestionTemplateId);
@Repository
class DefaultDailyQuestionTemplateRepository implements DailyQuestionTemplateRepository {
private static final String DAILY_QUESTION_TEMPLATE_CACHE = "dailyQuestionTemplate";
private final DailyQuestionTemplateDAO dailyQuestionTemplateDAO;
@Cacheable(DAILY_QUESTION_TEMPLATE_CACHE)
@Override
public DailyQuestionTemplate get(DailyQuestionTemplateId dailyQuestionTemplateId) {
@Produces("illegal_action")
public class MaxNumberOfFolloweesReachedException extends FollowRelationshipAddingException {
@DegradesWithDefaultValue
@Override
public Collection<AnswerNotification> list(AuthorId authorId, Pageable page) {
String key = allNotificationsKey(authorId);
IRedisCacheDAO dao = shardedNotificationsDAOFactory.getDAOByUserId(authorId.asLong());
Set<Tuple> notifications = dao.zrevrangeWithScoresBinary(key, page.getFrom(), page.getTo() + 1);
return transform(notifications, new FromTuple());
}