use of com.pratilipi.data.type.Event in project pratilipi by Pratilipi.
the class EventDataUtil method createEventDataList.
public static List<EventData> createEventDataList(List<Event> eventList) {
List<Long> eventIdList = new ArrayList<>();
for (Event event : eventList) eventIdList.add(event.getId());
Map<Long, Page> eventPages = DataAccessorFactory.getDataAccessor().getPages(PageType.EVENT, eventIdList);
List<EventData> eventDataList = new ArrayList<>();
for (Event event : eventList) eventDataList.add(createEventData(event, eventPages.get(event.getId()), false));
return eventDataList;
}
use of com.pratilipi.data.type.Event in project pratilipi by Pratilipi.
the class DataAccessorMockImpl method createOrUpdateEvent.
@Override
public Event createOrUpdateEvent(Event event, AuditLog auditLog) {
if (event.getId() == null) {
long id = 1L;
for (Event e : EventMock.EVENT_TABLE) if (id <= e.getId())
id = e.getId() + 1;
((EventEntity) event).setId(id);
}
return event;
}
use of com.pratilipi.data.type.Event in project pratilipi by Pratilipi.
the class PratilipiListV1Api method get.
@Get
public Response get(GetRequest request) throws InsufficientAccessException, UnexpectedServerException {
PratilipiFilter pratilipiFilter = new PratilipiFilter();
pratilipiFilter.setAuthorId(request.authorId);
pratilipiFilter.setLanguage(request.language);
pratilipiFilter.setType(request.type);
pratilipiFilter.setListName(request.listName);
pratilipiFilter.setState(request.state);
pratilipiFilter.setOrderByLastUpdate(request.orderByLastUpdated);
DataListCursorTuple<PratilipiData> pratilipiListCursorTuple = PratilipiDataUtil.getPratilipiDataList(request.searchQuery, request.eventId, pratilipiFilter, request.cursor, request.offset, request.resultCount == null ? 20 : request.resultCount);
if (UxModeFilter.isAndroidApp()) {
DocAccessor docAccessor = DataAccessorFactory.getDocAccessor();
for (PratilipiData pratilipiData : pratilipiListCursorTuple.getDataList()) {
PratilipiContentDoc pcDoc = docAccessor.getPratilipiContentDoc(pratilipiData.getId());
if (pcDoc == null)
continue;
pratilipiData.setIndex(pcDoc.getIndex());
}
}
Response response = new Response(pratilipiListCursorTuple.getDataList(), pratilipiListCursorTuple.getCursor(), pratilipiListCursorTuple.getNumberFound());
if (UxModeFilter.isAndroidApp() && request.eventId != null && request.cursor == null) {
Event event = DataAccessorFactory.getDataAccessor().getEvent(request.eventId);
response.setBannerUrl(EventDataUtil.createEventBannerUrl(event));
response.setDescription(event.getDescription());
}
return response;
}
use of com.pratilipi.data.type.Event in project pratilipi by Pratilipi.
the class PratilipiListV2Api method get.
@Get
public Response get(GetRequest request) throws InsufficientAccessException, UnexpectedServerException {
PratilipiFilter pratilipiFilter = new PratilipiFilter();
pratilipiFilter.setAuthorId(request.authorId);
pratilipiFilter.setLanguage(request.language);
pratilipiFilter.setType(request.type);
pratilipiFilter.setListName(request.listName);
pratilipiFilter.setState(request.state);
pratilipiFilter.setOrderByLastUpdate(request.orderByLastUpdated);
DataListCursorTuple<PratilipiData> pratilipiListCursorTuple = PratilipiDataUtil.getPratilipiDataList(request.searchQuery, request.eventId, pratilipiFilter, request.cursor, request.offset, request.resultCount == null ? 20 : request.resultCount);
// Preparing & returning response object.
Response response = new Response(pratilipiListCursorTuple.getDataList(), pratilipiListCursorTuple.getCursor(), pratilipiListCursorTuple.getNumberFound());
if (UxModeFilter.isAndroidApp() && request.eventId != null && request.cursor == null) {
Event event = DataAccessorFactory.getDataAccessor().getEvent(request.eventId);
response.setBannerUrl(EventDataUtil.createEventBannerUrl(event));
response.setDescription(event.getDescription());
}
return response;
}
use of com.pratilipi.data.type.Event in project pratilipi by Pratilipi.
the class EventApi method get.
@Get
public Response get(GetRequest request) {
DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
Event event = dataAccessor.getEvent(request.eventId);
EventData eventData = EventDataUtil.createEventData(event, true);
return new Response(eventData);
}
Aggregations