Árvore de páginas

Versões comparadas

Chave

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

...

Ainda nos métodos addCustomInformation, adicionar a tabela preenchida na mensagem utilizando o método addCustomTable(String tableName, IDataTable table) do objeto CustomInformation que pode ser obtido dos objetos representando as mensagens (msg e response) usando getCustomInformation().

Exemplo em Java:

 

Bloco de código
themeEmacs
languagejava
linenumberstrue
public class CustomUnitOfMeasure implements ICustomization {  
        DefaultDataTable labInfo = new DefaultDataTable();
        DefaultDataTable labInfo2 = new DefaultDataTable();
  
        public CustomUnitOfMeasure() {
                labInfo.addColumn("lab_id");
                labInfo2.addColumn("quanticMass");
                labInfo2.addColumn("fusionMethod");
        }
  
        public void addCustomInformation(BusinessMessage businessMessage) {
                Map<String, Object> row = new HashMap<String, Object>();
                row.put("quanticMass", 120);
                row.put("fusionMethod", "Nuclear1");
  
                labInfo2.addRow((HashMap<String, Object>) row);
  
                businessMessage.getCustomInformation().addCustomTable("labInfo", labInfo2);
  
                /* chamar duas vezes para verificar se duplica a linha */
                row.put("fusionMethod", "Nuclear");
                labInfo2.updateRow(0, (HashMap<String, Object>) row);
                businessMessage.getCustomInformation().addCustomTable("labInfo", labInfo2);
        }
  
        public void addCustomInformation(ResponseMessage responseMessage) {
                if (responseMessage.getStatus() == "ERROR")
                        return;
                Map<String, Object> row = new HashMap<String, Object>();
                row.put("lab_id", "05");
  
                labInfo.addRow((HashMap<String, Object>) row);
  
                responseMessage.getCustomInformation().addCustomTable("lab_info", labInfo);
  
                /* chamar duas vezes para verificar se duplica a linha */
                row.put("lab_id", "10");
                labInfo.updateRow(0, (HashMap<String, Object>) row);
                responseMessage.getCustomInformation().addCustomTable("lab_info", labInfo);
        }
}

 

Exemplos em Progress:

Bloco de código
themeEmacs
languageactionscript3
linenumberstrue
CLASS com.totvs.datasul.eai.test.CustomUnitOfMeasure IMPLEMENTS ICustomization:
    DEFINE TEMP-TABLE ttLabInfo
        FIELD lab_id        AS CHARACTER.
 
    DEFINE TEMP-TABLE ttLabInfo2
        FIELD quanticMass   AS INTEGER
        FIELD fusionMethod  AS CHARACTER.
 
    METHOD VOID addCustomInformation(oMsg AS BusinessMessage):
        CREATE ttLabInfo2.
        ASSIGN
            ttLabInfo2.quanticMass = 120
            ttLabInfo2.fusionMethod = "Nuclear1".
       
        oMsg:CustomInformation:addCustomTable ("labInfo", INPUT TABLE ttLabInfo2).
       
        /* Repetindo para testar a validação se os dados serão duplicados ou não */
         ttLabInfo2.fusionMethod = "Nuclear".
        oMsg:CustomInformation:addCustomTable ("labInfo", INPUT TABLE ttLabInfo2).
    END.
 
    METHOD VOID addCustomInformation(oMsg AS ResponseMessage):
        CREATE ttLabInfo.
        ttLabInfo.lab_id = "05".
        oMsg:CustomInformation:addCustomTable ("lab_info", INPUT TABLE ttLabInfo).
 
        /* Repetindo para testar a validação se os dados serão duplicados ou não */
        ttLabInfo.lab_id = "10".
        oMsg:CustomInformation:addCustomTable ("lab_info", INPUT TABLE ttLabInfo).
 
    END.
END.

...