Пример #1
0
 protected LrpConfig createWidget(WidgetFactory f, Properties args, List<Result> results) {
   final String METHOD_NAME = "createWidget";
   boolean isTraceEnabled = LOGGER.isLoggable(Level.FINER);
   boolean isDebugEnabled = LOGGER.isLoggable(Level.FINEST);
   boolean isErrorEnabled = LOGGER.isLoggable(Level.SEVERE);
   if (isTraceEnabled) {
     LOGGER.entering(CLASS_NAME, METHOD_NAME, new Object[] {f, args, results});
   }
   if (isDebugEnabled) {
     LOGGER.finest(METHOD_NAME + " Invoking factory to create WCM assets...");
   }
   String templateId = getTemplateId();
   if (hasStyles()) {
     String style = args.getProperty("style");
     templateId = templateId + "_" + style;
   }
   LrpConfig lrpConfig = f.createWidget(templateId, args, results);
   if (isTraceEnabled) {
     LOGGER.exiting(CLASS_NAME, METHOD_NAME, lrpConfig);
   }
   return lrpConfig;
 }
Пример #2
0
 public void buildPortletConfiguration(
     ActionRequest request,
     ActionResponse response,
     Map<String, Object> adminPrefs,
     Map<String, Object> sharedPrefs)
     throws DesignerException {
   final String METHOD_NAME = "buildPortletConfiguration";
   boolean isTraceEnabled = LOGGER.isLoggable(Level.FINER);
   boolean isDebugEnabled = LOGGER.isLoggable(Level.FINEST);
   boolean isErrorEnabled = LOGGER.isLoggable(Level.SEVERE);
   if (isTraceEnabled) {
     LOGGER.entering(CLASS_NAME, METHOD_NAME, new Object[] {request.getParameterMap()});
   }
   Properties args = new Properties();
   List<Result> results = new ArrayList<Result>();
   processParameters(request, args, results);
   if (results.size() == 0) {
     WidgetFactory f = WidgetFactory.createWidgetFactory(request, response);
     LrpConfig lrpConfig = createWidget(f, args, results);
     if (lrpConfig != null) {
       if (isDebugEnabled) {
         LOGGER.finest(METHOD_NAME + " Widget creation successful! LRP config is " + lrpConfig);
       }
       sharedPrefs.put(Constants.WCM_CONTENT_TYPE_PREF, lrpConfig.getContentType());
       sharedPrefs.put(Constants.WCM_CONTENT_CONTEXT_TYPE_PREF, lrpConfig.getContentContextType());
       sharedPrefs.put(Constants.WCM_CONTENT_CONTEXT_IDR_PREF, lrpConfig.getContentIdr());
       String componentIdr = lrpConfig.getComponentIdr();
       String broadcastsTo = lrpConfig.getBroadcastsTo();
       String listensTo = lrpConfig.getListensTo();
       String categories = lrpConfig.getCategories();
       String siteAreas = lrpConfig.getSiteAreas();
       String title = lrpConfig.getPortletTitle();
       if (componentIdr != null) {
         sharedPrefs.put(Constants.WCM_COMPONENT_IDR_PREF, componentIdr);
       }
       if (broadcastsTo != null) {
         sharedPrefs.put(Constants.WCM_BROADCASTS_TO_PREF, broadcastsTo);
       }
       if (listensTo != null) {
         sharedPrefs.put(Constants.WCM_LISTENS_TO_PREF, listensTo);
       }
       if (categories != null) {
         sharedPrefs.put(Constants.WCM_CATEGORY_OVERRIDE_PREF, categories);
       }
       if (siteAreas != null) {
         sharedPrefs.put(Constants.WCM_SITEAREA_OVERRIDE_PREF, siteAreas);
       }
       if (title != null) {
         sharedPrefs.put(Constants.WCM_PORTLET_TITLE_PREF, title);
         sharedPrefs.put(
             Constants.WCM_PORTLET_TITLE_TYPE_PREF, Constants.WCM_PORTLET_TITLE_TYPE_GENERAL);
       }
       if (isDebugEnabled) {
         LOGGER.finest(METHOD_NAME + " Configured shared prefs: " + sharedPrefs);
       }
     } else {
       if (isDebugEnabled) {
         LOGGER.finest(METHOD_NAME + " Widget creation failed!");
       }
       DesignerException e = new DesignerException();
       for (Result r : results) {
         e.addResult(r);
       }
       throw e;
     }
   } else {
     DesignerException e = new DesignerException();
     for (Result r : results) {
       e.addResult(r);
     }
     throw e;
   }
   if (isTraceEnabled) {
     LOGGER.exiting(CLASS_NAME, METHOD_NAME);
   }
 }