use of com.axelor.apps.crm.db.repo.EventRepository in project axelor-open-suite by axelor.
the class EventController method applyChangesToAll.
public void applyChangesToAll(ActionRequest request, ActionResponse response) {
EventRepository eventRepository = Beans.get(EventRepository.class);
Event thisEvent = eventRepository.find(new Long(request.getContext().get("_idEvent").toString()));
Event event = eventRepository.find(thisEvent.getId());
Beans.get(EventService.class).applyChangesToAll(event);
response.setCanClose(true);
response.setReload(true);
}
use of com.axelor.apps.crm.db.repo.EventRepository in project axelor-open-suite by axelor.
the class EventController method deleteNext.
@Transactional
public void deleteNext(ActionRequest request, ActionResponse response) {
Long eventId = new Long(request.getContext().getParent().get("id").toString());
EventRepository eventRepository = Beans.get(EventRepository.class);
Event event = eventRepository.find(eventId);
Event child = eventRepository.all().filter("self.parentEvent.id = ?1", event.getId()).fetchOne();
while (child != null) {
child.setParentEvent(null);
eventRepository.remove(event);
event = child;
child = eventRepository.all().filter("self.parentEvent.id = ?1", event.getId()).fetchOne();
}
response.setCanClose(true);
response.setReload(true);
}
use of com.axelor.apps.crm.db.repo.EventRepository in project axelor-open-suite by axelor.
the class EventController method deleteAll.
@Transactional
public void deleteAll(ActionRequest request, ActionResponse response) {
Long eventId = new Long(request.getContext().getParent().get("id").toString());
EventRepository eventRepository = Beans.get(EventRepository.class);
Event event = eventRepository.find(eventId);
Event child = eventRepository.all().filter("self.parentEvent.id = ?1", event.getId()).fetchOne();
Event parent = event.getParentEvent();
while (child != null) {
child.setParentEvent(null);
eventRepository.remove(event);
event = child;
child = eventRepository.all().filter("self.parentEvent.id = ?1", event.getId()).fetchOne();
}
while (parent != null) {
Event nextParent = parent.getParentEvent();
eventRepository.remove(parent);
parent = nextParent;
}
response.setCanClose(true);
response.setReload(true);
}
use of com.axelor.apps.crm.db.repo.EventRepository in project axelor-open-suite by axelor.
the class EventController method assignToMeEvent.
@SuppressWarnings("rawtypes")
public void assignToMeEvent(ActionRequest request, ActionResponse response) {
EventRepository eventRepository = Beans.get(EventRepository.class);
if (request.getContext().get("id") != null) {
Event event = eventRepository.find((Long) request.getContext().get("id"));
event.setUser(AuthUtils.getUser());
Beans.get(EventService.class).saveEvent(event);
} else if (!((List) request.getContext().get("_ids")).isEmpty()) {
for (Event event : eventRepository.all().filter("id in ?1", request.getContext().get("_ids")).fetch()) {
event.setUser(AuthUtils.getUser());
Beans.get(EventService.class).saveEvent(event);
}
}
response.setReload(true);
}
use of com.axelor.apps.crm.db.repo.EventRepository in project axelor-open-suite by axelor.
the class EventController method deleteThis.
@Transactional
public void deleteThis(ActionRequest request, ActionResponse response) {
Long eventId = new Long(request.getContext().getParent().get("id").toString());
EventRepository eventRepository = Beans.get(EventRepository.class);
Event event = eventRepository.find(eventId);
Event child = eventRepository.all().filter("self.parentEvent.id = ?1", event.getId()).fetchOne();
if (child != null) {
child.setParentEvent(event.getParentEvent());
}
eventRepository.remove(event);
response.setCanClose(true);
response.setReload(true);
}
Aggregations