Hi Karoly,
Following code will help you.
Layout lay = null;
long userId = USER.getUserId();
String friendlyURL = "/myNewPage";
long groupId = GroupLocalServiceUtil.getGroup(COMPANY.getCompanyId(), GroupConstants.GUEST).getGroupId();
boolean privateLayout = false;
long parentLayoutId = 0;
String name = "myNewPage";
String title = null;
String description = null;
String type = LayoutConstants.TYPE_PORTLET;
boolean hidden = false;
ServiceContext serviceContext = new ServiceContext();
lay = LayoutLocalServiceUtil.addLayout(userId,groupId,privateLayout,parentLayoutId,name,title,description,type,hidden,friendlyURL,serviceContext);
lay.setTypeSettings(ONE_COLUMN);
LayoutLocalServiceUtil.updateLayout(lay);
Portlet portlet = PortletLocalServiceUtil.getPortletById("PORTLET_ID");
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)lay.getLayoutType();
String id = layoutTypePortlet.addPortletId(USER.getUserId(),portlet.getPortletId(),"column-1",-2);
lay = LayoutLocalServiceUtil.updateLayout(lay.getGroupId(), lay.isPrivateLayout(),lay.getLayoutId(), lay.getTypeSettings());
PortletPreferences portletSetup = PortletPreferencesLocalServiceUtil.addPortletPreferences(COMPANY.getCompanyId(), 0, 3, lay.getPlid(), id, portlet, "<portlet-preferences />");
Please sign in to flag this as inappropriate.