Package org.apache.jetspeed.spaces

Examples of org.apache.jetspeed.spaces.Space


    else
    {
      spaceName = request.getParameter("delete");
      if (spaceName != null)
      {
        Space space = spacesService.lookupSpace(spaceName);
       
        if (space != null)
        {
          try
          {
View Full Code Here


    @SuppressWarnings("unchecked")
    public void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException
    {
      Space space = null;
      SpaceBean spaceBean = null;
        String current = (String)PortletMessaging.receive(request, SpacesManager.MSG_TOPIC_SPACE_LIST, SpacesManager.MSG_SPACE_CHANGE);               
        if (current != null)
        {
            // FIXME: lookupSpace() can find system spaces only, not user space.
View Full Code Here

       
        if (isCanceled)
        {
            try
            {
                Space space = null;
               
                if (!"".equals(name))
                {
                    space = spacesService.lookupSpace(name);
                   
                    if (space == null)
                    {
                        space = spacesService.lookupUserSpace(name);
                    }
                }
               
                String path = admin.getPortalURL(actionRequest, actionResponse, (space != null ? space.getPath() : "/"));
                actionResponse.sendRedirect(path);
                return;
            }
            catch (Exception e)
            {
                log.error("Failed to retrieve space.", e);
            }
        }
       
        if ("".equals(name))
        {
            return;
        }
       
        try
        {
            if (isNew)
          {
            // TODO: better validation
            String spaceName = name.replace(' ', '_');               
                String templateFolderPath = actionRequest.getPreferences().getValue(SPACE_TEMPLATE, DEFAULT_SPACE_TEMPLATE);              
                if (!pageManager.folderExists(templateFolderPath))
                {
                    throw new PortletException("Space template folder does not exist: " + templateFolderPath);
                }
               
                Folder templateFolder = pageManager.getFolder(templateFolderPath);
                String owner = actionRequest.getUserPrincipal().getName();
                try
                {
                    userManager.getUser(owner);
                }
                catch (SecurityException notFoundEx)
                {
                    throw new PortletException("Space owner is not found: " + owner);
                }
               
                Space space = spacesService.createSpace(spaceName, owner, templateFolder, title, title, description, theme, constraint);
                // redirect
                String path = admin.getPortalURL(actionRequest, actionResponse, space.getPath());
                actionResponse.sendRedirect(path);
          }
          else
          {
                String owner = scrapeParameter(actionRequest, "spaceOwner");
                // FIXME: lookupSpace() can find system spaces only, not user space.
                //        So, what if a system space name is as same as a user space name?
                Space space = spacesService.lookupSpace(name);
               
                if (space == null)
                {
                    space = spacesService.lookupUserSpace(name);
                }
               
                if (space != null)
                {
                space.setDescription(description);
                space.setTitle(title);
                space.setShortTitle(title);
                  space.setTheme(theme);
                 
                  if (constraint.equals(""))
                  {
                    String old = space.getSecurityConstraint();
                    if (old != null)
                    {
                      if (!"".equals(old))
                        space.setSecurityConstraint(constraint);                       
                    }
                     
                  }
                  else
                  {
                    space.setSecurityConstraint(constraint);
                  }
                 
                  if (owner != null && !owner.equals(space.getOwner()))
                  {
                        try
                        {
                            userManager.getUser(owner);
                        }
                        catch (SecurityException notFoundEx)
                        {
                            throw new PortletException("Space owner is not found: " + owner);
                        }
                        space.setOwner(owner);
                  }
                 
                  spacesService.storeSpace(space);
                }
               
                // redirect
                String path = admin.getPortalURL(actionRequest, actionResponse, space.getPath());
                actionResponse.sendRedirect(path);
          }
           
            PortletMessaging.publish(actionRequest, SpacesManager.MSG_TOPIC_SPACE_LIST, SpacesManager.MSG_SPACE_CHANGE, name);               
            PortletMessaging.publish(actionRequest, SpacesManager.MSG_TOPIC_SPACE_NAV, SpacesManager.MSG_SPACE_CHANGE, name);
View Full Code Here

   
    @Override
    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
    {
        String navAction = actionRequest.getParameter("navAction");
        Space space = null;
        String spaceName = actionRequest.getParameter(SpaceNavigator.ATTRIBUTE_SPACE);
        if (spaceName != null)
        {
            space = getSpaceFromName(spaceName, actionRequest);
        }
       
        if ("addSpace".equals(navAction))
        {
            // TODO: make this link configurable. We need JetspeedLinks like in Jetspeed-1
            PortletMessaging.cancel(actionRequest, SpacesManager.MSG_TOPIC_SPACE_LIST, SpacesManager.MSG_SPACE_CHANGE);
            String spaceEditPath = actionRequest.getPreferences().getValue(SPACE_EDIT_PATH_PREF, SPACE_EDIT_PATH_DEFAULT);                          
            String path = admin.getPortalURL(actionRequest, actionResponse, spaceEditPath);
            actionResponse.sendRedirect(path);
            return;
        }
        else if ("editSpace".equals(navAction) && space != null)
        {
            if (space != null)
            {
                PortletMessaging.publish(actionRequest, SpacesManager.MSG_TOPIC_SPACE_LIST, SpacesManager.MSG_SPACE_CHANGE, spaceName);
                String spaceEditPath = actionRequest.getPreferences().getValue(SPACE_EDIT_PATH_PREF, SPACE_EDIT_PATH_DEFAULT);                          
                String path = admin.getPortalURL(actionRequest, actionResponse, spaceEditPath);
                actionResponse.sendRedirect(path);
                return;
            }
        }
        else if (space != null)
        {
            if (space != null)
            {
                String path = admin.getPortalURL(actionRequest, actionResponse, space.getPath());
                actionRequest.getPortletSession().setAttribute(SpaceNavigator.ATTRIBUTE_SPACE, new SpaceBean(space));    
                PortletMessaging.publish(actionRequest, SpacesManager.MSG_TOPIC_PAGE_NAV, SpacesManager.MSG_SPACE_CHANGE, spaceName);
                actionResponse.sendRedirect(path);
                return;
            }
View Full Code Here

    protected Space getSpaceFromName(String spaceName, PortletRequest request)
    {
        List<Space> spaces = spacesService.listSpaces();
        if (request.getUserPrincipal() != null)
        {
            Space home = spacesService.lookupUserSpace(request.getUserPrincipal().getName());
          if (home != null)
          {
            if (home.getName().equals(spaceName)) // FIXME: name unique
              return home;
          }
        }
        Space space = null;
        for (Space sp: spaces)
        {
            if (sp.getName().equals(spaceName))
            {
                space = sp;
View Full Code Here

            spaces = createSpaceBeanList(spacesService, userName, null);
           
            if (request.getUserPrincipal() != null)
            {
              String username = request.getUserPrincipal().getName();
              Space home = spacesService.lookupUserSpace(username);
             
              if (home != null)
              {
                if (home.getOwner() == null)
                {
                  try
                  {
                    home.setOwner(username);
                    spacesService.storeSpace(home);
                  }
                  catch (SpacesException e)
                  {
                    throw new PortletException(e);
                  }
                }
               
                SpaceBean userHome = new SpaceBean(home);
                userHome.setDescription(home.getDescription());
                userHome.setTitle(home.getTitle());
                userHome.setUserHomePath(home.getPath());
                userHome.setUserHomeName(home.getName());
                  spaces.add(userHome);                   
              }
            }
           
            request.getPortletSession().setAttribute(SpaceNavigator.ATTRIBUTE_SPACES, spaces, PortletSession.APPLICATION_SCOPE);       
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.spaces.Space

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.