Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Os eventos de customização para o Fluig são criados pelo administrador, a partir do plugin Fluig DesignerStudio. No projeto Fluig, clique com o botão direito sobre a pasta events e em seguida Novo -> Evento Global Fluig conforme a figura abaixo.

...

Figura 1 - Criação de evento - Fluig DesignerStudio.


Em seguida basta informar o Servidor e o Nome do Evento que será adicionado. Uma tela para edição do evento será aberta, conforme imagem a seguir:

...

Figura 2 - Criação de evento - Fluig DesignerStudio.


É possível observar também que o arquivo .js foi adicionado a pasta events do projeto.

...

Bloco de código
languagejava
titleExemplo
 package com.totvs.fluig.custom.dm;


import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;


@MessageDriven(mappedName = "custom/DocumentListener", activationConfig = {
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
    @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/wdkAbstract")
})
public class AbstractListenerMessageBean implements MessageListener {
    @Override
    public void onMessage(Message message) {
        try {
            System.out.println("==============Abstract Listener====================");
            System.out.println("Message received: " + message.getJMSMessageID());
            if (message instanceof MapMessage) {
                MapMessage mm = (MapMessage) message;
                @SuppressWarnings("unchecked")
                Enumeration<String> es = mm.getMapNames();
                while (es.hasMoreElements()) {
                    String prop = es.nextElement();
                    System.out.println(prop + ": " + mm.getObject(prop));
                    if(prop.equalsIgnoreCase("mapNewVersion")
                            || prop.equalsIgnoreCase("mapOldVersion")){
                        Map<String, Object> m = decoderMap(mm.getBytes(prop));
                        Iterator it = m.entrySet().iterator();
                        while (it.hasNext()) {
                            Map.Entry e = (Map.Entry)it.next();
                            System.out.println(prop + " - " + e.getKey() + ": " + e.getValue());
                        }
                    }
                }
            }
            System.out.println("==========Fim Abstract Listener===============");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
      
    private Map<String, Object> decoderMap(byte[] array) throws IOException, ClassNotFoundException{
        if(array.length>0){
            ByteArrayInputStream bos = new ByteArrayInputStream(array);
            ObjectInputStream p = new ObjectInputStream(bos);
            Object docObject = p.readObject();
            try{
                Map<String, Object> map = (Map<String, Object>) docObject;
                return map;
            }catch(java.lang.ClassCastException e){
                e.printStackTrace();
            }
        }                   
        return null;
    }


}
 

 

Third Party Trademarks

Adobe, Flash, Flex, Flex Builder, PostScript and Reader are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.

Apache is a trademark of The Apache Software Foundation.

Firefox and Mozilla are registered trademarks of the Mozilla Foundation.

JavaScript is a trademark of Oracle Corporation.

Microsoft, Active Directory, Excel, Internet Explorer, Outlook, PowerPoint, SQL Server, Windows and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

MySQL is a trademark of Oracle Corporation and/or its affiliates.

Oracle, Java and OpenOffice.org are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Progress and OpenEdge are trademarks or registered trademarks of Progress Software Corporation or one of its subsidiaries or affiliates in the U.S. and other countries.

Red Hat and JBoss are registered trademarks of Red Hat, Inc. in the United States and other countries.

Any other third party trademarks are the property of their respective owners.

 

Esse evento é disparado sempre ANTES que a solicitação de acompanhar um conteúdo é realizada. O evento recebe como parâmetro o código do tenante, o id do objeto a ser acompanhado, o id do usuário e o nome da classe entidade do registro do evento.

...