use of it.cnr.si.cool.jconon.model.PrintParameterModel in project cool-jconon by consiglionazionaledellericerche.
the class ApplicationService method generaSchedeValutazione.
public void generaSchedeValutazione(Session currentCMISSession, String idCall, final Locale locale, final String contextURL, final CMISUser user, final String email) {
final String userId = user.getId();
if (!callService.isMemberOfRDPGroup(user, (Folder) currentCMISSession.getObject(idCall)) && !user.isAdmin()) {
LOGGER.error("USER:" + userId + " try to generaSchedeValutazione for call:" + idCall);
return;
}
queueService.queueSchedaValutazione().add(new PrintParameterModel(idCall, contextURL, true, email, userId, PrintParameterModel.TipoScheda.SCHEDA_VALUTAZIONE));
}
use of it.cnr.si.cool.jconon.model.PrintParameterModel in project cool-jconon by consiglionazionaledellericerche.
the class ApplicationService method generaSchedeAnonime.
public void generaSchedeAnonime(Session currentCMISSession, String idCall, final Locale locale, final String contextURL, final CMISUser user, final String email) {
final String userId = user.getId();
if (!callService.isMemberOfRDPGroup(user, (Folder) currentCMISSession.getObject(idCall)) && !user.isAdmin()) {
LOGGER.error("USER:" + userId + " try to generaSchedeValutazione for call:" + idCall);
return;
}
queueService.queueSchedaValutazione().add(new PrintParameterModel(idCall, contextURL, true, email, userId, PrintParameterModel.TipoScheda.SCHEDA_ANONIMA));
}
use of it.cnr.si.cool.jconon.model.PrintParameterModel in project cool-jconon by consiglionazionaledellericerche.
the class ApplicationService method addToQueueForSend.
protected void addToQueueForSend(String id, String contextURL, boolean email) {
queueService.queueSendApplication().add(new PrintParameterModel(id, contextURL, email));
queueService.queueAddContentToApplication().add(new PrintParameterModel(id, contextURL, email));
}
use of it.cnr.si.cool.jconon.model.PrintParameterModel in project cool-jconon by consiglionazionaledellericerche.
the class CallService method visualizzaSchedeNonAnonime.
public void visualizzaSchedeNonAnonime(Session session, String id, Locale locale, String contextURL, CMISUser user) throws IOException {
PrintParameterModel parameter = new PrintParameterModel(contextURL, true);
parameter.setIds(Arrays.asList(id));
parameter.setIndirizzoEmail(user.getEmail());
parameter.setUserId(user.getUserName());
queueService.queueApplicationsSchedaNonAnonima().add(parameter);
}
use of it.cnr.si.cool.jconon.model.PrintParameterModel in project cool-jconon by consiglionazionaledellericerche.
the class QueueService method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
ItemListener<PrintParameterModel> printApplicationListener = new ItemListener<PrintParameterModel>() {
@Override
public void itemAdded(ItemEvent<PrintParameterModel> itemEvent) {
PrintParameterModel item = itemEvent.getItem();
LOGGER.info("PrintApplicationListener {} {}", item, itemEvent.getEventType().getType());
boolean removed = queuePrintApplication().remove(item);
LOGGER.info("PrintApplicationListener {} {}", item, removed ? "removed" : "not removed");
if (removed) {
LOGGER.info("PrintApplicationListener consuming {}", item);
printService.printApplication(item.getApplicationId(), item.getContextURL(), Locale.ITALY, item.isEmail());
LOGGER.info("PrintApplicationListener consumed {}", item);
}
}
@Override
public void itemRemoved(ItemEvent<PrintParameterModel> itemEvent) {
LOGGER.info("PrintApplicationListener removed {}", itemEvent.getItem());
}
};
ItemListener<PrintParameterModel> sendApplicationListener = new ItemListener<PrintParameterModel>() {
@Override
public void itemAdded(ItemEvent<PrintParameterModel> itemEvent) {
PrintParameterModel item = itemEvent.getItem();
LOGGER.info("SendApplicationListener {} {}", item, itemEvent.getEventType().getType());
boolean removed = queueSendApplication().remove(item);
LOGGER.info("SendApplicationListener {} {}", item, removed ? "removed" : "not removed");
if (removed) {
LOGGER.info("SendApplicationListener consuming {}", item);
printService.printApplication(item.getApplicationId(), item.getContextURL(), Locale.ITALY, item.isEmail());
LOGGER.info("SendApplicationListener consumed {}", item);
}
}
@Override
public void itemRemoved(ItemEvent<PrintParameterModel> itemEvent) {
LOGGER.info("SendApplicationListener removed {}", itemEvent.getItem());
}
};
ItemListener<PrintParameterModel> schedaValutazioneListener = new ItemListener<PrintParameterModel>() {
@Override
public void itemAdded(ItemEvent<PrintParameterModel> itemEvent) {
PrintParameterModel item = itemEvent.getItem();
LOGGER.info("SchedaValutazioneListener {} {}", item, itemEvent.getEventType().getType());
boolean removed = queueSchedaValutazione().remove(item);
LOGGER.info("SchedaValutazioneListener {} {}", item, removed ? "removed" : "not removed");
if (removed) {
LOGGER.info("SchedaValutazioneListener consuming {}", item);
printService.generaScheda(item);
LOGGER.info("SchedaValutazioneListener consumed {}", item);
}
}
@Override
public void itemRemoved(ItemEvent<PrintParameterModel> itemEvent) {
LOGGER.info("SchedaValutazioneListene removed {}", itemEvent.getItem());
}
};
ItemListener<PrintParameterModel> addContentToApplicationListener = new ItemListener<PrintParameterModel>() {
@Override
public void itemAdded(ItemEvent<PrintParameterModel> itemEvent) {
PrintParameterModel item = itemEvent.getItem();
LOGGER.info("AddContentToApplicationListener {} {}", item, itemEvent.getEventType().getType());
boolean removed = queueAddContentToApplication().remove(item);
LOGGER.info("AddContentToApplicationListener {} {}", item, removed ? "removed" : "not removed");
if (removed) {
LOGGER.info("AddContentToApplicationListener consuming {}", item);
printService.addContentToApplication(item);
LOGGER.info("AddContentToApplicationListener consumed {}", item);
}
}
@Override
public void itemRemoved(ItemEvent<PrintParameterModel> itemEvent) {
LOGGER.info("AddContentToApplicationListener removed {}", itemEvent.getItem());
}
};
ItemListener<PrintParameterModel> applicationXLSListener = new ItemListener<PrintParameterModel>() {
@Override
public void itemAdded(ItemEvent<PrintParameterModel> itemEvent) {
PrintParameterModel item = itemEvent.getItem();
LOGGER.info("applicationXLSListener {} {}", item, itemEvent.getEventType().getType());
boolean removed = queueApplicationsXLS().remove(item);
LOGGER.info("applicationXLSListener {} {}", item, removed ? "removed" : "not removed");
if (removed) {
LOGGER.info("applicationXLSListener consuming {}", item);
printService.extractionApplication(item);
LOGGER.info("applicationXLSListener consumed {}", item);
}
}
@Override
public void itemRemoved(ItemEvent<PrintParameterModel> itemEvent) {
LOGGER.info("applicationXLSListener removed {}", itemEvent.getItem());
}
};
ItemListener<PrintParameterModel> applicationSchedaNonAnonimaListener = new ItemListener<PrintParameterModel>() {
@Override
public void itemAdded(ItemEvent<PrintParameterModel> itemEvent) {
PrintParameterModel item = itemEvent.getItem();
LOGGER.info("applicationSchedaNonAnonimaListener {} {}", item, itemEvent.getEventType().getType());
boolean removed = queueApplicationsSchedaNonAnonima().remove(item);
LOGGER.info("applicationSchedaNonAnonimaListener {} {}", item, removed ? "removed" : "not removed");
if (removed) {
LOGGER.info("applicationSchedaNonAnonimaListener consuming {}", item);
printService.schedeNonAnonime(item);
LOGGER.info("applicationSchedaNonAnonimaListener consumed {}", item);
}
}
@Override
public void itemRemoved(ItemEvent<PrintParameterModel> itemEvent) {
LOGGER.info("applicationSchedaNonAnonimaListener removed {}", itemEvent.getItem());
}
};
queuePrintApplication().addItemListener(printApplicationListener, true);
queueSendApplication().addItemListener(sendApplicationListener, true);
queueSchedaValutazione().addItemListener(schedaValutazioneListener, true);
queueAddContentToApplication().addItemListener(addContentToApplicationListener, true);
queueApplicationsXLS().addItemListener(applicationXLSListener, true);
queueApplicationsSchedaNonAnonima().addItemListener(applicationSchedaNonAnonimaListener, true);
}
Aggregations