private final static Logger logger = Logger.getLogger(PreferencesUtil.class);
+
+
/**
* <p>
* getPreferenceStore
IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore();
String lastSelected = preferenceStore.getString(PreferencesUtil.LAST_SELECTED_REFERENCES);
List<String> result = new ArrayList<>();
- Collections.addAll(result, lastSelected.substring(1,lastSelected.length()-1).split(", "));
+ if (!StringUtils.isBlank(lastSelected)){
+ Collections.addAll(result, lastSelected.substring(1,lastSelected.length()-1).split(", "));
+ }
return result;
}
* @param saveCheckedElements
* @param saveGrayedElements
*/
-public static CdmPreference setPreferredNamedAreasForDistributionEditor(
+public static void setPreferredNamedAreasForDistributionEditor(
String saveCheckedElements, String saveGrayedElements, boolean local) {
if (local){
IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore();
}
else{
- ICdmRepository controller;
+// ICdmRepository controller;
// PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.AvailableDistributionAreaTerms);
CdmPreference preference = null;
if (saveCheckedElements == null){
preference = getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaTerms);
-// preference = controller.getPreferenceService().find(key);
+
if (preference == null){
- return null;
+ return ;
} else{
- String[] uuids = StringUtils.splitByWholeSeparator(saveCheckedElements, ",");
- List<UUID> uuidList = new ArrayList();
- for (String uuidString: uuids){
- uuidList.add(UUID.fromString(uuidString.trim()));
- }
getPreferenceStore().setValue(DISTRIBUTION_AREA_OCCURENCE_STATUS,
saveCheckedElements);
+ preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.AvailableDistributionAreaTerms, saveCheckedElements);
+ setPreferenceToDB(preference);
- return preference;
}
} else{
- controller = CdmStore.getCurrentApplicationConfiguration();
- preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.AvailableDistributionAreaTerms, saveCheckedElements);
- controller.getPreferenceService().set(preference);
+ preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.AvailableDistributionAreaTerms, saveCheckedElements);
+ setPreferenceToDB(preference);
+ getPreferenceStore().setValue(DISTRIBUTION_AREA_OCCURENCE_STATUS,
+ saveCheckedElements);
+
+ }
+ }
+
+}
+
+/**
+ * @param saveCheckedElements
+ * @param saveCheckedElements2
+ * @param b
+ */
+public static void setPreferredVocabulariesForDistributionEditor(String saveCheckedElements,
+ boolean local) {
+ if (local){
+ IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore();
+ preferenceStore.setValue(PreferencesUtil.DISTRIBUTION_VOCABULARIES, saveCheckedElements);
+
+
+ }
+ else{
+ ICdmRepository controller;
+ CdmPreference preference = null;
+
+ if (saveCheckedElements == null){
+ preference = getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
+
+ if (preference == null){
+ return ;
+ } else{
+ getPreferenceStore().setValue(DISTRIBUTION_VOCABULARIES,
+ saveCheckedElements);
+ preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.AvailableDistributionAreaVocabularies, saveCheckedElements);
+ setPreferenceToDB(preference);
+
+
+ }
+ } else{
+ preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.AvailableDistributionAreaVocabularies, saveCheckedElements);
+ setPreferenceToDB(preference);
getPreferenceStore().setValue(DISTRIBUTION_AREA_OCCURENCE_STATUS,
saveCheckedElements);
}
}
- return null;