Dienstag, 17. Februar 2015

Jobs in AutoCAD Map - job-disable a feature class

AutoCAD Maps Job concept is - from a technical point of view - quite complicated (jobs are only available for Industry Models in Oracle and Oracle needs to be an Enterprise edition). In some circumstances one has to use Jobs - as we have to in our Landmanagement industry model. In LandManagement jobs are usually in pending state for weeks or months. The reason why we have long running jobs is the legal framework - which is different from country to country.
Anyway - Landmanagement data is essential and is used in many other applications (such as by tax authority). To provide data to other applications becomes tricky when using jobs. And secondly - if you use jobs then all feature classes are "job enabled" although this is not required from a user's perspective. Often there is the need to have feature classes which are not job enabled. Today I'm going to show how one can have job-disabled feature classes in a job-enabled document (although without any guarantee it will work as expected).

Firstly - when you job-enable an industry model there are lots of tables which are not job enabled - for example as all "system" tables (starting with TB_). If you add the plot extension then all plot related tables will not be job enabled as well (plot tables start with PLT_). If you do intersections the result tables will not be job enabled either. Whereas the TB_ tables do not contain feature data the plot and intersection result tables do. So there is a mechanism in Map which allows having job-disabled feature classes in a job enabled document.

I believe that the first releases of the new AutoCAD Topobase (releases 2007-2009?) did allow the creation of job-disabled feature classes alongside job-enabled feature classes. For some reason this feature has been removed and whenever you create a feature class now (either in Map Administrator or by using the API functionality) feature classes get job enabled by default. It seems there is no flag or entry in one of the TB_ tables which controls whether the feature class is job enabled or not (although TB_DICTIONARY still contains a column called "Version_Enabled" but it doesn't seem to be used by Map).

Using the .net API an existing feature class can be job-disabled:


By doing so  - amongst other things - all JOB related data refering to the table (including job related columns in the table itself) are removed for good. When you open the industry model next time in Map-Administrator an error message will pop up, informing you that the job-configuration is not right and therefore needs to be repaired. It seems you can ignore the message but it is not nice being greeted by an error message whenever you start up Map-Administrator. To avoid the message and in order to create a feature class job-disabled right from the start a plugin is required. A simple implementation looks like this:

public class MyDocument : Autodesk.Map.IM.Forms.DocumentPlugIn
        public override void OnLoad(object sender, EventArgs e)
            this.Document.Connection.FeatureClasses.JobEnableStateChanging += new EventHandler<FeatureClassJobEnableStateChangeEventArgs>(FeatureClasses_JobEnableStateChanging);
        private void FeatureClasses_JobEnableStateChanging(object sender, FeatureClassJobEnableStateChangeEventArgs e)
            if (e.FeatureClass.ParentTopic.Name == "NOJOBS" && e.JobEnableFc)
                e.Cancel = true;

When a document (Industry model) is opened in Map-Administrator the OnLoad function is called and an event listener is registered. The event will be raised whenever Map tries to job-enable a feature class. The event occurs when the industry model is opened - Map performs some checks and will display the aforementioned error message if it finds job-disabled feature classes. The event also occurs when a new feature class is created.

In the example given above - as long as you create a new feature class in topic "NOJOBS" it will not be job-enabled and you will not receive any error messages when opening the Industry model.

We haven't yet tested extensively whether this works well or not. Autodesk certainly did have good reasons to disable the usage of job-disabled feature classes in a job enabled document. But on the other side - they do it themselve all the time. Would be nice to have more documentation on - in particular if there are any drawbacks....

If you have any further insight on how you can have job-disabled feature classes in a job-enabled document - please let me know. I might create a new blog entry about the underlying job concept in the near future.

Map 2013, SP2

Montag, 2. Februar 2015

blog activity - outlook 2015

My blogging activity has decreased over the last months - mainly because the number of issues we ran into and questions we encountered has reduced since late autumn. Since then we have Map 2013 successfully in production for most of our applications. The most important ones are:

- wastewater
- water
- gas
- electricity
- district heating

Additionally we have a number of smaller "industry models" successfully migrated from Topobase 2. A few are still managed in TB2 and we will probably migrate them in summer.
Now, that Map and our intranet web gis system (based on TBVIEW by Gerst) is up and running we are now more focussed on fine tuning. So, over the next months you will see some activity here but not as much as last year I suppose. 


Schema collection must contain exactly ONE schema!

We have a re-occurring error message in our AIMS log file:

<2014-10-29T06:25:59> 1900 Intranet-WebGIS Stadt Winterthur (Prod.) Anonymous
 Error: An exception occurred in FDO component.
        Schema collection must contain exactly ONE schema!
  - MgFeatureServiceHandler.ProcessOperation() line 83 file d:\build\ims2013\build_58.2\ent\os\server\src\services\feature\FeatureServiceHandler.cpp
  - MgOpGetIdentityProperties.Execute() line 112 file d:\build\ims2013\build_58.2\ent\os\server\src\services\feature\OpGetIdentityProperties.cpp

The message appears intermittently.

A few days ago a MAP user called me to his desk, telling me that he can't generate any graphics anymore. Instead the following error message appeared (translated):

Error whilst generating graphics. Adding layer failed: layer_name: Exception in FDO-Component: Schema collection must contain exactly ONE schema!

I was a bit surprised as I had seen the message before - but only in AIMS log files. Suddenly more an more users were complaining about the same issue - no one was able to work anymore.

We have multiple MAPSYS in use and users connect to different enterprise models - so the issues was not related to a specific enterprise or display model. As everyone was affected the cause was most likely to be found in our database. We decided to restart Oracle and the issue was solved. Our DBA noticed, that Oracle had reached the maximum number of sessions just before the issue became apparent. We have now increased the value in order to avoid similar issues in the future. The error message in AIMS occasionally still appears.

Map 2013, SP2