JSONObject layoutTemplateJSONObject = jsonObject.getJSONObject(
"layoutTemplate");
String name = getName(layoutTemplateJSONObject.getString("name"));
LayoutPrototype layoutPrototype = getLayoutPrototype(companyId, name);
if (layoutPrototype != null) {
if (!developerModeEnabled) {
if (_log.isInfoEnabled()) {
_log.info(
"Layout prototype with name " + name +
" already exists for company " + companyId);
}
return;
}
LayoutPrototypeLocalServiceUtil.deleteLayoutPrototype(
layoutPrototype);
}
layoutPrototype =
LayoutPrototypeLocalServiceUtil.addLayoutPrototype(
userId, companyId, getMap(name), name, true, serviceContext);
JSONArray columnsJSONArray = layoutTemplateJSONObject.getJSONArray(
"columns");
Layout layout = layoutPrototype.getLayout();
addLayoutColumns(
layout, LayoutTypePortletConstants.COLUMN_PREFIX, columnsJSONArray);
LayoutLocalServiceUtil.updateLayout(