Examples of ExpandoColumn


Examples of com.liferay.portlet.expando.model.ExpandoColumn

    catch (NoSuchTableException e) {
      expandoTable = ExpandoTableLocalServiceUtil.addDefaultTable(companyId, modelClassName);
      logger.debug("Added expando table for modelClassName=[{0}]", modelClassName);
    }

    ExpandoColumn expandoColumn = null;

    expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), expandoColumnName);

    if (expandoColumn != null) {
      logger.debug("Expando column=[{0}] exists for modelClassName=[{1}]", expandoColumnName, modelClassName);
    }
    else {
      expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), expandoColumnName,
          expandoColumnType);
      logger.debug("Added expando column=[{0}] to modelClassName=[{1}]", expandoColumnName, modelClassName);
    }

    if (indexable) {
      UnicodeProperties properties;
      properties = new UnicodeProperties();
      properties.setProperty(ExpandoColumnConstants.INDEX_TYPE,
        String.valueOf(ExpandoColumnConstants.INDEX_TYPE_TEXT));
      expandoColumn.setTypeSettingsProperties(properties);
      ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn);
    }

    if (expandoColumn != null) {

      // Add permissions to the column so that all users can VIEW and UPDATE.
      Role userRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER);
      String resourceId = ExpandoColumn.class.getName();
      String primKey = String.valueOf(expandoColumn.getColumnId());
      String[] actionKeys = new String[] { ActionKeys.VIEW, ActionKeys.UPDATE };
      PermissionUtil.grantPermissions(companyId, userRole.getRoleId(), resourceId,
        ResourceConstants.SCOPE_INDIVIDUAL, primKey, actionKeys);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.