/** {@inheritDoc} */
  private boolean sendPlfInformation(String accessTokencode) {
    try {
      String url = softwareRegistrationHost + "/portal/rest/registerSoftware/register";
      HttpClient client = new DefaultHttpClient();
      HttpPost httpPost = new HttpPost(url);

      JsonPlatformInfo jsonPlatformInfo = platformInformationRESTService.getJsonPlatformInfo();
      JSONObject jsonObj = new JSONObject(jsonPlatformInfo);

      String input = jsonObj.toString();

      httpPost.setHeader("Accept", "application/json");
      httpPost.setHeader("Content-type", "application/json");
      httpPost.setHeader("Authorization", "Bearer " + accessTokencode);
      httpPost.setEntity(new StringEntity(input));

      HttpResponse response = client.execute(httpPost);

      if (response.getStatusLine().getStatusCode() != 200) {
        LOG.warn("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
        return false;
      }
      return true;
    } catch (Exception e) {
      LOG.warn("Can not send Platform information to eXo community", e);
      return false;
    }
  }
Пример #2
0
  public boolean isAllowedToOverride(String parameterName) {
    if (unmodifiableParameters.contains(parameterName)) {
      if (LOG.isWarnEnabled()) {
        LOG.warn(
            "Parameter "
                + parameterName
                + " is not overridden because it is set to 'unmodifiable' via system properties in the "
                + SystemParametersPersistenceConfigurator.class.getSimpleName());
      }
      return false;
    }

    if (beforeInitializeParameters.contains(parameterName)) {
      if (workspaceInitializer == null) {
        parametersToValidate.put(parameterName, new Exception());
        return true;
      } else {
        if (workspaceInitializer.isWorkspaceInitialized()) {
          if (LOG.isWarnEnabled()) {
            LOG.warn(
                "Parameter "
                    + parameterName
                    + " is not overridden because workspace is already initialized and parameter is set to 'before-initialize'"
                    + " via system properties in the "
                    + SystemParametersPersistenceConfigurator.class.getSimpleName());
          }
          return false;
        }
      }
    }

    return true;
  }
  @Override
  public void removeMessageAfterSent() throws Exception {
    final boolean stats =
        NotificationContextFactory.getInstance().getStatistics().isStatisticsEnabled();
    boolean created = NotificationSessionManager.createSystemProvider();
    SessionProvider sProvider = NotificationSessionManager.getSessionProvider();

    try {
      Node notificationHome = getNotificationHomeNode(sProvider, workspace);
      Session session = notificationHome.getSession();
      // remove all
      Set<String> listPaths = removeByCallBack.get(REMOVE_ALL);
      removeByCallBack.remove(REMOVE_ALL);
      if (listPaths != null && listPaths.size() > 0) {
        for (String nodePath : listPaths) {
          try {
            session.getItem(nodePath).remove();
            // record entity delete here
            if (stats) {
              NotificationContextFactory.getInstance()
                  .getStatisticsCollector()
                  .deleteEntity(NTF_MESSAGE);
            }

            LOG.debug("Remove NotificationMessage " + nodePath);
          } catch (Exception e) {
            LOG.warn(
                "Failed to remove node of NotificationMessage " + nodePath + "\n" + e.getMessage());
            LOG.debug("Remove NotificationMessage " + nodePath, e);
          }
        }
        session.save();
      }

      listPaths = removeByCallBack.get(REMOVE_DAILY);
      if (listPaths != null && listPaths.size() > 0) {
        for (String nodePath : listPaths) {
          try {
            Item item = session.getItem(nodePath);
            if (item.isNode()) {
              Node node = (Node) item;
              node.setProperty(NTF_SEND_TO_DAILY, new String[] {""});
            }
            LOG.debug("Remove SendToDaily property " + nodePath);
          } catch (Exception e) {
            LOG.warn(
                "Failed to remove SendToDaily property of " + nodePath + "\n" + e.getMessage());
            LOG.debug("Remove SendToDaily property " + nodePath, e);
          }
        }
        session.save();
      }
    } catch (Exception e) {
      LOG.warn("Failed to remove message after sent email notification", e);
    } finally {
      NotificationSessionManager.closeSessionProvider(created);
    }
  }
Пример #4
0
  /*
   * (non-Javadoc)
   * @see
   * org.exoplatform.services.wcm.publication.WCMComposer#getContent(java.lang
   * .String, java.lang.String, java.lang.String, java.util.HashMap)
   */
  public Node getContent(
      String workspace,
      String nodeIdentifier,
      HashMap<String, String> filters,
      SessionProvider sessionProvider)
      throws Exception {
    String mode = filters.get(FILTER_MODE);
    String version = filters.get(FILTER_VERSION);
    String visibility = filters.get(FILTER_VISIBILITY);
    String remoteUser = getRemoteUser();
    String repository = null;

    try {
      repository = repositoryService.getCurrentRepository().getConfiguration().getName();
    } catch (Exception e) {
      if (LOG.isWarnEnabled()) {
        LOG.warn(e.getMessage());
      }
    }

    if (workspace == null) {
      if (nodeIdentifier.lastIndexOf("/") == 0) nodeIdentifier = nodeIdentifier.substring(1);
      String[] params = nodeIdentifier.split("/");
      workspace = params[1];
      try {
        nodeIdentifier = nodeIdentifier.substring(repository.length() + workspace.length() + 1);
      } catch (Exception e) {
        if (LOG.isWarnEnabled()) {
          LOG.warn(e.getMessage());
        }
      }
    }

    Node node = null;
    try {
      if (WCMComposer.VISIBILITY_PUBLIC.equals(visibility) && MODE_LIVE.equals(mode)) {
        sessionProvider =
            remoteUser == null
                ? aclSessionProviderService.getAnonymSessionProvider()
                : aclSessionProviderService.getACLSessionProvider(getAnyUserACL());
      }
      node = wcmService.getReferencedContent(sessionProvider, workspace, nodeIdentifier);
    } catch (RepositoryException e) {
      node = getNodeByCategory(nodeIdentifier);
    }
    if (version == null || !BASE_VERSION.equals(version)) {
      node = getViewableContent(node, filters);
    }

    return node;
  }
Пример #5
0
  /**
   * Builds avatar image uri from avatarAttachment.
   *
   * @param container
   * @param avatarAttachment
   * @return url to avatar
   */
  private static String buildAvatarImageUri(
      final PortalContainer container, final AvatarAttachment avatarAttachment) {
    String avatarUrl = null;
    try {
      if (avatarAttachment != null) {
        final String repository =
            ((RepositoryService) container.getComponentInstanceOfType(RepositoryService.class))
                .getCurrentRepository()
                .getConfiguration()
                .getName();

        avatarUrl =
            "/"
                + container.getRestContextName()
                + "/jcr/"
                + repository
                + "/"
                + avatarAttachment.getWorkspace()
                + avatarAttachment.getDataPath()
                + "/?upd="
                + avatarAttachment.getLastModified();
        avatarUrl = escapeJCRSpecialCharacters(avatarUrl);
      }
    } catch (Exception e) {
      LOG.warn("Failed to build avatar url from avatar attachment for: " + e.getMessage());
    }
    return avatarUrl;
  }
 public SoftwareRegistrationServiceImpl(
     ChromatticManager chromatticManager,
     NodeHierarchyCreator nodeHierarchyCreator,
     SettingService settingService,
     PlatformInformationRESTService platformInformationRESTService,
     InitParams initParams,
     UnlockService unlockService) {
   this.lifeCycle = chromatticManager.getLifeCycle(CHROMATTIC_LIFECYCLE_NAME);
   this.nodeHierarchyCreator = nodeHierarchyCreator;
   this.settingService = settingService;
   this.platformInformationRESTService = platformInformationRESTService;
   this.initParams = initParams;
   if (initParams != null && initParams.getValueParam(SOFTWARE_REGISTRATION_HOST) != null) {
     this.softwareRegistrationHost =
         initParams.getValueParam(SOFTWARE_REGISTRATION_HOST).getValue();
   }
   this.unlockService = unlockService;
   try {
     skipedNum =
         Integer.parseInt(initParams.getValueParam(SOFTWARE_REGISTRATION_SKIP_ALLOW).getValue());
   } catch (NumberFormatException nfe) {
     if (LOG.isWarnEnabled()) {
       LOG.warn("Skip allow configuration of PLF registration has been ignored!");
     }
   }
 }
Пример #7
0
  public boolean start() {
    try {
      prepareCache();

      ServerSocket serverSocket = null;
      int port = configuration.getCommandPort();
      // Trying to find a port available
      while (serverSocket == null) {
        try {
          serverSocket = new ServerSocket(port);
          LOG.info("FTPServer started on port '" + port + "'");
        } catch (BindException e) {
          LOG.warn(
              "Cannot launch the FTPServer on '" + (port++) + "', we try the next port number");
        }
      }

      dataChannelManager = new FtpDataChannelManagerImpl(configuration);

      acceptThread = new FtpAcceptThread(this, serverSocket);
      acceptThread.start();

      return true;
    } catch (Exception exc) {
      LOG.info("Unhandled exception. " + exc.getMessage(), exc);
    }

    return false;
  }
Пример #8
0
 private UIComponent addUIExtension(UIExtension extension, Map<String, Object> context)
     throws Exception {
   UIExtensionManager manager = getApplicationComponent(UIExtensionManager.class);
   UIComponent component = manager.addUIExtension(extension, context, this);
   if (component == null) return null;
   synchronized (component) {
     if (component instanceof UIAbstractManagerComponent) {
       // You can access to the given extension and the extension is valid
       UIAbstractManagerComponent uiAbstractManagerComponent =
           (UIAbstractManagerComponent) component;
       uiAbstractManagerComponent.setUIExtensionName(extension.getName());
       uiAbstractManagerComponent.setUIExtensionCategory(extension.getCategory());
       return component;
     } else if (component != null) {
       // You can access to the given extension but the extension is not valid
       if (LOG.isWarnEnabled()) {
         LOG.warn(
             "All the extension '"
                 + extension.getName()
                 + "' of type '"
                 + EXTENSION_TYPE
                 + "' must be associated to a component of type "
                 + UIAbstractManagerComponent.class);
       }
       removeChild(component.getClass());
     }
   }
   return null;
 }
Пример #9
0
 /**
  * Gets the spell suggestion.
  *
  * @param checkingWord the checking word
  * @param manageableRepository the manageable repository
  * @return the spell suggestion
  * @throws Exception the exception
  */
 private String getSpellSuggestion(String checkingWord, ManageableRepository manageableRepository)
     throws Exception {
   // Retrieve spell suggestion in special way to avoid access denied exception
   String suggestion = null;
   Session session = null;
   try {
     session =
         manageableRepository.getSystemSession(
             manageableRepository.getConfiguration().getDefaultWorkspaceName());
     QueryManager queryManager = session.getWorkspace().getQueryManager();
     Query query =
         queryManager.createQuery(
             "SELECT rep:spellcheck() FROM nt:base WHERE jcr:path like '/' AND SPELLCHECK('"
                 + checkingWord
                 + "')",
             Query.SQL);
     RowIterator rows = query.execute().getRows();
     Value value = rows.nextRow().getValue("rep:spellcheck()");
     if (value != null) {
       suggestion = value.getString();
     }
   } catch (Exception e) {
     if (LOG.isWarnEnabled()) {
       LOG.warn(e.getMessage());
     }
   } finally {
     if (session != null) session.logout();
   }
   return suggestion;
 }
  private void removeProperty(Session session, String path, String property, String value) {
    final boolean stats =
        NotificationContextFactory.getInstance().getStatistics().isStatisticsEnabled();
    try {
      Node node = (Node) session.getItem(path);
      List<String> values = NotificationUtils.valuesToList(node.getProperty(property).getValues());
      if (values.contains(value)) {
        values.remove(value);
        if (values.isEmpty()) {
          values.add("");
        }
        node.setProperty(property, values.toArray(new String[values.size()]));
        node.save();

        // record entity update here
        if (stats) {
          NotificationContextFactory.getInstance()
              .getStatisticsCollector()
              .updateEntity(NTF_MESSAGE);
        }
      }
    } catch (Exception e) {
      LOG.warn(String.format("Failed to remove property %s of value %s on node ", property, value));
    }
  }
Пример #11
0
  /** {@inheritDoc} */
  public void deleteSpace(Space space) {
    try {

      // remove memberships of users with deleted space.
      SpaceUtils.removeMembershipFromGroup(space);

      spaceStorage.deleteSpace(space.getId());

      OrganizationService orgService = getOrgService();
      UserACL acl = getUserACL();
      GroupHandler groupHandler = orgService.getGroupHandler();
      Group deletedGroup = groupHandler.findGroupById(space.getGroupId());
      List<String> mandatories = acl.getMandatoryGroups();
      if (deletedGroup != null) {
        if (!isMandatory(groupHandler, deletedGroup, mandatories)) {
          SpaceUtils.removeGroup(space);
        }
      } else {
        LOG.warn("deletedGroup is null");
      }

      // remove pages and group navigation of space
      SpaceUtils.removePagesAndGroupNavigation(space);

    } catch (Exception e) {
      LOG.error("Unable delete space", e);
    }
    spaceLifeCycle.spaceRemoved(space, null);
  }
Пример #12
0
 protected void forumUpdated(String path, String linkItem, final boolean updated) {
   try {
     Node forumNode = (Node) getCurrentSession().getItem(path);
     NodeIterator nodeIterator = forumNode.getNodes();
     Node topicNode = null;
     while (nodeIterator.hasNext()) {
       topicNode = nodeIterator.nextNode();
       if (topicNode.isNodeType("exo:topic")) {
         topicUpdated(topicNode.getPath(), linkItem, updated);
       }
     }
   } catch (PathNotFoundException e) {
     LOG.warn("Failed to get item with path " + path, e);
   } catch (RepositoryException e) {
     LOG.warn("Failed to get item with path " + path, e);
   }
 }
  public BaseActivityProcessorPlugin(InitParams params) {

    try {
      priority = Integer.valueOf(params.getValueParam("priority").getValue());
      if (priority < 1) {
        LOG.warn("<value-param> 'priority' of type int should be higher than 1");
        priority = 1;
      } else if (priority > 10) {
        LOG.warn("<value-param> 'priority' of type int should be lower than 10");
        priority = 10;
      }
    } catch (Exception e) {
      priority = 5; // default, it should be in range of 1-10
      LOG.warn(
          "an <value-param> 'priority' of type int is recommanded for component " + getClass());
    }
  }
Пример #14
0
 /**
  * remove current calendar setting from registry.
  *
  * @return
  */
 public static CalendarSetting removeCurrentCalendarSetting() {
   try {
     return calendarSettingsByUserName.remove(getCurrentUser());
   } catch (Exception e) {
     log.warn("could not remove calendar setting of the user.", e);
     return null;
   }
 }
Пример #15
0
 /** {@inheritDoc} */
 public void addInvitedUser(Space space, String userId) {
   if (ArrayUtils.contains(space.getInvitedUsers(), userId)) {
     LOG.warn("User already invited");
     return;
   } else if (ArrayUtils.contains(space.getMembers(), userId)
       && !userId.equals(getUserACL().getSuperUser())) {
     LOG.warn("User already member");
     return;
   }
   if (isPending(space, userId)) {
     space = removePending(space, userId);
     addMember(space, userId);
   } else {
     space = addInvited(space, userId);
   }
   this.updateSpace(space);
 }
 /**
  * registry resource object
  *
  * @param resource
  * @return
  * @throws Exception
  */
 public boolean registry(Object resource) throws Exception {
   try {
     addResource(resource, null);
     return true;
   } catch (ResourcePublicationException e) {
     LOG.warn(e.getMessage());
     return false;
   }
 }
Пример #17
0
 /** using for re-observer */
 public void start() {
   try {
     reInitObserver();
   } catch (Exception e) {
     if (LOG.isWarnEnabled()) {
       LOG.warn("==>>> Exeption when startd WatchDocumentSerice!!!!");
     }
   }
 }
Пример #18
0
 public static String getResourceBundle(String key, String defaultValue) {
   WebuiRequestContext context = RequestContext.getCurrentInstance();
   ResourceBundle res = context.getApplicationResourceBundle();
   try {
     return res.getString(key);
   } catch (MissingResourceException e) {
     log.warn("Can not find the resource for key: " + key);
     return defaultValue;
   }
 }
Пример #19
0
 public void updateData() {
   try {
     UIWikiSyntaxPreferences uiWikiSyntaxPreferences = getChildById(PREFERENCES_SYNTAX);
     if (uiWikiSyntaxPreferences != null) {
       uiWikiSyntaxPreferences.updateData();
     }
   } catch (Exception e) {
     log.warn("Can not update data for syntax setting form", e);
   }
 }
Пример #20
0
 /**
  * @return return an instance of Calendar class which contains user's setting, such as, time zone,
  *     first day of week.
  */
 public static Calendar getInstanceOfCurrentCalendar() {
   try {
     CalendarSetting setting = getCurrentUserCalendarSetting();
     return getCalendarInstanceBySetting(setting);
   } catch (Exception e) {
     if (log.isWarnEnabled()) log.warn("Could not get calendar setting!", e);
     Calendar calendar = Calendar.getInstance();
     calendar.setLenient(false);
     return calendar;
   }
 }
Пример #21
0
 /**
  * Gets activity link of space or user; remoteId should be the id name. For example:
  * organization:root or space:abc_def.
  *
  * @param providerId The provider information.
  * @param remoteId The id of target identity.
  * @return The link to activity of provided user on provided provider. @LevelAPI Platform
  */
 public static String getActivityUri(final String providerId, final String remoteId) {
   final String prefix = getBaseUri(null, null) + "/";
   if (providerId.equals(OrganizationIdentityProvider.NAME)) {
     return String.format("%sactivities/%s", prefix, remoteId);
   } else if (providerId.equals(SpaceIdentityProvider.NAME)) {
     return String.format("/%s/g/:spaces:%s/%s", getPortalName(null), remoteId, remoteId);
   } else {
     LOG.warn("Failed to getActivityLink with providerId: " + providerId);
   }
   return null;
 }
Пример #22
0
 /**
  * change value of calendar setting of user in registry.
  *
  * @param setting = null means that current calendar setting will be removed.
  */
 public static void setCurrentCalendarSetting(CalendarSetting setting) {
   try {
     if (setting == null) {
       calendarSettingsByUserName.remove(getCurrentUser());
     } else {
       calendarSettingsByUserName.put(getCurrentUser(), setting);
     }
   } catch (Exception e) {
     log.warn("could not set calendar setting for current user", e);
   }
 }
Пример #23
0
 /**
  * This method will re-observer all nodes that have been ever observed with all repositories.
  *
  * @throws Exception
  */
 private void reInitObserver() throws Exception {
   RepositoryEntry repo = repoService_.getCurrentRepository().getConfiguration();
   ManageableRepository repository = repoService_.getCurrentRepository();
   String[] workspaceNames = repository.getWorkspaceNames();
   for (String workspace : workspaceNames) {
     Session session = repository.getSystemSession(workspace);
     QueryManager queryManager = null;
     try {
       queryManager = session.getWorkspace().getQueryManager();
     } catch (Exception e) {
       if (LOG.isErrorEnabled()) {
         LOG.error("Unexpected error", e);
       }
     }
     if (queryManager == null) {
       session.logout();
       continue;
     }
     try {
       Query query = queryManager.createQuery(WATCHABLE_MIXIN_QUERY, Query.XPATH);
       QueryResult queryResult = query.execute();
       for (NodeIterator iter = queryResult.getNodes(); iter.hasNext(); ) {
         Node observedNode = iter.nextNode();
         EmailNotifyListener emailNotifyListener = new EmailNotifyListener(observedNode);
         ObservationManager manager = session.getWorkspace().getObservationManager();
         List<String> list = getDocumentNodeTypes(observedNode);
         String[] observedNodeTypeNames = list.toArray(new String[list.size()]);
         manager.addEventListener(
             emailNotifyListener,
             Event.PROPERTY_CHANGED,
             observedNode.getPath(),
             true,
             null,
             observedNodeTypeNames,
             false);
       }
       session.logout();
     } catch (Exception e) {
       if (LOG.isWarnEnabled()) {
         LOG.warn(
             "==>>> Cannot init observer for node: "
                 + e.getLocalizedMessage()
                 + " in '"
                 + repo.getName()
                 + "' repository");
       }
       if (LOG.isErrorEnabled()) {
         LOG.error("Unexpected error", e);
       }
     }
   }
 }
Пример #24
0
 /** {@inheritDoc} */
 public void deactivateApplication(Space space, String appId) throws SpaceException {
   String appStatus = SpaceUtils.getAppStatus(space, appId);
   if (appStatus == null) {
     LOG.warn("appStatus is null!");
     return;
   }
   if (appStatus.equals(Space.DEACTIVE_STATUS)) return;
   SpaceApplicationHandler appHandler = getSpaceApplicationHandler(space);
   appHandler.deactiveApplication(space, appId);
   setApp(space, appId, appId, SpaceUtils.isRemovableApp(space, appId), Space.DEACTIVE_STATUS);
   saveSpace(space, false);
   spaceLifeCycle.deactivateApplication(space, getPortletId(appId));
 }
 public SpaceActivityStreamUpdaterPlugin(InitParams initParams) {
   super(initParams);
   if (initParams.containsKey("limit")) {
     try {
       String value = initParams.getValueParam("limit").getValue();
       if (value != null) {
         limit = Integer.valueOf(value);
       }
     } catch (NumberFormatException e) {
       LOG.warn("Integer number expected for property " + name);
     }
   }
 }
Пример #26
0
  /** {@inheritDoc} */
  public void addPendingUser(Space space, String userId) {
    if (ArrayUtils.contains(space.getPendingUsers(), userId)) {
      this.addMember(space, userId);
      space = removeInvited(space, userId);
      this.updateSpace(space);
      return;
    }

    String registration = space.getRegistration();
    String visibility = space.getVisibility();
    if (visibility.equals(Space.HIDDEN)) {
      LOG.warn("Unable request to join hidden");
      return;
    }
    if (registration.equals(Space.OPEN)) {
      addMember(space, userId);
    } else if (registration.equals(Space.VALIDATION)) {
      space = addPending(space, userId);
      saveSpace(space, false);
    } else {
      LOG.warn("Unable request to join");
    }
  }
Пример #27
0
 private URL getOembedUrl(String url) {
   try {
     for (Pattern pattern : schemeEndpointMap.keySet()) {
       Matcher matcher = pattern.matcher(url);
       if (matcher.find()) {
         String endpoint = schemeEndpointMap.get(pattern);
         return new URL(String.format(endpoint, url));
       }
     }
   } catch (MalformedURLException e) {
     LOG.warn("Can't get oembed url for oembed request", e);
   }
   return null;
 }
Пример #28
0
 private WikiPageParams getCurrentWikiPageParams() {
   WikiPageParams wikiPageParams = null;
   try {
     wikiPageParams = Utils.getCurrentWikiPageParams();
   } catch (Exception e) {
     log.warn("Can't get current wiki page params", e);
   }
   UIWikiPortlet wikiPortlet = this.getAncestorOfType(UIWikiPortlet.class);
   if (wikiPortlet.getWikiMode() == WikiMode.ADDPAGE) {
     String sessionId = Util.getPortalRequestContext().getRequest().getSession(false).getId();
     wikiPageParams.setPageId(sessionId);
   }
   return wikiPageParams;
 }
Пример #29
0
  /**
   * SpaceServiceImpl constructor Initialize <tt>org.exoplatform.social.space.impl.JCRStorage</tt>
   *
   * @param params
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  public SpaceServiceImpl(
      InitParams params, SpaceStorage spaceStorage, IdentityStorage identityStorage)
      throws Exception {

    this.spaceStorage = spaceStorage;
    this.identityStorage = identityStorage;

    // backward compatible
    if (params != null) {
      LOG.warn(
          "The SpaceService configuration you attempt to use is deprecated, please update it by"
              + "using external-component-plugins configuration");
      spaceApplicationConfigPlugin = new SpaceApplicationConfigPlugin();
      Iterator<?> it = params.getValuesParamIterator();

      while (it.hasNext()) {
        ValuesParam param = (ValuesParam) it.next();
        String name = param.getName();
        if (name.endsWith("homeNodeApp")) {
          String homeNodeApp = param.getValue();
          SpaceApplication spaceHomeApplication = new SpaceApplication();
          spaceHomeApplication.setPortletName(homeNodeApp);
          spaceHomeApplication.setAppTitle(homeNodeApp);
          spaceHomeApplication.setIcon("SpaceHomeIcon");
          spaceApplicationConfigPlugin.setHomeApplication(spaceHomeApplication);
        }
        if (name.endsWith("apps")) {
          List<String> apps = param.getValues();
          for (String app : apps) {
            String[] splitedString = app.trim().split(":");
            String appName;
            boolean isRemovable;
            if (splitedString.length >= 2) {
              appName = splitedString[0];
              isRemovable = Boolean.getBoolean(splitedString[1]);
            } else { // suppose app is just the name
              appName = app;
              isRemovable = false;
            }
            SpaceApplication spaceApplication = new SpaceApplication();
            spaceApplication.setPortletName(appName);
            spaceApplication.isRemovable(isRemovable);

            spaceApplicationConfigPlugin.addToSpaceApplicationList(spaceApplication);
          }
        }
      }
    }
  }
  private static void buildUIContainer(UIContainer uiContainer, Object model, boolean dashboard)
      throws Exception {
    UIComponent uiComponent = null;
    WebuiRequestContext context = Util.getPortalRequestContext();

    if (model instanceof SiteBody) {
      UISiteBody uiSiteBody = uiContainer.createUIComponent(context, UISiteBody.class, null, null);
      uiSiteBody.setStorageId(((SiteBody) model).getStorageId());
      uiComponent = uiSiteBody;
    } else if (model instanceof PageBody) {
      UIPageBody uiPageBody = uiContainer.createUIComponent(context, UIPageBody.class, null, null);
      uiPageBody.setStorageId(((PageBody) model).getStorageId());
      uiComponent = uiPageBody;
    } else if (model instanceof Application) {
      Application application = (Application) model;

      if (dashboard && application.getType() == ApplicationType.GADGET) {
        Application<Gadget> ga = (Application<Gadget>) application;
        UIGadget uiGadget = uiContainer.createUIComponent(context, UIGadget.class, null, null);
        uiGadget.setStorageId(application.getStorageId());
        toUIGadget(uiGadget, ga);
        uiComponent = uiGadget;
      } else {
        UIPortlet uiPortlet = uiContainer.createUIComponent(context, UIPortlet.class, null, null);
        uiPortlet.setStorageId(application.getStorageId());
        if (application.getStorageName() != null) {
          uiPortlet.setStorageName(application.getStorageName());
        }
        toUIPortlet(uiPortlet, application);
        uiComponent = uiPortlet;
      }
    } else if (model instanceof Container) {
      Container container = (Container) model;

      UIComponentFactory<? extends UIContainer> factory =
          UIComponentFactory.getInstance(UIContainer.class);
      UIContainer uiTempContainer = factory.createUIComponent(container.getFactoryId(), context);

      if (uiTempContainer == null) {
        log.warn(
            "Can't find container factory for: {}. Default container is used",
            container.getFactoryId());
        uiTempContainer = uiContainer.createUIComponent(context, UIContainer.class, null, null);
      }

      toUIContainer(uiTempContainer, (Container) model, dashboard);
      uiComponent = uiTempContainer;
    }
    uiContainer.addChild(uiComponent);
  }