Commit 2c8b4746 authored by Elias Englmeier's avatar Elias Englmeier
Browse files

fixed a bug in mapmodule

parent b04bb521
package MapModule.portlet;
import java.io.IOException;
import java.util.ArrayList;
import javax.portlet.Portlet;
import javax.portlet.PortletException;
......@@ -19,6 +20,7 @@ import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.WebKeys;
import MapModule.constants.MapModulePortletKeys;
import ideaService.model.Ideas;
import ideaService.service.IdeasLocalServiceUtil;
import projectService.service.ProjectLocalServiceUtil;
......@@ -44,9 +46,10 @@ public class MapModulePortlet extends MVCPortlet {
@Override
public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException{
ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
long projectId = ProjectLocalServiceUtil.getProjectByLayoutIdRef(themeDisplay.getLayout().getPrimaryKey()).getPrimaryKey();
String result = null;
User user;
if(ProjectLocalServiceUtil.getProjectByLayoutIdRef(themeDisplay.getLayout().getPrimaryKey()) != null){
long projectId = ProjectLocalServiceUtil.getProjectByLayoutIdRef(themeDisplay.getLayout().getPrimaryKey()).getPrimaryKey();
try {
user = PortalUtil.getUser(renderRequest);
for(Role role : user.getRoles()){
......@@ -67,6 +70,23 @@ public class MapModulePortlet extends MVCPortlet {
}
renderRequest.setAttribute("allIdeas", result);
}
else{
ArrayList<Ideas> tmp = new ArrayList<Ideas>();
Ideas i = IdeasLocalServiceUtil.getIdeasByLayoutIdRef(themeDisplay.getLayout().getPrimaryKey());
tmp.add(i);
renderRequest.setAttribute("allIdeas",
JSONFactoryUtil.looseSerializeDeep(tmp));
}
// if(ProjectLocalServiceUtil.getProjectByLayoutIdRef(themeDisplay.getLayout().getPrimaryKey()) != null){
// renderRequest.setAttribute("allIdeas",
// JSONFactoryUtil.looseSerializeDeep(IdeasLocalServiceUtil.getAllIdeasForProject
// (ProjectLocalServiceUtil.getProjectByLayoutIdRef(themeDisplay.getLayout().getPrimaryKey()).getPrimaryKey())));
// }
super.render(renderRequest, renderResponse);
}
......
......@@ -96,7 +96,6 @@ public class IdeasLocalServiceImpl extends IdeasLocalServiceBaseImpl {
try {
Ideas i = IdeasUtil.findByPrimaryKey(ideasId);
i.setReviewStatus(status.getReviewStatusDescription());
if(status.equals(ReviewStatus.ACCEPTED)){
//Makes the layout visible to everyone.
Layout layout = LayoutLocalServiceUtil.getLayout(i.getLayoutRef());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment