use of com.liferay.portlet.expando.model.ExpandoTable in project liferay-ide by liferay.
the class UpgradeExpandoTable method updateExpandoTable.
protected void updateExpandoTable(long companyId) throws Exception {
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getTable(companyId, Subscription.class.getName(), "KB");
} catch (NoSuchTableException nste) {
return;
}
ExpandoTableLocalServiceUtil.deleteExpandoTable(expandoTable);
}
use of com.liferay.portlet.expando.model.ExpandoTable in project liferay-ide by liferay.
the class LiferayAppDataService method getExpandoColumn.
protected ExpandoColumn getExpandoColumn(long companyId, String columnName) throws Exception {
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getTable(companyId, User.class.getName(), ShindigUtil.getTableOpenSocial());
} catch (NoSuchTableException nste) {
_log.error(nste, nste);
}
ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), columnName);
if (expandoColumn == null) {
expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), columnName, ExpandoColumnConstants.STRING);
}
return expandoColumn;
}
use of com.liferay.portlet.expando.model.ExpandoTable in project liferay-ide by liferay.
the class BaseGadgetPortlet method checkExpando.
protected void checkExpando(RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
ExpandoTable expandoTable = ExpandoTableLocalServiceUtil.getTable(themeDisplay.getCompanyId(), Layout.class.getName(), ShindigUtil.getTableOpenSocial());
String namespace = renderResponse.getNamespace();
String columnName = ShindigUtil.getColumnUserPrefs(namespace, themeDisplay);
ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), columnName);
if (expandoColumn == null) {
expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), columnName, ExpandoColumnConstants.STRING);
Map<Long, String[]> roleIdsToActionIds = new HashMap<Long, String[]>();
Role guestRole = RoleLocalServiceUtil.getRole(expandoColumn.getCompanyId(), RoleConstants.GUEST);
roleIdsToActionIds.put(guestRole.getRoleId(), new String[] { ActionKeys.VIEW });
Role userRole = RoleLocalServiceUtil.getRole(expandoColumn.getCompanyId(), RoleConstants.USER);
roleIdsToActionIds.put(userRole.getRoleId(), new String[] { ActionKeys.UPDATE, ActionKeys.VIEW });
ResourcePermissionLocalServiceUtil.setResourcePermissions(expandoColumn.getCompanyId(), ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleIdsToActionIds);
}
}
Aggregations