GWTJahiaPortletDefinition gwtJahiaPortletDefinition = createJahiaGWTPortletDefinitionByName(appName, entryPointName, currentUserSession.getLocale(), currentUserSession.getUser(), currentUserSession.getWorkspace().getName());
if (gwtJahiaPortletDefinition == null) {
logger.error("[" + appName + "," + entryPointName + "]" + " portlet defintion not found --> Aboard creating portlet instance");
}
GWTJahiaNewPortletInstance gwtJahiaNewPortletInstance = new GWTJahiaNewPortletInstance();
gwtJahiaNewPortletInstance.setGwtJahiaPortletDefinition(gwtJahiaPortletDefinition);
// add url property
gwtJahiaNewPortletInstance.getProperties().addAll(gwtJahiaNodeProperties);
gwtJahiaNewPortletInstance.getProperties().add(new GWTJahiaNodeProperty("j:expirationTime", new GWTJahiaNodePropertyValue("0", GWTJahiaNodePropertyType.LONG)));
GWTJahiaNodeACL acl = gwtJahiaPortletDefinition.getBaseAcl();
// all modes for users of the current site
GWTJahiaNodeACL modes = gwtJahiaNewPortletInstance.getModes();
if (modes == null) {
modes = new GWTJahiaNodeACL();
}
List<GWTJahiaNodeACE> modeAces = modes.getAce();
if (modeAces == null) {
modeAces = new ArrayList<GWTJahiaNodeACE>();
}
if (acl != null && acl.getAvailablePermissions() != null) {
List<String> modesPermissions = acl.getAvailablePermissions().get(JCRClientUtils.PORTLET_MODES_ROLES);
modeAces.add(this.acl.createUsersGroupACE(modesPermissions, true, site));
}
modes.setAce(modeAces);
gwtJahiaNewPortletInstance.setModes(modes);
// all rodes for users of the current site
GWTJahiaNodeACL roles = gwtJahiaNewPortletInstance.getRoles();
if (roles == null) {
roles = new GWTJahiaNodeACL();
}
List<GWTJahiaNodeACE> roleAces = roles.getAce();
if (roleAces == null) {
roleAces = new ArrayList<GWTJahiaNodeACE>();
}
if (acl != null && acl.getAvailablePermissions() != null) {
List<String> rolesPermissions = acl.getAvailablePermissions().get(JCRClientUtils.PORTLET_ROLES);
roleAces.add(this.acl.createUsersGroupACE(rolesPermissions, true, site));
}
roles.setAce(roleAces);
gwtJahiaNewPortletInstance.setRoles(roles);
// set name
gwtJahiaNewPortletInstance.setInstanceName(instanceName);
return createPortletInstance(parentPath, gwtJahiaNewPortletInstance, currentUserSession);
} catch (GWTJahiaServiceException e) {
throw e;
} catch (Exception e) {
logger.error("Unable to create an RSS portlet due to: ", e);