Search in sources :

Example 1 with PrintParameterModel

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));
}
Also used : PrintParameterModel(it.cnr.si.cool.jconon.model.PrintParameterModel)

Example 2 with PrintParameterModel

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));
}
Also used : PrintParameterModel(it.cnr.si.cool.jconon.model.PrintParameterModel)

Example 3 with PrintParameterModel

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));
}
Also used : PrintParameterModel(it.cnr.si.cool.jconon.model.PrintParameterModel)

Example 4 with PrintParameterModel

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);
}
Also used : PrintParameterModel(it.cnr.si.cool.jconon.model.PrintParameterModel)

Example 5 with PrintParameterModel

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);
}
Also used : ItemEvent(com.hazelcast.collection.ItemEvent) PrintParameterModel(it.cnr.si.cool.jconon.model.PrintParameterModel) ItemListener(com.hazelcast.collection.ItemListener)

Aggregations

PrintParameterModel (it.cnr.si.cool.jconon.model.PrintParameterModel)7 ClientMessageException (it.cnr.cool.web.scripts.exception.ClientMessageException)2 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 ItemEvent (com.hazelcast.collection.ItemEvent)1 ItemListener (com.hazelcast.collection.ItemListener)1 ACLType (it.cnr.cool.cmis.model.ACLType)1 CoolPropertyIds (it.cnr.cool.cmis.model.CoolPropertyIds)1 it.cnr.cool.cmis.service (it.cnr.cool.cmis.service)1 CoolUserFactoryException (it.cnr.cool.exception.CoolUserFactoryException)1 MailService (it.cnr.cool.mail.MailService)1 EmailMessage (it.cnr.cool.mail.model.EmailMessage)1 Util (it.cnr.cool.rest.util.Util)1 GroupsEnum (it.cnr.cool.security.GroupsEnum)1 UserService (it.cnr.cool.security.service.UserService)1 CMISGroup (it.cnr.cool.security.service.impl.alfresco.CMISGroup)1 CMISUser (it.cnr.cool.security.service.impl.alfresco.CMISUser)1 I18nService (it.cnr.cool.service.I18nService)1 CMISUtil (it.cnr.cool.util.CMISUtil)1 MimeTypes (it.cnr.cool.util.MimeTypes)1