+ ICdmApplicationConfiguration controller;
+ controller = CdmStore.getCurrentApplicationConfiguration();
+ PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode);
+ CdmPreference preference = null;
+ if (preferredCode == null){
+ preference = controller.getPreferenceService().find(key);
+ int index = StringUtils.lastIndexOf(preference.getValue(), ".");
+ UUID uuid = UUID.fromString(preference.getValue().substring(index +1, preference.getValue().length()));
+ preferredCode = NomenclaturalCode.getByUuid(uuid);
+ } else{
+ preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode, preferredCode.getKey());
+ controller.getPreferenceService().set(preference);
+ }
+
+