fredag den 23. oktober 2009

Check on which tier code is running.

A colleague of mine needed to determine (runtime) what ax-tier his code was running on.

We digged around, and he came up with the solution:

if (isRunningOnServer())
// Server
// Client

As a footnote he needed this check to make some code to refresh the AOS-code cache, when implementing quick-fixes to an environment running with multiple AOS-instances.

mandag den 19. oktober 2009

Merging code/elements in Layers

I've been assigned a task where the merge between VAR and CUS-layer of the application is necessary.

I like to make my self a TO-do-list of elements to be processed, so I can check an item when it is done.

I wrote a small job to identify elements in the application that were represented in both VAR and CUS-layers thus representing a potential layer-conflict.

The job produces an info-log with the potential conflicts that can be copied in to Excel to be used as a TO-DO-list.

static void JSOVarVapAndCusConflictsJob9(Args _args)
UtilIdElements utilIdElements;
UtilIdElements VarVapUtilIdElements;
Map elemMap;
MapIterator elemMI;
UtilElementType recType;
RecId utilId;
int pos;
str 60 elementName;

elemMap = new Map(Types::String,Types::String);
while select UtilIdElements
where (utilIdElements.utilLevel == UtilEntryLevel::cus)
&& UtilIdElements.parentId == 0

elemMI = new MapIterator(elemMap);
while (elemMi.more())
pos = strscan(elemMI.key(),";",1,strlen(elemMi.key())-1);
recType = str2enum(recType,substr(elemMI.key(),1,pos-1));
// utilId = str2num(substr(elemMI.key(),pos+1,strlen(elemMI.key())-pos));
elementName = elemMi.value();

select firstonly VarVapUtilIdElements
where VarVapUtilIdElements.recordType == recType
&& == elementName
&& (VarVapUtilIdElements.utilLevel == UtilEntryLevel::var ||
VarVapUtilIdElements.utilLevel == UtilEntryLevel::vap);
if (VarVapUtilIdElements.RecId)
info("Potentiel conflict between CUS- og VAR/VAP-lag: "+enum2str(recType)+" "+elemMI.value());