TMLUserProfile profile = this.getmaincontext().getprofile();
if (profile == null) {
return null;
}
WGPortletRegistry portletRegistry = profile.getprofile().getPortletRegistry();
if (portletRegistry == null) {
return null;
}
WGPortlet portlet;
if (nameSpace != null) {
portlet = portletRegistry.getPortlet(getmaincontext().db().getDbReference(), nameSpace);
}
else {
portlet = portletRegistry.getRootPortlet(getmaincontext().db().getDbReference());
}
if (portlet != null) {
return new TMLPortlet(_designContext.getTag(), profile, portlet);
}