Criação do Projeto Custom Entities

Para criação de um projeto Custom Entities, será necessário o envio de um E-mail para Gerencia de Configuração ([email protected]solicitando a criação do novo repositório na ferramenta Azure.

Crie uma nova branch para desenvolvimento, clone a URL da branch recém criada.

Crie um novo Projeto Maven, que utilize o Nexus como base.


Inclusão das Dependências 

Após o Projeto Maven ter sido criado altere o arquivo Pom.xml acrescentando as seguintes dependências:

Pom.xml
<dependency>
	<groupId>linx</groupId>
	<artifactId>linx-p2k-entities</artifactId>
	<version>2.1.0</version>
</dependency>

<dependency>
	<groupId>objectstore</groupId>
	<artifactId>odi</artifactId>
	<version>6.0.SP1</version>
</dependency>		


Crie uma Classe que extends ligada á CustomEntity e implemente o método de inicialização dos arrays, como mostra exemplo abaixo.

Exemplo de Classe ProdutoCustomEntity.java
package com.linx.storex.custom.entities;

import java.math.BigDecimal;
import java.util.Date;

import com.csi.info.custom.CustomAttribute;
import com.csi.info.custom.CustomComplexAttribute;
import com.csi.info.custom.CustomEntity;
import com.csi.info.tiposGerais.Chave;

public class ProdutoCustomEntity extends CustomEntity {
    
    private static final long serialVersionUID = -8382628142314482260L;
    private static final int TAMANHO_ARRAY_OBJECT = 4;
    private static final int TAMANHO_ARRAY_BOOLEAN = 1;
    private static final int TAMANHO_ARRAY_LONG = 1;
    private static final int OBJECT_POS_PESO_EMBALAGEM = 0;
    private static final int OBJECT_POS_DATA_EMBALAGEM = 1;
    private static final int OBJECT_POS_MODA = 2;
    private static final int OBJECT_POS_INFORMACOES_ADICIONAIS = 3;
    private static final int BOOLEAN_POS_PRODUTO_PERECIVEL = 0;
    private static final int LONG_POS_QUANTIDADE_ITENS = 0;



    @Override
    public Chave getChave() {
        return null;
    }

    @Override
    public String getChaveString() {
        return null;
    }

    @Override
    protected void inicializaArrays() {
        this.atributosObject = new Object[TAMANHO_ARRAY_OBJECT];
        this.atributosBooleanos = new boolean[TAMANHO_ARRAY_BOOLEAN];
        this.atributosLong = new long[TAMANHO_ARRAY_LONG];

    }

    @CustomAttribute(recordIndex = 0, tableColumn = "PESO_EMBALAGEM")
    public void setPesoEmbalagem(BigDecimal valor) {
        this.setParameter(OBJECT_POS_PESO_EMBALAGEM, valor);
    }

    @CustomAttribute(recordIndex = 1, tableColumn = "PRODUTO_PERECIVEL")
    public void setProdutoPerecivel(boolean valor) {
        this.setParameter(BOOLEAN_POS_PRODUTO_PERECIVEL, valor);
    }

    public boolean getProdutoPerecivel() {
        return this.getBooleanParameter(BOOLEAN_POS_PRODUTO_PERECIVEL);
    }

    @CustomAttribute(recordIndex = 2, pattern = "dd/MM/yyyy HH:mm:ss", tableColumn = "DATA_EMBALAGEM")
    public void setDataEmbalagem(Date valor) {
        this.setParameter(OBJECT_POS_DATA_EMBALAGEM, valor);
    }

    public Date getDataEmbalagem() {
        return this.getParameter(OBJECT_POS_DATA_EMBALAGEM);
    }

    @CustomComplexAttribute
    public void setModaCustom(ModaCustom valor) {
        this.setParameter(OBJECT_POS_MODA, valor);
    }

    public ModaCustom getModaCustom() {
        return this.getParameter(OBJECT_POS_MODA);
    }

    @CustomAttribute(recordIndex = 3, tableColumn = "INFORMACOES_ADICIONAIS")
    public void setInformacoesAdicionais(String valor) {
        this.setParameter(OBJECT_POS_INFORMACOES_ADICIONAIS, valor);
    }
    public BigDecimal getPesoEmbalagem() {
        return getParameter(OBJECT_POS_PESO_EMBALAGEM);
    }

    public String getInformacoesAdicionais() {
        return (String) getParameter(OBJECT_POS_INFORMACOES_ADICIONAIS);
    }
    public boolean isProdutoPerecivel() {
        return getBooleanParameter(BOOLEAN_POS_PRODUTO_PERECIVEL);
    }

    public long getQuantidadeItens() {
        return getLongParameter(LONG_POS_QUANTIDADE_ITENS);
    }

    private void setParameter(int index, Object value) {
        try {
            this.atributosObject[index] = value;
        } catch (Exception e) {
        }
    }

    @SuppressWarnings("unchecked")
    private <T> T getParameter(int index) {
        T value = null;
        try {
            value = (T) this.atributosObject[index];
        } catch (Exception e) {
        }
        return value;
    }

    private void setParameter(int index, boolean value) {
        try {
            this.atributosBooleanos[index] = value;
        } catch (Exception e) {
        }
    }

    private void setParameterLong(int index, long value) {
        try {
            this.atributosLong[index] = value;
        } catch (Exception e) {
        }
    }
    private boolean getBooleanParameter(int index) {
        boolean value = false;
        try {
            value = this.atributosBooleanos[index];
        } catch (Exception e) {
        }
        return value;
    }

    private long getLongParameter(int index) {
        long value = -1;
        try {
            value = this.atributosLong[index];
        } catch (Exception e) {
        }
        return value;
    }


}


Exemplo da Classe ModaCustom.java
package com.linx.storex.custom.entities;

import java.io.Serializable;
import java.math.BigDecimal;

import com.csi.info.custom.CustomAttribute;

public class ModaCustom implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 526794654733562832L;

    // @CustomAttribute(recordIndex = 8)
    private String cor;

    @CustomAttribute(recordIndex = 4, tableColumn = "LARGURA_EMBALAGEM")
    private BigDecimal tamanho;


    public String getCor() {
        return cor;
    }

    public void setCor(String cor) {
        this.cor = cor;
    }

    public BigDecimal getTamanho() {
        return tamanho;
    }

    public void setTamanho(BigDecimal tamanho) {
        this.tamanho = tamanho;
    }
}



Apos a criação da classe inclua o nome e caminho da classe recém criada, no arquivo classesPostProcess.p2k exemplo: linx\custom\ModaCustom.class e linx\custom\ProdutoCustomEntity.class

Para mais informações sobre a criação da classe (Clique Aqui)

Efetue o Commit da branch criada.

Crie uma pipeline para o novo projeto.

Dica

Para saber mais como criar uma pipeline Azure Clique Aqui!


Crie um parâmetro component_version para informar a versão que esta sendo gerada.

Solicitando o Pull Request

 Após todo esse processo, efetue a solicitação do Pull Request no portal do Azure Devops.



  • Sem rótulos