Converting Projects to Work with Master Build 4811 and Later

There are two big changes in Master release of Origam introduced in build 4811 (June 2018). The first one is renaming of old name space from CZ.Advantages.Asap to Origam and all other occurrences of the word Asap to Origam inside of the Origam application. The other change is a new feature enabling users to store models in xml format. Storing model in many xml files makes it easy to integrate a versioning program like GIT to your model development.

The Asap to Origam renaming affects all existing models so when you upgrade to new Origam version you will have to rename entries in you model database. The conversion of model to xml files is optional.

Following demonstration will show you how to update Origam packages as well as you own packages so that they work with the new release and how to convert them to xml files.

New project

We will start with a new project created in a pre 4810 build. You can check you architect version by clicking Help → About…

To create a new project click File → New Project …
A project wizard will pop up. We will create a new project using default settings. The created project should look similar to this:

Note Root package version is 4.31 and Security package version is 3.8.

Renaming the model

Now we can close the old release of Architect. Before we open the new one (build 4811 or later), we have to create a new OrigamSettings element in OrigamSettings.config in the new Architect’s directory. To do that we first open the old Architect’s AsapSettings.config. This file is usually located here:

C:\Program Files (x86)\ORIGAM\ORIGAM Architect\AsapSettings.config

You should find the created project’s settings at the end of the file:

Copy it to the OrigamSettings.config found in the new Architect’s directory and replace all occurrences of CZ.Advantages.Asap and Asap with Origam. Then you have to add Model provider element:

<ModelProvider>Origam.OrigamEngine.DatabasePersistenceBuilder, Origam.OrigamEngine</ModelProvider>

The result in OrigamSettings.config should look like this:

Repeat the process (renaming and adding the Model provider element) also for the AsapSettings.config file in your project’s server folder, e.g. C:\inetpub\modelUpdateDemonstration\AsapSettings.config.

When you run the new Architect you should see the new project in Select Configuration pop up. After you select it and click Ok, an upgrade question pops up.
. version
New Project 55

Click Yes to run upgrade scripts and open the project. The scripts we just ran renamed among other things all data of packages Root, Root Menu and Security in column TargetType in table SchemItem.

To make the project work we have to first upgrade the Root package (you can download the Root package from the Stable 2019.1 version and unpack it to your project folder). Double click the Root package, this will cause an error message to pop up:

This error is expected. Next click File → Import Single Package … and select new Root.xml
Make sure the Root.xml file is part of a model corresponding to the new Architect (build 4811 or newer).
Wait until the file is loaded and double click the root package again. A confirmation pops up…
New Project 65
Click Yes to upgrade the package.

Repeat the process for Security package. After you do, you should see that both package are in version 5.0.


The project should work in the new Origam version now.

Conversion of Model Storage to File System

Open package modelUpdateDemonstration and click Tools→Convert to File Storage.


The output directory can be set in OrigamSettings.config by editing text of element ModelSourceControlLocation.

To open the generated project we have to add a new OrigamSettings element to OrigamSettings.config. Best is to duplicate the original data base based project settings and edit them. The most important is to change ModelProvider element so that it points to FilePersistenceBuilder.
When you save the OrigamSettings.config and restart restart Architect you should see the xml based project in the Select Configuration pop up.

The conversion to filesystem fails if there are some documentation orphans in the database. You can delete them by the following script:
delete from documentation where id in (select d.id from Documentation d left join SchemaItem si on si.id = d.refSchemaItemId where si.id is null)

Also, on windows, the maximum file path is 255 characters. You can disable this constraint following this:

Also, your model elements must not contain slash (’/’) characters.

How to make localization work

  1. with upgrade to the current master version the build is currently targeted to .NET FX 4.7.2; according to https://stackoverflow.com/questions/36455801/owinmiddleware-doesnt-preserve-culture-change-in-net-4-6 a line has to be added to web.config to make our localization working (proven not to work, when not set (in the wy.by project))
    <add key="appContext.SetSwitch:Switch.System.Globalization.NoAsyncCurrentCulture" value="true" />

  2. in the localization folder, AsapLocalization has to be renamed to OrigamLocalization in each file

  3. all external callers have to rename the AsapLanguage cookie to OrigamLanguage (if they manage the language - e.g. can switch a language)

To be able to run the net core server for HTML 5, all transformations has to be converted from ‘XslTransform’ to ‘XslCompiledTransform’. You can do this using e.g. linux or, or ubuntu developer console at windows 10 or probably even git bash console at windows 10 using the following command:

find -path "*/Transformation/*" -type f -exec sed -i 's/engineType="XslTransform"/engineType="XslCompiledTransform"/g' {} \;

I’m trying to convert project from 2018.2(model in database) to work with 2020.1 release. Following this guide I didn’t get error “Model element not found by provided primary key …” when trying to load Root package. I got different error: "Value cannot be null. Parameter name: type ', but the package was loaded. Then I tried to import Root.xml from 2019.1.37 (there is no Root.xml in Model_Stable_root_stable_2020.1.508_artifacts.zip). After clicking Yes on Deployment Scripts Pending dialog, I got error: “Invalid object name ‘AsapModelVersion’.”
I can see another error In the Architect Log windows “ERROR Origam.Security.AbstractProfileProvider - Your user name (DOMAIN\administrator) does not have access to the system. Please contact the system administrator to request access.”
But it doesn’t make sense because administrator has full access to file system as well as to databases (sysadmin server role).

Any advice appreciated!
Thank you!
image

image

If you have troubles with PUT calls (ASP.NET MVC doesn’t set Thread.CurrentPrincipal correctly), than try the following to add into the web.config:

<System.WebServer>

<Handlers>

<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
        <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 

(taken from here: https://stackoverflow.com/questions/50531226/mvc-http-put-not-working)

@washi Peter, it used to throw 401 (Unauthorized) for PUT pages - simillar problem to yours.

A list of model changes we had to do to move a major project:

- Rename CZ.Advantages.Asap -> Origam at model
- Inspect stored procedures, they can have 'AsapListValue' datatype used, rename
- Inspect stored procedures, can have some references to asap tables
  - e.g. BusinessPartnerAsapRole
- Make role names non-asap:
  UPDATE [OrigamApplicationRole] SET [Name] = REPLACE([Name], 'Asap', 'Origam')
- In any UpdateContextTask if the input value xpath context store is scalar,
  the /ROOT/Value has to be used to get the data from (was '/' before)
- The longest path at the filesystem has to be 255, make names in model shorter
  if this is applicable (the actual conversion to filesystem would fail). Or
  other solution is to remove a limit (must be configured at windows and can't
  be taken back). 
- All parameters in all APIs became case sensitive. So it could happen some
 client doesn't use the correct spelling. Fix either on client ot API side.
- Correct model errors - new architect checks all model inconsistencies and
 report them on package opening. It's worth to fix those inconsistencies.
- API - endpoints are now scanned for duplicates, check that there aren't
 any duplicates. It returns the 404 in that case. Before, the first (random)
 handler was used.
- For-each block with _any contexstore doesn't work stable
  - ignoreSourceContextChanges must be set
- Mailing doesn't work - all notification templates must have <OrigamNotification>
  element instead of <AsapNotification>. 
- API endpoints: origam is more sensitive about returned mime-type and started
 not to return error (RuleResult) in json if the services  wasn't application/json
- Handle the situation where a child entity of another entity is a root entity
 in screen's DS - in that situation since master-september-2018 it cheks row
 level security rule for the creation by adding a new empty testing record. We
 have to handle this situation when no refParentEntityId is present
 - disable creation.
- Incorrect conversion of XslRule (rules that are just old library rules used
 only as an xsl:inc- must be converted to EndRule. (Some xsl rules
- HTML: convert all transformations from XslTransform to XslCompiledTransform.
 XslCompiledTransform is more strict about an error when a productd output
 contains attribute nodes after subnodes has been already added.
- HTML: check lazily loaded screens - in lazily loaded screens, the list
 datastructure must include all the columns used in a master screen section
 of the screen. (Flash was less strict)
- HTML: change ReloadActualRecord->RefreshCompleteForm in some cases - Flash
 used to reload the form even when 'ReloadActualRecord' was set at some cases.
- HTML: external assemblies with custom service agents (not known at compile
 time) has to include a version of assembly to access it (at the model). E.g.
 "Com.Customer.Project.ProjectService,Com.Customer.Project,Version=1.0.0.0"
- Output of complex datastructure rule must output <ROOT> element now. Old
 version was less strict and could work even without it.