⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spaceaction.java

📁 在线读书交流平台
💻 JAVA
字号:
package com.olr.control.space;

import java.util.List;

import org.apache.log4j.Logger;

import com.olr.BO.SpaceBO;
import com.olr.beans.Book;
import com.olr.beans.Message;
import com.olr.beans.User;
import com.olr.control.common.BaseAction;



public  class SpaceAction extends BaseAction{

	private SpaceBO spaceBO;
    private String spaceOwnerName;
    private String power;
	private User spaceOwner;
	private String username;
	private List<Message> messagesList;
	private List<Book> worksList;
	private List<Book> bookshelfList;
	
	
	Logger log = Logger.getLogger(this.getClass());
	//初始化用户空间,获取用户相关信息填充用户空间页面
	public  String execute(){
		this.setNull();
		 username=this.getLoginUsername();
		
	    //spaceOwner=(User)this.getSession("spaceOwner");
	    if(username==null||this.isTimeout()){//用户是否已经登录否则要求用户登录
		    log.error(username+"  用户跳转空间失败");
			return INPUT;
		}else{//用户已登录
			power=this.getLoginUserPower();
		    spaceOwnerName=username;		
		    spaceOwner=this.spaceBO.getUser(spaceOwnerName);	
		        initSpace();							
				log.info(username+"进入"+spaceOwnerName+"的空间");
				return SUCCESS;
			}
			
	}	
			

	public void setNull(){
		  spaceOwner=null;
		  messagesList= null;
		  worksList=null;
		  bookshelfList=null;
	}
	
   public void initSpace(){
	   
	  // spaceOwnerName=spaceOwner.getUsername();
	   this.setSession("spaceOwnerName", spaceOwnerName);
	   //this.setSession("spaceOwner", spaceOwner);
	   messagesList= this.getSpaceBO().getTopMessages(spaceOwner.getUserId(), 3);
	   worksList=this.getSpaceBO().getTopWorks(spaceOwner.getUserId(), 3);
	   bookshelfList=this.getSpaceBO().getTopBookshelf(spaceOwner.getUserId(), 5);
	   
   }
	

	public SpaceBO getSpaceBO() {
		return spaceBO;
	}

	public void setSpaceBO(SpaceBO spaceBO) {
		this.spaceBO = spaceBO;
	}

	public User getSpaceOwner() {
		return spaceOwner;
	}

	public void setSpaceOwner(User spaceOwner) {
		this.spaceOwner = spaceOwner;
	}

	public String getSpaceOwnerName() {
		return spaceOwnerName;
	}

	public void setSpaceOwnerName(String spaceOwnerName) {
		this.spaceOwnerName = spaceOwnerName;
	}

	public List<Message> getMessagesList() {
		return messagesList;
	}

	public void setMessagesList(List<Message> messageList) {
		this.messagesList = messageList;
	}



	public List<Book> getWorksList() {
		return worksList;
	}



	public void setWorksList(List<Book> worksList) {
		this.worksList = worksList;
	}



	public List<Book> getBookshelfList() {
		return bookshelfList;
	}



	public void setBookshelfList(List<Book> bookshelfList) {
		this.bookshelfList = bookshelfList;
	}



	public String getPower() {
		return power;
	}



	public void setPower(String power) {
		this.power = power;
	}


	public String getUsername() {
		return username;
	}


	public void setUsername(String username) {
		this.username = username;
	}



	
	
	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -