1 19 20 package za.org.coefficient.modules.project; 21 22 import org.apache.commons.lang.StringUtils; 23 24 import za.org.coefficient.core.Project; 25 import za.org.coefficient.interfaces.CoefficientContext; 26 import za.org.coefficient.modules.BaseModule; 27 import za.org.coefficient.util.common.HibernatePager; 28 import za.org.coefficient.util.ejb.VelocityScreenUtil; 29 30 import java.util.HashMap ; 31 32 46 public class MostActiveProjects extends BaseModule { 47 49 public String getMainMethod() { 50 return "view"; 51 } 52 53 public String getModuleDescription() { 54 return "Shows the most active projects"; 55 } 56 57 public String getModuleDisplayName() { 58 return "Most Active " 59 + StringUtils.capitalise(ProjectConstants.PROJECT_NAME) + "s"; 60 } 61 62 public CoefficientContext view(CoefficientContext ctx) throws Exception { 63 HashMap searchParams = new HashMap (); 64 searchParams.put("active", new Boolean (true)); 65 HibernatePager hp = 66 new HibernatePager(Project.class, "statistics.currentData.rank", 10, 67 searchParams, false); 68 HashMap map = new HashMap (); 69 map.put("pager", hp); 70 map.put("project_name", ProjectConstants.PROJECT_NAME); 71 map.put("mod", "MostActiveProjects"); 72 if(ctx.getCurrentUser() != null) { 73 map.put("loggedIn", new Boolean (true)); 74 } 75 StringBuffer sb = 76 VelocityScreenUtil.getProcessedScreen("view-projects.vm", map); 77 78 ctx.setModuleContent(sb.toString(), getModuleDisplayName()); 80 return ctx; 81 } 82 } 83 | Popular Tags |