Ejemplo n.º 1
0
  /**
   * constructor
   *
   * @throws Exception
   */
  public UIUserActivitiesDisplay() throws Exception {
    List<SelectItemOption<String>> displayModes = new ArrayList<SelectItemOption<String>>(4);
    displayModes.add(
        new SelectItemOption<String>("All_Updates", DisplayMode.ALL_ACTIVITIES.toString()));
    displayModes.add(
        new SelectItemOption<String>("Space_Updates", DisplayMode.MY_SPACE.toString()));
    displayModes.add(
        new SelectItemOption<String>("Network_Updates", DisplayMode.CONNECTIONS.toString()));
    displayModes.add(
        new SelectItemOption<String>("My_Status", DisplayMode.MY_ACTIVITIES.toString()));

    UIDropDownControl uiDropDownControl =
        addChild(UIDropDownControl.class, "DisplayModesDropDown", null);
    uiDropDownControl.setOptions(displayModes);

    setSelectedMode(uiDropDownControl);

    addChild(uiDropDownControl);

    // TODO: init() run two time when initiation this form.
    // String remoteId = Utils.getOwnerRemoteId();
    // this.setOwnerName(remoteId);
    String selectedDisplayMode =
        Utils.getCookies(
            String.format(Utils.ACTIVITY_STREAM_TAB_SELECTED_COOKIED, Utils.getViewerRemoteId()));
    selectedDisplayMode =
        (selectedDisplayMode != null) ? selectedDisplayMode : DisplayMode.ALL_ACTIVITIES.name();

    //
    setSelectedDisplayMode(selectedDisplayMode);

    // set lastUpdatedNumber after init() method invoked inside setSelectedDisplayMode() method
    // int numberOfUpdates = this.getNumberOfUpdatedActivities();
    // setLastUpdatedNum(selectedDisplayMode.toString(), "" + numberOfUpdates);
  }
Ejemplo n.º 2
0
  private long getLastUpdatedNum(String mode) {
    String cookieKey =
        String.format(Utils.LAST_UPDATED_ACTIVITIES_NUM, mode, Utils.getViewerRemoteId());
    String strValue = Utils.getCookies(cookieKey);
    boolean refreshPage = Utils.isRefreshPage();

    if (strValue == null || (refreshPage == false && mode.equals(selectedDisplayMode.toString()))) {
      return 0;
    }

    return Long.parseLong(strValue);
  }
Ejemplo n.º 3
0
  public void resetCookies() {
    Utils.setLastVisited(this.selectedDisplayMode.toString());

    //
    if (this.selectedDisplayMode == DisplayMode.ALL_ACTIVITIES) {
      Utils.setLastVisited(DisplayMode.CONNECTIONS.toString());

      //
      Utils.setLastVisited(DisplayMode.MY_ACTIVITIES.toString());

      //
      Utils.setLastVisited(DisplayMode.MY_SPACE.toString());
    }
  }
Ejemplo n.º 4
0
    public void execute(Event<UIDropDownControl> event) throws Exception {
      UIDropDownControl uiDropDown = event.getSource();
      UIUserActivitiesDisplay uiUserActivities = uiDropDown.getParent();
      WebuiRequestContext requestContext = event.getRequestContext();
      String selectedDisplayMode = requestContext.getRequestParameter(OBJECTID);

      if (selectedDisplayMode.equals(DisplayMode.ALL_ACTIVITIES.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.ALL_ACTIVITIES);
      } else if (selectedDisplayMode.equals(DisplayMode.MY_ACTIVITIES.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.MY_ACTIVITIES);
      } else if (selectedDisplayMode.equals(DisplayMode.MY_SPACE.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.MY_SPACE);
      } else {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.CONNECTIONS);
      }

      if (selectedDisplayMode != null) {
        uiUserActivities.setSelectedDisplayMode(selectedDisplayMode);
        uiUserActivities.init();

        uiUserActivities.setChangedMode(false);

        // int numberOfUpdates = uiUserActivities.getNumberOfUpdatedActivities();

        //
        event
            .getRequestContext()
            .getJavascriptManager()
            .require("SHARED/social-ui-activity-updates", "activityUpdates")
            .addScripts(
                "activityUpdates.resetCookie('"
                    + String.format(
                        Utils.ACTIVITY_STREAM_TAB_SELECTED_COOKIED, Utils.getViewerRemoteId())
                    + "','"
                    + selectedDisplayMode
                    + "');");
        //
        //       event.getRequestContext().getJavascriptManager()
        //       .require("SHARED/social-ui-activity-updates",
        // "activityUpdates").addScripts("activityUpdates.resetCookie('" +
        // String.format(Utils.LAST_UPDATED_ACTIVITIES_NUM, selectedDisplayMode,
        // Utils.getViewerRemoteId()) + "','" + numberOfUpdates + "');");

      }

      requestContext.addUIComponentToUpdateByAjax(uiUserActivities);

      Utils.resizeHomePage();
    }
Ejemplo n.º 5
0
 /**
  * data initialization; set space by spaceUrl to work with
  *
  * @throws Exception
  */
 public void initData() throws Exception {
   String spaceUrl = Utils.getSpaceUrlByContext();
   Space space = spaceSrc.getSpaceByUrl(spaceUrl);
   if (space != null) {
     uiSpaceSetting.setValues(space);
   }
 }
Ejemplo n.º 6
0
    public void execute(Event<UIUserActivitiesDisplay> event) throws Exception {
      UIUserActivitiesDisplay uiUserActivities = event.getSource();
      uiUserActivities.init();
      event.getRequestContext().addUIComponentToUpdateByAjax(uiUserActivities);

      Utils.resizeHomePage();
    }
Ejemplo n.º 7
0
 public void saveAvatar(UIAvatarUploadContent uiAvatarUploadContent, Space space)
     throws Exception {
   SpaceService spaceService = getSpaceService();
   space.setAvatarAttachment(uiAvatarUploadContent.getAvatarAttachment());
   spaceService.updateSpace(space);
   space.setEditor(Utils.getViewerRemoteId());
   spaceService.updateSpaceAvatar(space);
 }
Ejemplo n.º 8
0
  private List<Identity> loadPeople(int index, int length, Type type) throws Exception {
    Identity[] result = null;
    Space space = getSpace();
    if (Type.MEMBER.equals(type)) {
      ProfileFilter filter = uiSearchMemberOfSpace.getProfileFilter();
      setMemberListAccess(
          Utils.getIdentityManager().getSpaceIdentityByProfileFilter(space, filter, type, true));

      setMemberNum(getMemberListAccess().getSize());
      uiSearchMemberOfSpace.setPeopleNum(getMemberNum());
      result = getMemberListAccess().load(index, length);
    } else if (Type.MANAGER.equals(type)) {
      ProfileFilter filter = uiSearchMemberOfSpace.getProfileFilter();
      setManagerListAccess(
          Utils.getIdentityManager().getSpaceIdentityByProfileFilter(space, filter, type, true));
      result = getManagerListAccess().load(index, length);
    }
    return Arrays.asList(result);
  }
Ejemplo n.º 9
0
  protected boolean isWelcomeActivity() {
    viewerName = PortalRequestContext.getCurrentInstance().getRemoteUser();
    if (!viewerName.equals(ownerName)) return false;

    boolean hasActivities = getActivitiesLoader().getActivitiesContainer().getChildren().size() > 0;
    boolean isAllActivitiesModeOnHomePage =
        DisplayMode.ALL_ACTIVITIES.equals(getSelectedDisplayMode());

    return Utils.isHomePage() ? !hasActivities && isAllActivitiesModeOnHomePage : !hasActivities;
  }
Ejemplo n.º 10
0
    public void execute(Event<UIMembersPortlet> event) throws Exception {
      UIMembersPortlet uiAllPeople = event.getSource();
      String userId = event.getRequestContext().getRequestParameter(OBJECTID);
      Identity invitedIdentity = Utils.getIdentityManager().getIdentity(userId, true);
      Identity invitingIdentity = Utils.getViewerIdentity();

      Relationship relationship =
          Utils.getRelationshipManager().get(invitingIdentity, invitedIdentity);
      uiAllPeople.setLoadAtEnd(false);

      if (relationship == null || relationship.getStatus() != Relationship.Type.PENDING) {
        UIApplication uiApplication = event.getRequestContext().getUIApplication();
        uiApplication.addMessage(
            new ApplicationMessage(INVITATION_REVOKED_INFO, null, ApplicationMessage.INFO));
        return;
      }

      Utils.clearCacheOnUserPopup();
      Utils.getRelationshipManager().confirm(invitedIdentity, invitingIdentity);
    }
Ejemplo n.º 11
0
  private List<Identity> loadPeople(int index, int length) throws Exception {

    lastOwner = Utils.getOwnerIdentity();

    ProfileFilter filter = uiProfileUserSearch.getProfileFilter();

    ListAccess<Identity> listAccess =
        Utils.getRelationshipManager().getIncomingByFilter(lastOwner, filter);
    Identity[] identities = listAccess.load(index, length);

    setPeopleNum(
        identities.length < RECEIVED_INVITATION_PER_PAGE
            ? identities.length
            : listAccess.getSize());

    setPeopleListAccess(listAccess);
    uiProfileUserSearch.setPeopleNum(getPeopleNum());

    return Arrays.asList(identities);
  }
Ejemplo n.º 12
0
    @Override
    public void execute(Event<UIInvitations> event) throws Exception {
      UIInvitations uiInvitations = event.getSource();
      String identityId = event.getRequestContext().getRequestParameter(OBJECTID);
      Identity invitedIdentity = Utils.getIdentityManager().getIdentity(identityId, true);
      Identity invitingIdentity = Utils.getViewerIdentity();

      Relationship relationship =
          Utils.getRelationshipManager().get(invitingIdentity, invitedIdentity);
      uiInvitations.setLoadAtEnd(false);
      if (relationship == null || relationship.getStatus() != Relationship.Type.PENDING) {
        UIApplication uiApplication = event.getRequestContext().getUIApplication();
        uiApplication.addMessage(
            new ApplicationMessage(INVITATION_REVOKED_INFO, null, ApplicationMessage.INFO));
        return;
      }

      Utils.getRelationshipManager().deny(invitedIdentity, invitingIdentity);
      Utils.clearCacheOnUserPopup();
      event.getRequestContext().addUIComponentToUpdateByAjax(uiInvitations);
    }
Ejemplo n.º 13
0
    public void execute(Event<UIMembersPortlet> event) throws Exception {
      UIMembersPortlet uiAllPeople = event.getSource();
      String userId = event.getRequestContext().getRequestParameter(OBJECTID);
      Identity invitedIdentity = Utils.getIdentityManager().getIdentity(userId, true);
      Identity invitingIdentity = Utils.getViewerIdentity();

      Relationship relationship =
          Utils.getRelationshipManager().get(invitingIdentity, invitedIdentity);
      uiAllPeople.setLoadAtEnd(false);

      if (relationship != null) {
        UIApplication uiApplication = event.getRequestContext().getUIApplication();
        uiApplication.addMessage(
            new ApplicationMessage(INVITATION_ESTABLISHED_INFO, null, ApplicationMessage.INFO));
        return;
      }

      Utils.getRelationshipManager().inviteToConnect(invitingIdentity, invitedIdentity);
      Utils.clearCacheOnUserPopup();
      event.getRequestContext().addUIComponentToUpdateByAjax(uiAllPeople);
    }
Ejemplo n.º 14
0
 /**
  * initialize members, called from {@link #getMembers()}
  *
  * @throws Exception
  */
 public void initMember() throws Exception {
   try {
     setLoadAtEnd(false);
     enableLoadNext = false;
     currentLoadIndex = 0;
     setSelectedChar(ALL_FILTER);
     memberProfileFilter = new ProfileFilter();
     memberProfileFilter.getExcludedIdentityList().add(Utils.getViewerIdentity());
     uiSearchMemberOfSpace.setProfileFilter(memberProfileFilter);
   } catch (Exception e) {
     LOG.error(e.getMessage(), e);
   }
 }
Ejemplo n.º 15
0
 /**
  * Inits at the first loading.
  *
  * @since 1.2.2
  */
 public void init() {
   try {
     setLoadAtEnd(false);
     enableLoadNext = false;
     currentLoadIndex = 0;
     loadingCapacity = RECEIVED_INVITATION_PER_PAGE;
     peopleList = new ArrayList<Identity>();
     List<Identity> excludedIdentityList = new ArrayList<Identity>();
     excludedIdentityList.add(Utils.getViewerIdentity());
     uiProfileUserSearch.getProfileFilter().setExcludedIdentityList(excludedIdentityList);
     // setPeopleList(loadPeople(currentLoadIndex, loadingCapacity));
   } catch (Exception e) {
     LOG.error(e.getMessage(), e);
   }
 }
  public void reloadTreeData() throws Exception {
    UserPortal userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
    SpaceService spaceService = getApplicationComponent(SpaceService.class);
    String spaceUrl = Utils.getSpaceUrlByContext();
    Space space = spaceService.getSpaceByUrl(spaceUrl);

    UserNavigation groupNav = SpaceUtils.getGroupNavigation(space.getGroupId());

    setOwner(groupNav.getKey().getName());
    setOwnerType(groupNav.getKey().getTypeName());

    UISpaceNavigationNodeSelector selector = getChild(UISpaceNavigationNodeSelector.class);
    selector.setEdittedNavigation(groupNav);
    selector.setUserPortal(userPortal);
    selector.initTreeData();
  }
Ejemplo n.º 17
0
 /**
  * Return true to accept user is viewing can edit.
  *
  * @return true if current user is current login user.
  */
 public boolean isEditable() {
   return Utils.isOwner();
 }
Ejemplo n.º 18
0
  /**
   * initialize
   *
   * @throws Exception
   */
  public void init() throws Exception {
    Validate.notNull(ownerName, "ownerName must not be null.");
    Validate.notNull(viewerName, "viewerName must not be null.");
    //
    synchronized (locker) {
      removeChild(UIActivitiesLoader.class);
      activitiesLoader = addChild(UIActivitiesLoader.class, null, "UIActivitiesLoader");
    }
    //
    String activityId = Utils.getActivityID();
    if (activityId != null && activityId.length() > 0) {
      activitiesLoader.setPostContext(PostContext.SINGLE);
    } else {
      activitiesLoader.setPostContext(PostContext.USER);
    }

    // Check if current display page is My Activity Stream
    String currentUserName = URLUtils.getCurrentUser();
    if (currentUserName != null) {
      selectedDisplayMode = DisplayMode.OWNER_STATUS;
    }

    activitiesLoader.setLoadingCapacity(ACTIVITY_PER_PAGE);
    activitiesLoader.setOwnerName(ownerName);
    activitiesLoader.setSelectedDisplayMode(selectedDisplayMode.toString());

    //
    //    UIActivitiesContainer activitiesContainer =
    // activitiesLoader.getChild(UIActivitiesContainer.class);

    //
    Identity ownerIdentity =
        Utils.getIdentityManager()
            .getOrCreateIdentity(OrganizationIdentityProvider.NAME, ownerName, false);

    ActivityManager activityManager = Utils.getActivityManager();
    ListAccess<ExoSocialActivity> activitiesListAccess = null;

    switch (this.selectedDisplayMode) {
      case MY_ACTIVITIES:
        activitiesListAccess = activityManager.getActivitiesWithListAccess(ownerIdentity);
        activitiesLoader.setActivityListAccess(activitiesListAccess);
        break;
      case OWNER_STATUS:
        if (isActivityStreamOwner == false) {
          Identity viewerIdentity =
              Utils.getIdentityManager()
                  .getOrCreateIdentity(OrganizationIdentityProvider.NAME, viewerName, false);
          activitiesListAccess =
              activityManager.getActivitiesWithListAccess(ownerIdentity, viewerIdentity);
          activitiesLoader.setActivityListAccess(activitiesListAccess);
        } else {
          activitiesListAccess = activityManager.getActivitiesWithListAccess(ownerIdentity);
          activitiesLoader.setActivityListAccess(activitiesListAccess);
        }

        break;
      case CONNECTIONS:
        activitiesListAccess =
            activityManager.getActivitiesOfConnectionsWithListAccess(ownerIdentity);
        activitiesLoader.setActivityListAccess(activitiesListAccess);
        break;
      case MY_SPACE:
        activitiesListAccess =
            activityManager.getActivitiesOfUserSpacesWithListAccess(ownerIdentity);
        activitiesLoader.setActivityListAccess(activitiesListAccess);
        break;
      default:
        activitiesListAccess = activityManager.getActivityFeedWithListAccess(ownerIdentity);
        activitiesLoader.setActivityListAccess(activitiesListAccess);
        break;
    }

    //
    String lastVisitedModeCookieKey =
        String.format(Utils.ACTIVITY_STREAM_TAB_SELECTED_COOKIED, Utils.getViewerRemoteId());
    String lastVisitedMode = Utils.getCookies(lastVisitedModeCookieKey);

    this.notChangedMode =
        lastVisitedMode == null
            ? true
            : this.selectedDisplayMode.toString().equals(lastVisitedMode.trim());

    // setNumberOfUpdatedActivities(getActivigetActivitiesUpdatedNumtiesUpdatedNum(notChangedMode));
    setNumberOfUpdatedActivities(0);

    //
    activitiesLoader.init();
  }
Ejemplo n.º 19
0
 /**
  * Checks need to refresh relationship list or not.
  *
  * @return
  */
 protected boolean isNewOwner() {
   Identity current = Utils.getOwnerIdentity();
   if (this.lastOwner == null || current == null) return false;
   return !this.lastOwner.getRemoteId().equals(current.getRemoteId());
 }
Ejemplo n.º 20
0
  private int getActivitiesUpdatedNum(boolean hasRefresh) {
    if (this.postActivity) {
      resetCookies();
      this.postActivity = false;

      return 0;
    }

    //
    UIActivitiesLoader activitiesLoader = getChild(UIActivitiesLoader.class);
    ActivitiesRealtimeListAccess activitiesListAccess =
        (ActivitiesRealtimeListAccess) activitiesLoader.getActivityListAccess();

    String mode = DisplayMode.ALL_ACTIVITIES.toString();
    ActivityFilterType.ACTIVITY_FEED
        .oldFromSinceTime(Utils.getLastVisited(Utils.OLD_FROM, mode))
        .fromSinceTime(Utils.getLastVisited(Utils.FROM, mode))
        .toSinceTime(Utils.getLastVisited(Utils.TO, mode))
        .lastNumberOfUpdated(getLastUpdatedNum(mode));

    //
    mode = DisplayMode.CONNECTIONS.toString();
    ActivityFilterType.CONNECTIONS_ACTIVITIES
        .oldFromSinceTime(Utils.getLastVisited(Utils.OLD_FROM, mode))
        .fromSinceTime(Utils.getLastVisited(Utils.FROM, mode))
        .toSinceTime(Utils.getLastVisited(Utils.TO, mode))
        .lastNumberOfUpdated(getLastUpdatedNum(mode));

    //
    mode = DisplayMode.MY_ACTIVITIES.toString();
    ActivityFilterType.USER_ACTIVITIES
        .oldFromSinceTime(Utils.getLastVisited(Utils.OLD_FROM, mode))
        .fromSinceTime(Utils.getLastVisited(Utils.FROM, mode))
        .toSinceTime(Utils.getLastVisited(Utils.TO, mode))
        .lastNumberOfUpdated(getLastUpdatedNum(mode));

    //
    mode = DisplayMode.MY_SPACE.toString();
    ActivityFilterType.USER_SPACE_ACTIVITIES
        .oldFromSinceTime(Utils.getLastVisited(Utils.OLD_FROM, mode))
        .fromSinceTime(Utils.getLastVisited(Utils.FROM, mode))
        .toSinceTime(Utils.getLastVisited(Utils.TO, mode))
        .lastNumberOfUpdated(getLastUpdatedNum(mode));

    ActivityUpdateFilter updatedFilter = new ActivityUpdateFilter(hasRefresh);

    int gotNumber = activitiesListAccess.getNumberOfUpdated(updatedFilter);

    //
    if (gotNumber == 0 && hasRefresh) {
      // only in case lastUpdatedNumber > 0 then reset cookies
      long lastNumber = getLastUpdatedNum(selectedDisplayMode.toString());
      if (lastNumber > 0) {
        resetCookies();
      }
    }

    return gotNumber;
  }
Ejemplo n.º 21
0
    public void execute(Event<UISpaceInfo> event) throws Exception {
      UISpaceInfo uiSpaceInfo = event.getSource();
      SpaceService spaceService = uiSpaceInfo.getSpaceService();
      UIPortal uiPortal = Util.getUIPortal();

      String id = uiSpaceInfo.getUIStringInput(SPACE_ID).getValue();
      String name = uiSpaceInfo.getUIStringInput(SPACE_DISPLAY_NAME).getValue();
      Space space = spaceService.getSpaceById(id);
      String oldDisplayName = space.getDisplayName();
      String existingDescription = space.getDescription();

      if (space == null) {
        // redirect to spaces
        event.getRequestContext().sendRedirect(Utils.getURI("all-spaces"));
        return;
      }

      UserNode selectedNode = uiPortal.getSelectedUserNode();
      UserNode renamedNode = null;

      boolean nameChanged = (!space.getDisplayName().equals(name));
      UIPortletApplication uiApp = uiSpaceInfo.getAncestorOfType(UIPortletApplication.class);
      if (nameChanged) {

        String cleanedString = SpaceUtils.cleanString(name);
        if (spaceService.getSpaceByUrl(cleanedString) != null) {
          // reset to origin values
          uiSpaceInfo.getUIStringInput(SPACE_DISPLAY_NAME).setValue(oldDisplayName);
          uiSpaceInfo.getUIFormTextAreaInput(SPACE_DESCRIPTION).setValue(existingDescription);

          //
          uiApp.addMessage(
              new ApplicationMessage(
                  "UISpaceInfo.msg.current-name-exist", null, ApplicationMessage.INFO));
          return;
        }

        renamedNode = uiSpaceInfo.renamePageNode(name, space);
        if (renamedNode == null) {
          return;
        }
      }
      uiSpaceInfo.invokeSetBindingBean(space);

      String spaceDescription = space.getDescription();
      if (spaceDescription == null || spaceDescription.trim().length() == 0) {
        ResourceBundle resourceBundle = event.getRequestContext().getApplicationResourceBundle();
        space.setDescription(resourceBundle.getString(MSG_DEFAULT_SPACE_DESCRIPTION));
        uiSpaceInfo.getUIFormTextAreaInput(SPACE_DESCRIPTION).setValue(space.getDescription());
      } else {
        space.setDescription(StringEscapeUtils.escapeHtml(space.getDescription()));
        if (!existingDescription.equals(spaceDescription)) {
          space.setField(UpdatedField.DESCRIPTION);
        }
      }

      space.setEditor(Utils.getViewerRemoteId());

      if (nameChanged) {
        space.setDisplayName(oldDisplayName);
        String remoteId = Utils.getViewerRemoteId();
        spaceService.renameSpace(remoteId, space, name);

        // rename group label
        OrganizationService organizationService =
            (OrganizationService)
                ExoContainerContext.getCurrentContainer()
                    .getComponentInstanceOfType(OrganizationService.class);
        GroupHandler groupHandler = organizationService.getGroupHandler();
        Group group = groupHandler.findGroupById(space.getGroupId());
        group.setLabel(space.getDisplayName());
        groupHandler.saveGroup(group, true);
      } else {
        spaceService.updateSpace(space);
      }

      if (nameChanged) {
        if (renamedNode != null) {
          // update space navigation (change name).
          selectedNode = renamedNode;
          PortalRequestContext prContext = Util.getPortalRequestContext();
          prContext.createURL(NodeURL.TYPE).setNode(selectedNode);
          event.getRequestContext().sendRedirect(Utils.getSpaceURL(selectedNode));
          return;
        }
      } else {
        uiApp.addMessage(
            new ApplicationMessage(
                "UISpaceInfo.msg.update-success", null, ApplicationMessage.INFO));
      }
    }
Ejemplo n.º 22
0
 private void setLastUpdatedNum(String mode, String value) {
   String cookieKey =
       String.format(Utils.LAST_UPDATED_ACTIVITIES_NUM, mode, Utils.getViewerRemoteId());
   Utils.setCookies(cookieKey, value);
 }
Ejemplo n.º 23
0
 public String getCookiesKey(String displayMode) {
   return String.format(
       ACTIVITY_STREAM_VISITED_PREFIX_COOKIED, displayMode, Utils.getViewerRemoteId());
 }
Ejemplo n.º 24
0
 /**
  * gets space, space identified by the url.
  *
  * @return space
  * @throws SpaceException
  */
 public Space getSpace() throws SpaceException {
   String spaceUrl = Utils.getSpaceUrlByContext();
   SpaceService spaceService = getApplicationComponent(SpaceService.class);
   return spaceService.getSpaceByUrl(spaceUrl);
 }