Details
Description
Wouldn't it be possible to extract the getting viewId logic from MainPortlet.render method to separate protected method To be more precisely, this code:
// Get the inital view that is configured in the portlet.xml file
PortletMode portletMode = renderRequest.getPortletMode();
String viewId = null;
if (portletMode == PortletMode.VIEW) {
viewId = portletConfig.getInitParameter(Constants.VIEW_KEY);
if (viewId == null) {
if (log.isErrorEnabled()) {
log.error(Constants.VIEW_KEY + " is not properly configured");
}
throw new PortletException(Constants.VIEW_KEY + " is not properly configured");
}
} else if (portletMode == PortletMode.EDIT) {
viewId = portletConfig.getInitParameter(Constants.EDIT_KEY);
if (viewId == null) {
if (log.isErrorEnabled()) {
log.error(Constants.EDIT_KEY + " is not properly configured");
}
throw new PortletException(Constants.EDIT_KEY + " is not properly configured");
}
} else if (portletMode == PortletMode.HELP) {
viewId = portletConfig.getInitParameter(Constants.HELP_KEY);
if (viewId == null) {
if (log.isErrorEnabled()) {
log.error(Constants.HELP_KEY + " is not properly configured");
}
throw new PortletException(Constants.HELP_KEY + " is not properly configured");
}
}
It would be useful to have an ability to override this logic in the subclasses. Personally, I'd like to add an ability to show some view based on request parameters.
// Get the inital view that is configured in the portlet.xml file
PortletMode portletMode = renderRequest.getPortletMode();
String viewId = null;
if (portletMode == PortletMode.VIEW) {
viewId = portletConfig.getInitParameter(Constants.VIEW_KEY);
if (viewId == null) {
if (log.isErrorEnabled()) {
log.error(Constants.VIEW_KEY + " is not properly configured");
}
throw new PortletException(Constants.VIEW_KEY + " is not properly configured");
}
} else if (portletMode == PortletMode.EDIT) {
viewId = portletConfig.getInitParameter(Constants.EDIT_KEY);
if (viewId == null) {
if (log.isErrorEnabled()) {
log.error(Constants.EDIT_KEY + " is not properly configured");
}
throw new PortletException(Constants.EDIT_KEY + " is not properly configured");
}
} else if (portletMode == PortletMode.HELP) {
viewId = portletConfig.getInitParameter(Constants.HELP_KEY);
if (viewId == null) {
if (log.isErrorEnabled()) {
log.error(Constants.HELP_KEY + " is not properly configured");
}
throw new PortletException(Constants.HELP_KEY + " is not properly configured");
}
}
It would be useful to have an ability to override this logic in the subclasses. Personally, I'd like to add an ability to show some view based on request parameters.
Activity
Vadim Lotarev
created issue -
Deryk Sinotte
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Deryk Sinotte [ deryk.sinotte ] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #15082 | Fri Nov 02 11:04:18 MDT 2007 | deryk.sinotte | |
Files Changed | ||||
MODIFY
/icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/portlet/MainPortlet.java
|
Deryk Sinotte
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Fix Version/s | 1.7DR#3 [ 10112 ] | |
Resolution | Fixed [ 1 ] |
Ken Fyten
made changes -
Fix Version/s | 1.7 [ 10080 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
Assignee | Deryk Sinotte [ deryk.sinotte ] |
MainPortlet now extends GenericPortlet and the internal logic has been organized to make it easier to subclass. Resolving as fixed.