V10 ResourcesGuides
ResourcesGuides
Guides
Back | List of Articles

Administrator Extensibility

Last changed in 02/12/2020

Integration with the PRIMAVERA administrator allows applications developed by third parties to be added to the PRIMAVERA administrator and access a set of features made available by the platform, among which security, configuration, database management and the operation log features.

Necessary components

To register an external application in the PRIMAVERA administrator, you need to define a set of components that implement an interface, obey specific naming conventions and provide a defined set of features. Only then is the application included in the administrator and in the Registry Entries, allowing the administrator to locate the different components.

Below please find the components and corresponding classes required to register an application in the PRIMAVERA administrator:

  • Audit: component that allows you to add the permissions of the supported applications and databases to the security system.
    • clsOperaçõesAplicação: required class that provides application permissions.
    • clsOperaçõesLog: required class that provides a set of entities of the application that will be available for log.
    • clsBaseDados: class that provides a set of databases supported by the application.
  • Forms: component where default parameters and services for third party applications are configured.
    • clsImagens: icon associated with the application.
    • clsParametrizacoes: required class that provides a set of forms with the basic parameters of the application.
    • clsServicos: required class tha provides a set of utility services for the application.
    • clsLoginsAssociados: class that allows mapping PRIMAVERA users to third party application users.

The integration of applications must comply with a set of components and application naming standards. All applications to be integrated in the Administrator must have a defined abbreviation, which must be part of the name of its components.
This abbreviation must consist on 3 alphanumeric characters (examples: ABC, D01, EF2 etc.). Please note that some abbreviations are reserved for PRIMAVERA modules (for example: ADM-Administrator, DBM- Data Base Management, CBL - Accounting, among others).

Recording external applications

Step 1 - Create the Audit project

1 - After opening Visual Studio, select File > New > Project.

2 - From the tree on the left of the displayed window select the development language (C# or VB);

3 - Select the Class Library (.NET Framework) project type.

4 - Assign a name to the 'EXTAudit100' project, and press OK.

Note: The application's abbreviation must always be three characters long, such as 'EXT'

5 - Add the following classes clsOperacoesAplicacao and clsOperacoesLog.

6 - Add a reference to the StdClasses100 assembly.

7 - Next to the class name add clsAplAudit. This step indicates that our class will inherit all methods, properties and attributes from the clsAplAudit class.

8 - Add the following code to the class clsEXTOperacoesAplicacao

using StdClasses100;

namespace EXTAudit100
{
    public class clsEXTOperacoesAplicacao : clsAplAudit
    {
        #region private properties

            private string Instancia { get; set; }
            private string Utilizador { get; set; }
            private string PassWord { get; set; }

        #endregion

        #region _clsAplAudit Members
    
            public clsArvoreOperacoes GetArvOperacoes(clsParamOpsAplicacao objParametros)
            {
                clsArvoreOperacoes objOps = new clsArvoreOperacoes();
                clsOperacaoApl objOp;

                objOp = objOps.Add('mnuOperacao', 'Operações', 0, ');
                objOp = objOps.Add('mnuOperacao1', 'Operação 1', 0, 'mnuOperacao');
                objOp = objOps.Add('mnuOperacao2', 'Operação 2', 0, 'mnuOperacao');

                return objOps;
                }

            public clsPermissoesVar GetPermissoesDinamicas(clsParamOpsAplicacao objParametros)
            {
                    clsPermissoesVar objVars = new clsPermissoesVar();
                    clsPermissaoVar objVar;

                    objVar = objVars.Add('Documento', 'Documento', 'FA', 'Fatura Externa.', objParametros.Empresa);
                    objVar.OperacoesPossiveis.Add('CRIAR', 'Criar');
                    objVar.OperacoesPossiveis.Add('MODIFICAR', 'Modificar');
                    objVar.OperacoesPossiveis.Add('ANULAR', 'Anular');
                    objVar.OperacoesPossiveis.Add('VISUALIZAR', 'Visualizar');

                    return objVars;
            }

        #endregion
    }
}

The clsArvoreOperacoes GetArvOperacoes(clsParamOpsAplicacao objParametros) method is used to grant access permissions to the third application operations. This extensibility mechanism is very useful to validate if options added to Ribbon by the extensibility mechanism have access to operations.

The clsPermissoesVar GetPermissoesDinamicas(clsParamOpsAplicacao objParametros) is used to grant dynamic permissions to the application. This type of permissions can be filled in based on an SQL query (ex: types of documents).

9 - Add the following code to the clsExtOperacoesLog class:

using StdClasses100;

namespace EXTAudit100
{
    public class clsExtOperacoesLog : clsAplOperacoesLog
    {
        #region _clsAplOperacoesLog Members
            public clsOperacoesLog GetDaOperacoesLog(clsParamOpsLog objParametros)
            {
                clsOperacoesLog opLog;

                return null;
            }
        #endregion
    }
}

Step 2 - Create the Forms project

1 - After opening Visual Studio, select File > New > Project.

2 - From the tree on the left of the displayed window select the development language (C# or VB);

3 - Select the Class Library (.NET Framework) project type.

4 - Assign a name to the 'EXTForms100' project, and press OK.

Nota: The application abbreviation must always be three characters long, such as 'EXT'.

5 - Add the following classes clsParametrizacoe and clsServicos.

6 - Add references to the Primavera.Platform.CollectionsStdClasses100 and StdBE100 assemblies.

7 - Under Toolbox > Containers, select a ' Panel' and drag it into the form.

8 - Add the following code to the clsExtParametrizacoes class:

using ExtForms100.UI;
using Primavera.Platform.Collections;
using StdBE100;
using StdClasses100;

namespace ExtForms100
{
    public class clsExtParametrizacoes : clsAplParametrizacoes
    {
        private string Utilizador { get; set; }
        private string PassWord { get; set; }

        #region _clsAplParametrizacoes Members
        public void AtribuiUtilizador(string strUtilizador, string strPassword)
        {
            this.Utilizador = strUtilizador;
            this.PassWord = strPassword;
        }

        public void Inicializa(StdBETipos.EnumTipoPlataforma enuTipoPlataforma, string strEmpresa, string strInstalacao, clsLicenca objLic)
        {
        }

        public void Lista(clsParamAplParams objParametros, ref string[] strLista, PrimaveraOrderedDictionary colLoc)
        {
            string[] Parametros;

            Parametros = new string[2];

            Parametros[1] = 'Parametros Gerais';
            strLista = Parametros;
        }

        public bool ModuloDisponivelLocalizacao(StdBETipos.EnumLocalizacaoSede enuLocSede)
        {
            // Required to be true.
            return true;
        }

        public void Mostra(int intIndex, int intModoOperacao, dynamic objOwnerForm)
        {
            // Place the code to open the different parameter forms here.
        }

        public void Termina()
        {
        }

        public void TiposExercicioSuportados(StdBETipos.EnumTipoPlataforma enuTipoPlataforma, ref StdBETipos.EnumTipoExercicio[] enuTiposExercicio)
        {
        }
        #endregion
    }
}

14 - Add the following code to the clsExtServicos class:

using Primavera.Platform.Collections;
using StdBE100;
using StdClasses100;

namespace ExtForms100
{
    public class clsExtServicos : clsAplServicos
    {
        private string Utilizador { get; set; }
        private string PassWord { get; set; }

        #region _clsAplServicos Members
        public void AtribuiUtilizador(string strUtilizador, string strPassword)
        {
            this.Utilizador = strUtilizador;
            this.PassWord = strPassword;
        }

        public void Executa(int intIndex)
        {
            // Place code to call the different services here.
        }

        public void Inicializa(StdBETipos.EnumTipoPlataforma enuTipoPlataforma, string strEmpresa, string strInstalacao, clsLicenca objLic)
        {
        }

        public void Lista(clsParamAplServicos objParametros, ref string[] strLista, PrimaveraOrderedDictionary colLoc)
        {
			string[] servicos;
			servicos = new string[2];

			servicos[1] = 'User creation wizard';

			strLista = servicos;
        }

        public void Termina()
        {
        }
        #endregion
    }
}

Step 3 - Register the application

1 - To register the extensibility application in the administrator you need to add a new entry in the PRIMAVERA folder on the Windows registry with the abbreviation of the application, such as 'EXT'.

2 - Add the following keys to the new entry.

KeyDescription
AuditLogical name of the Audit component.
FormsLogical name of the Forms component.
3rdPartyIndicates that this is a third party application. The value must be set to 'TRUE'.
NameName of the application
PercursoAplPath to the application's executable file
PercursoDadosData directory
PercursoDadosComunsDirectory for common data
PercursoMapasDirectory for reports
VersaoApplication version
ExecName of the application's executable file (without path or .EXE extension)

3 - In the 'SGE100DefaultADMApls' folder, create a new entry with the same abbreviation as the application ('EXT').

4 - Open the Administrator and check the registration of the application.

5 - Access the properties of a company. In the 'Parameters' tab, add the application created, which in this case is 'Extensibility Example'.

6 - Confirm.

For more information, see an example of the PRIMAVERA Administrator extensibility technology on GitHub.

Bookmark or share this article
Esta página foi útil?
Obrigado pelo seu voto.

login para deixar a sua opinião.

Obrigado pelo seu feedback. Iremos analisá-lo para continuarmos a melhorar!
Artigos Relacionados
Começar a Usar Como criar um projeto de integração com Visual Studio? Como criar um projeto de extensibilidade de interface (PEX) com Visual Studio? Como criar um projeto de extensibilidade de API (Motor) com Visual Studio? Como criar separadores do utilizador com Visual Studio?