コード例 #1
0
 private void createCollectionSettings(Collection collection) {
   final ContentSettings contentSetting = new ContentSettings();
   if (collection.getSettings() == null || collection.getSettings().size() == 0) {
     collection.setSettings(Constants.COLLECTION_DEFAULT_SETTINGS);
   }
   contentSetting.setContent(collection);
   contentSetting.setData(
       new JSONSerializer().exclude(EXCLUDE).serialize(collection.getSettings()));
   getCollectionDao().save(contentSetting);
 }
コード例 #2
0
 private void updateCollectionSettings(Collection collection, Collection newCollection) {
   ContentSettings contentSettings = null;
   final Map<String, String> settings = new HashMap<String, String>();
   if (collection.getContentSettings() != null && collection.getContentSettings().size() > 0) {
     contentSettings = collection.getContentSettings().iterator().next();
     final Map<String, String> contentSettingsMap =
         JsonDeserializer.deserialize(
             contentSettings.getData(), new TypeReference<Map<String, String>>() {});
     settings.putAll(contentSettingsMap);
   }
   settings.putAll(newCollection.getSettings());
   newCollection.setSettings(settings);
   ContentSettings contentSetting =
       contentSettings == null ? new ContentSettings() : contentSettings;
   contentSetting.setContent(collection);
   contentSetting.setData(
       new JSONSerializer().exclude(EXCLUDE).serialize(newCollection.getSettings()));
   this.getCollectionDao().save(contentSetting);
 }