2022 April Release

app.ducx Use Case LanguagePermanent link for this heading

This chapter outlines use case language features that are relevant for Folio developers.

Virtual Application Context ActionsPermanent link for this heading

The action FSCVAPP@1.1001:GetVAPPInformation returns a dictionary in the first parameter, which contains the keys listed in the following table.

Note: Only for internal use.

Key

Description

application

The application key stores the virtual application that is currently running.

dispatcher

The dispatcher key stores the application dispatcher used.

topappview

The topappview key stores the topmost application view.

topappviewisexplore

The topappviewisexplore key stores whether the topmost application view is in explore mode.

servertype

The servertype key allows you to determine the type of web server used. For example, the value “IIS” is stored for Microsoft Internet Information Services.

serverplatform

The serverplatform key stores an identifier of the server operating system.

isportlet

The isportlet key stores whether it is a portlet.

isplugininst

The isplugininst key stores whether the native client is installed.

Extending a Virtual ApplicationPermanent link for this heading

Any virtual application can be extended with dialogs in context of a use case and variant. Use the using keyword followed by the reference of a virtual application and curly braces. By default, this reference is formed by concatenating the variant name and the use case name.

Syntax

using <reference of application> {
  dialog reference {
    ...
  }
}

In the following example the virtual application for the menu use case EditInvoice that is defined for variant Order gets extended by the EditOrder dialog.

Example

using OrderEditInvoice {
  dialog EditOrder {
    form = expression {
      if (coort.GetCurrentUserRoleGroup() == #SysAdm) {
        return #FormEditOrderAdmin;
      }
      else {
        return #FormEditOrderUser;
      }
    }
  }
}

Overriding an Existing Use Case ImplementationPermanent link for this heading

Syntax

override usecase {
  variant objectclass {
    impl = ...
  }
}

You can override an existing use case implementation for the object classes belonging to your software component.

When overriding an existing use case implementation, the override keyword must precede the reference of the use case that you want to override, followed by curly braces.

In the following example, a custom implementation is defined for COOSYSTEM@1.1:AttrContentSet in object class APPDUCXSAMPLE@200.200:Invoice.

Example

usecases APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  override AttrContentSet {
    variant Invoice {
      expression {
        // Call super method
        cooobj.CallMethod(cootx, coometh);
        if (attrdef == #content) {
          // Initialize invoice approval process
          cooobj.COOWF@1.1:InitializeWorkFlow([#APPDUCXSAMPLE@200.200:
            ProcInvoiceApproval]);
        }
      }
    }
  }
}

Use Case WrappersPermanent link for this heading

Syntax

usecase(prewrapper for ObjectCreate) {
  expression {
    ...  
  }
)

usecase(postwrapper for ObjectCreate) {
  expression {
    ...  
  }
)

Fabasoft app.ducx allows you to add a use case wrapper to an existing use case that is invoked whenever the wrapped use case is executed.

Note: Wrappers are only allowed if the software component has a 1.* domain ID (e.g. DUCXSAMP@1.1001).

Two types of use case wrappers are supported:

  • The prewrapper keyword is used to assign the action as prewrapper to an existing use case. A prewrapper is invoked before the wrapped use case.
  • The postwrapper keyword is used to assign the action to an existing use case. A postwrapper is invoked after the wrapped use case has been executed successfully.
  • The parameter list is derived from the wrapped use case, modifying the parameter mode to reflect the usage of the parameters:
    • For prewrappers, input parameters become inout parameters.
    • For postwrappers, output parameters become inout parameters.

Example

usecases APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  VerifyContent(postwrapper for AttrContentSet) {
    variant Object {
      java = APPDUCXSAMPLE.Object.VerifyContent;
    }
  }
}

Use Case Wrappers With DataPermanent link for this heading

Use case wrappers allow defining reusable building blocks with a standard implementation and polymorphism to override the default behavior.

A use case wrapper may define a prototype, a virtual application prototype, a method definition, or a virtual application.

  • COOSYSTEM@1.1:ucwprototype
  • FSCVAPP@1.1001:ucwprototype
  • COOSYSTEM@1.1:ucwmethdefinition
  • FSCVAPP@1.1001:ucwapplication

Example

app.ducx Use Case Language

/**
* Default implementation for signature wrappers. If no selection is supplied,

* it is applied to “sys_object”. If “signtype” is not available for any

* reason, an exception is thrown.
*/

usecase SignObjects(parameters as FSCVAPP@1.1001:MenuPrototype) {
  variant Object {
    application {
      expression {
        if (!sys_selobjects) {
          sys_selobjects = sys_object;
        }
        Action sys_action;
        SignatureType signtype = sys_action.signtype;
        if (!signtype) {
          throw #SIGNERR_IllegalType;
        }
        ->SignSelectedObjectsApp(sys_object, sys_action, sys_view,
              sys_selobjects, sys_selindices, sys_dynkey, signtype, null);
      }
    }
  }
}

app.ducx Object Model Language

/**
* Defines a signature wrapper with a default virtual application

* implementation (“SignObjects”).

*/

class<UseCaseWrapper> SignatureWrapper : UseCase {
  ucwapplication = ObjectSignObjects;
  SignatureType signtype not null;
}

app.ducx Use Case Language

/**
* “SignWithMenuInitial” creates a menu use case; it is implemented as

* virtual application defined in “SignatureWrapper”

*/

menu usecase<SignatureWrapper> SignWithMenuInitial {
  signtype = SIGN_INITIAL;
}

Use Case Wrappers (Old Style)Permanent link for this heading

Syntax

usecase {
  prewrappers = {
    prewrapper,
    ...
  }
  postwrappers = {
    postwrapper,
    ...
  }
}

Fabasoft app.ducx allows you to add a use case wrapper to an existing use case that is invoked whenever the wrapped use case is executed.

Note: Wrappers are only allowed if the software component has a 1.* domain ID (e.g. DUCXSAMP@1.1001).

Two types of use case wrappers are supported:

  • The prewrappers keyword is used to assign one or more prewrappers to an existing use case. Multiple entries must be separated by colons. A prewrapper is invoked before the wrapped use case is executed.
  • The postwrappers keyword is used to assign one or more postwrappers to an existing use case. Multiple entries must be separated by colons. A postwrapper is invoked after the wrapped use case has been executed successfully.

Note: A use case wrapper must be assigned the same prototype or parameter list as the use case to be wrapped by the use case wrapper.

Example

usecases APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  VerifyContent(parameters as AttrSetPrototype) {
    variant Object {
      java = APPDUCXSAMPLE.Object.VerifyContent;
    }
  }

  override AttrContentSet {
    postwrappers = {
      VerifyContent
    }
}
}