Expando 是liferay的一种自定义表格扩展的方式,从5.0就已存在 , 可以在运行时新建表格\字段\行\值.

这是一种Service Builder之外的轻量级替代扩展方式,不必像Service Builder那么繁琐,

实现的具体技术实际上是列转行,其中ExpandoValue有点像Activiti的act_ru_variable

主要有4种接口,分别是表\行\列\值

  • ExpandoTableLocalServiceUtil
  • ExpandoRowLocalServiceUtil
  • ExpandoColumnLocalServiceUtil
  • ExpandoValueLocalServiceUtil

Demo

    long classNameId = ClassNameLocalServiceUtil.getClassNameId(User.class.getName());
//新建表NewTable1
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
WebKeys.THEME_DISPLAY);
ExpandoTableLocalServiceUtil.addTable(themeDisplay.getCompanyId(),classNameId, "NewTable1"); //新建行
User user = themeDisplay.getUser();
ExpandoTable expandoTable = ExpandoTableLocalServiceUtil.getTable(themeDisplay.getCompanyId(), classNameId, "NewTable1");
ExpandoRowLocalServiceUtil.addRow(expandoTable.getTableId(), user.getUserId()); //增加一个字段
ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), "MyUserColumn", ExpandoColumnConstants.STRING); //新建值
ExpandoValueLocalServiceUtil.addValue(classNameId, expandoTable.getTableId(),expandoColumn.getColumnId(), user.getUserId(), "MyUserColumnDataValue123...");

其中的classPK就是控制唯一主键的值(  在程序中是user.getUserId() ).

需要注意的是每次添加值之前必须先添加行

注意在新建行addRow操作时,如果插入重复的键值就会触发异常

ExpandoValueLocalServiceUtil代码:

/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/ package com.liferay.expando.kernel.service; import aQute.bnd.annotation.ProviderType; import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
import com.liferay.portal.kernel.util.ReferenceRegistry; /**
* Provides the local service utility for ExpandoValue. This utility wraps
* {@link com.liferay.portlet.expando.service.impl.ExpandoValueLocalServiceImpl} and is the
* primary access point for service operations in application layer code running
* on the local server. Methods of this service will not have security checks
* based on the propagated JAAS credentials because this service can only be
* accessed from within the same VM.
*
* @author Brian Wing Shun Chan
* @see ExpandoValueLocalService
* @see com.liferay.portlet.expando.service.base.ExpandoValueLocalServiceBaseImpl
* @see com.liferay.portlet.expando.service.impl.ExpandoValueLocalServiceImpl
* @generated
*/
@ProviderType
public class ExpandoValueLocalServiceUtil {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify this class directly. Add custom service methods to {@link com.liferay.portlet.expando.service.impl.ExpandoValueLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
*/ /**
* Adds the expando value to the database. Also notifies the appropriate model listeners.
*
* @param expandoValue the expando value
* @return the expando value that was added
*/
public static com.liferay.expando.kernel.model.ExpandoValue addExpandoValue(
com.liferay.expando.kernel.model.ExpandoValue expandoValue) {
return getService().addExpandoValue(expandoValue);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long classNameId, long tableId, long columnId, long classPK,
java.lang.String data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(classNameId, tableId, columnId, classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, float data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, boolean data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.lang.Number data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.lang.Object data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, int data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.lang.Number[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, double[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, long data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, short data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, int[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.util.Date data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, short[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, long[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.util.Date[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, float[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, double data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.lang.String[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.lang.String data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, boolean[] data)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, data);
} public static com.liferay.expando.kernel.model.ExpandoValue addValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK,
java.util.Map<java.util.Locale, ?> dataMap,
java.util.Locale defautlLocale)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.addValue(companyId, className, tableName, columnName,
classPK, dataMap, defautlLocale);
} public static void addValues(long classNameId, long tableId,
java.util.List<com.liferay.expando.kernel.model.ExpandoColumn> columns,
long classPK, java.util.Map<java.lang.String, java.lang.String> data)
throws com.liferay.portal.kernel.exception.PortalException {
getService().addValues(classNameId, tableId, columns, classPK, data);
} public static void addValues(long companyId, java.lang.String className,
java.lang.String tableName, long classPK,
java.util.Map<java.lang.String, java.io.Serializable> attributes)
throws com.liferay.portal.kernel.exception.PortalException {
getService()
.addValues(companyId, className, tableName, classPK, attributes);
} public static void addValues(long companyId, long classNameId,
java.lang.String tableName, long classPK,
java.util.Map<java.lang.String, java.io.Serializable> attributes)
throws com.liferay.portal.kernel.exception.PortalException {
getService()
.addValues(companyId, classNameId, tableName, classPK, attributes);
} /**
* Creates a new expando value with the primary key. Does not add the expando value to the database.
*
* @param valueId the primary key for the new expando value
* @return the new expando value
*/
public static com.liferay.expando.kernel.model.ExpandoValue createExpandoValue(
long valueId) {
return getService().createExpandoValue(valueId);
} public static void deleteColumnValues(long columnId) {
getService().deleteColumnValues(columnId);
} /**
* Deletes the expando value from the database. Also notifies the appropriate model listeners.
*
* @param expandoValue the expando value
* @return the expando value that was removed
*/
public static com.liferay.expando.kernel.model.ExpandoValue deleteExpandoValue(
com.liferay.expando.kernel.model.ExpandoValue expandoValue) {
return getService().deleteExpandoValue(expandoValue);
} /**
* Deletes the expando value with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param valueId the primary key of the expando value
* @return the expando value that was removed
* @throws PortalException if a expando value with the primary key could not be found
*/
public static com.liferay.expando.kernel.model.ExpandoValue deleteExpandoValue(
long valueId)
throws com.liferay.portal.kernel.exception.PortalException {
return getService().deleteExpandoValue(valueId);
} /**
* @throws PortalException
*/
public static com.liferay.portal.kernel.model.PersistedModel deletePersistedModel(
com.liferay.portal.kernel.model.PersistedModel persistedModel)
throws com.liferay.portal.kernel.exception.PortalException {
return getService().deletePersistedModel(persistedModel);
} public static void deleteRowValues(long rowId) {
getService().deleteRowValues(rowId);
} public static void deleteTableValues(long tableId) {
getService().deleteTableValues(tableId);
} public static void deleteValue(long columnId, long rowId)
throws com.liferay.portal.kernel.exception.PortalException {
getService().deleteValue(columnId, rowId);
} public static void deleteValue(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK)
throws com.liferay.portal.kernel.exception.PortalException {
getService()
.deleteValue(companyId, className, tableName, columnName, classPK);
} public static void deleteValue(long companyId, long classNameId,
java.lang.String tableName, java.lang.String columnName, long classPK)
throws com.liferay.portal.kernel.exception.PortalException {
getService()
.deleteValue(companyId, classNameId, tableName, columnName, classPK);
} public static void deleteValue(
com.liferay.expando.kernel.model.ExpandoValue value) {
getService().deleteValue(value);
} public static void deleteValue(long valueId)
throws com.liferay.portal.kernel.exception.PortalException {
getService().deleteValue(valueId);
} public static void deleteValues(java.lang.String className, long classPK) {
getService().deleteValues(className, classPK);
} public static void deleteValues(long classNameId, long classPK) {
getService().deleteValues(classNameId, classPK);
} public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() {
return getService().dynamicQuery();
} /**
* Performs a dynamic query on the database and returns the matching rows.
*
* @param dynamicQuery the dynamic query
* @return the matching rows
*/
public static <T> java.util.List<T> dynamicQuery(
com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) {
return getService().dynamicQuery(dynamicQuery);
} /**
* Performs a dynamic query on the database and returns a range of the matching rows.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.expando.model.impl.ExpandoValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param dynamicQuery the dynamic query
* @param start the lower bound of the range of model instances
* @param end the upper bound of the range of model instances (not inclusive)
* @return the range of matching rows
*/
public static <T> java.util.List<T> dynamicQuery(
com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
int end) {
return getService().dynamicQuery(dynamicQuery, start, end);
} /**
* Performs a dynamic query on the database and returns an ordered range of the matching rows.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.expando.model.impl.ExpandoValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param dynamicQuery the dynamic query
* @param start the lower bound of the range of model instances
* @param end the upper bound of the range of model instances (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of matching rows
*/
public static <T> java.util.List<T> dynamicQuery(
com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
int end,
com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator) {
return getService()
.dynamicQuery(dynamicQuery, start, end, orderByComparator);
} /**
* Returns the number of rows matching the dynamic query.
*
* @param dynamicQuery the dynamic query
* @return the number of rows matching the dynamic query
*/
public static long dynamicQueryCount(
com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) {
return getService().dynamicQueryCount(dynamicQuery);
} /**
* Returns the number of rows matching the dynamic query.
*
* @param dynamicQuery the dynamic query
* @param projection the projection to apply to the query
* @return the number of rows matching the dynamic query
*/
public static long dynamicQueryCount(
com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
com.liferay.portal.kernel.dao.orm.Projection projection) {
return getService().dynamicQueryCount(dynamicQuery, projection);
} public static com.liferay.expando.kernel.model.ExpandoValue fetchExpandoValue(
long valueId) {
return getService().fetchExpandoValue(valueId);
} public static com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery() {
return getService().getActionableDynamicQuery();
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getColumnValues(
long columnId, int start, int end) {
return getService().getColumnValues(columnId, start, end);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getColumnValues(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, java.lang.String data, int start, int end) {
return getService()
.getColumnValues(companyId, className, tableName,
columnName, data, start, end);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getColumnValues(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, int start, int end) {
return getService()
.getColumnValues(companyId, className, tableName,
columnName, start, end);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getColumnValues(
long companyId, long classNameId, java.lang.String tableName,
java.lang.String columnName, java.lang.String data, int start, int end) {
return getService()
.getColumnValues(companyId, classNameId, tableName,
columnName, data, start, end);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getColumnValues(
long companyId, long classNameId, java.lang.String tableName,
java.lang.String columnName, int start, int end) {
return getService()
.getColumnValues(companyId, classNameId, tableName,
columnName, start, end);
} public static int getColumnValuesCount(long columnId) {
return getService().getColumnValuesCount(columnId);
} public static int getColumnValuesCount(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName) {
return getService()
.getColumnValuesCount(companyId, className, tableName,
columnName);
} public static int getColumnValuesCount(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, java.lang.String data) {
return getService()
.getColumnValuesCount(companyId, className, tableName,
columnName, data);
} public static int getColumnValuesCount(long companyId, long classNameId,
java.lang.String tableName, java.lang.String columnName) {
return getService()
.getColumnValuesCount(companyId, classNameId, tableName,
columnName);
} public static int getColumnValuesCount(long companyId, long classNameId,
java.lang.String tableName, java.lang.String columnName,
java.lang.String data) {
return getService()
.getColumnValuesCount(companyId, classNameId, tableName,
columnName, data);
} public static java.io.Serializable getData(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName, classPK);
} public static java.lang.String getData(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.lang.String defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static boolean getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
boolean defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static java.util.Date[] getData(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.util.Date[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static double[] getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
double[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static java.lang.Number[] getData(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK,
java.lang.Number[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static short getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
short defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static float getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
float defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static float[] getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
float[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static java.util.Map<?, ?> getData(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK,
java.util.Map<?, ?> defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static java.lang.String[] getData(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK,
java.lang.String[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static short[] getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
short[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static long[] getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
long[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static boolean[] getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
boolean[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static double getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
double defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static long getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
long defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static int[] getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
int[] defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static java.util.Date getData(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.util.Date defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static int getData(long companyId, java.lang.String className,
java.lang.String tableName, java.lang.String columnName, long classPK,
int defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static java.lang.Number getData(long companyId,
java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK, java.lang.Number defaultData)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnName,
classPK, defaultData);
} public static java.util.Map<java.lang.String, java.io.Serializable> getData(
long companyId, java.lang.String className, java.lang.String tableName,
java.util.Collection<java.lang.String> columnNames, long classPK)
throws com.liferay.portal.kernel.exception.PortalException {
return getService()
.getData(companyId, className, tableName, columnNames,
classPK);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getDefaultTableColumnValues(
long companyId, java.lang.String className,
java.lang.String columnName, int start, int end) {
return getService()
.getDefaultTableColumnValues(companyId, className,
columnName, start, end);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getDefaultTableColumnValues(
long companyId, long classNameId, java.lang.String columnName,
int start, int end) {
return getService()
.getDefaultTableColumnValues(companyId, classNameId,
columnName, start, end);
} public static int getDefaultTableColumnValuesCount(long companyId,
java.lang.String className, java.lang.String columnName) {
return getService()
.getDefaultTableColumnValuesCount(companyId, className,
columnName);
} public static int getDefaultTableColumnValuesCount(long companyId,
long classNameId, java.lang.String columnName) {
return getService()
.getDefaultTableColumnValuesCount(companyId, classNameId,
columnName);
} /**
* Returns the expando value with the primary key.
*
* @param valueId the primary key of the expando value
* @return the expando value
* @throws PortalException if a expando value with the primary key could not be found
*/
public static com.liferay.expando.kernel.model.ExpandoValue getExpandoValue(
long valueId)
throws com.liferay.portal.kernel.exception.PortalException {
return getService().getExpandoValue(valueId);
} /**
* Returns a range of all the expando values.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.expando.model.impl.ExpandoValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param start the lower bound of the range of expando values
* @param end the upper bound of the range of expando values (not inclusive)
* @return the range of expando values
*/
public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getExpandoValues(
int start, int end) {
return getService().getExpandoValues(start, end);
} /**
* Returns the number of expando values.
*
* @return the number of expando values
*/
public static int getExpandoValuesCount() {
return getService().getExpandoValuesCount();
} public static com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
return getService().getIndexableActionableDynamicQuery();
} /**
* Returns the OSGi service identifier.
*
* @return the OSGi service identifier
*/
public static java.lang.String getOSGiServiceIdentifier() {
return getService().getOSGiServiceIdentifier();
} public static com.liferay.portal.kernel.model.PersistedModel getPersistedModel(
java.io.Serializable primaryKeyObj)
throws com.liferay.portal.kernel.exception.PortalException {
return getService().getPersistedModel(primaryKeyObj);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getRowValues(
long companyId, java.lang.String className, java.lang.String tableName,
long classPK, int start, int end) {
return getService()
.getRowValues(companyId, className, tableName, classPK,
start, end);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getRowValues(
long companyId, long classNameId, java.lang.String tableName,
long classPK, int start, int end) {
return getService()
.getRowValues(companyId, classNameId, tableName, classPK,
start, end);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getRowValues(
long rowId) {
return getService().getRowValues(rowId);
} public static java.util.List<com.liferay.expando.kernel.model.ExpandoValue> getRowValues(
long rowId, int start, int end) {
return getService().getRowValues(rowId, start, end);
} public static int getRowValuesCount(long companyId,
java.lang.String className, java.lang.String tableName, long classPK) {
return getService()
.getRowValuesCount(companyId, className, tableName, classPK);
} public static int getRowValuesCount(long companyId, long classNameId,
java.lang.String tableName, long classPK) {
return getService()
.getRowValuesCount(companyId, classNameId, tableName, classPK);
} public static int getRowValuesCount(long rowId) {
return getService().getRowValuesCount(rowId);
} public static com.liferay.expando.kernel.model.ExpandoValue getValue(
long columnId, long rowId)
throws com.liferay.portal.kernel.exception.PortalException {
return getService().getValue(columnId, rowId);
} public static com.liferay.expando.kernel.model.ExpandoValue getValue(
long companyId, java.lang.String className, java.lang.String tableName,
java.lang.String columnName, long classPK) {
return getService()
.getValue(companyId, className, tableName, columnName,
classPK);
} public static com.liferay.expando.kernel.model.ExpandoValue getValue(
long companyId, long classNameId, java.lang.String tableName,
java.lang.String columnName, long classPK) {
return getService()
.getValue(companyId, classNameId, tableName, columnName,
classPK);
} public static com.liferay.expando.kernel.model.ExpandoValue getValue(
long tableId, long columnId, long classPK) {
return getService().getValue(tableId, columnId, classPK);
} public static com.liferay.expando.kernel.model.ExpandoValue getValue(
long valueId)
throws com.liferay.portal.kernel.exception.PortalException {
return getService().getValue(valueId);
} /**
* Updates the expando value in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
*
* @param expandoValue the expando value
* @return the expando value that was updated
*/
public static com.liferay.expando.kernel.model.ExpandoValue updateExpandoValue(
com.liferay.expando.kernel.model.ExpandoValue expandoValue) {
return getService().updateExpandoValue(expandoValue);
} public static ExpandoValueLocalService getService() {
if (_service == null) {
_service = (ExpandoValueLocalService)PortalBeanLocatorUtil.locate(ExpandoValueLocalService.class.getName()); ReferenceRegistry.registerReference(ExpandoValueLocalServiceUtil.class,
"_service");
} return _service;
} private static ExpandoValueLocalService _service;
}
还有一篇详细的介绍:
https://web.liferay.com/zh/web/meera.success/blog/-/blogs/working-with-expando-api-in-liferay

Liferay7 BPM门户开发之41: Expando API入门的更多相关文章

  1. Liferay7 BPM门户开发之37: Liferay7下的OSGi Hook集成开发

    hook开发是Liferay客制扩展的一种方式,比插件灵活,即可以扩展liferay门户,也能对原有特性进行更改,Liferay有许多内置的服务,比如用hook甚至可以覆盖Liferay服务. 可作为 ...

  2. Liferay7 BPM门户开发之17: Portlet 生命周期

    Portlet 生命周期 init() =〉 render() =〉 processAction() =〉 processEvent() =〉 serveResource() =〉destroy() ...

  3. Liferay7 BPM门户开发之10: 通用流程实现从Servlet到Portlet(Part1)

    开发目的: 实现通用流程自动化处理(即实现不需要hardcode代码的bpm统一处理后台,仅需要写少量前端html form代码和拖拽设计BPM定义) 既可独立运行或可依托于Liferay或依托其它门 ...

  4. Liferay7 BPM门户开发之12:acitiviti和liferay用户权限体系集成

    写到第12章才出现Liferay的内容,希望可以厚积薄发. 我们的目标是不使用不维护Activiti的用户组织架构,只维护Liferay的体系,这样的好处是非常明显的,即不用做组织架构的同步工作. 原 ...

  5. Liferay7 BPM门户开发之44: 集成Activiti展示流程列表

    处理依赖关系 集成Activiti之前,必须搞清楚其中的依赖关系,才能在Gradle里进行配置. 依赖关系: 例如,其中activiti-engine依赖于activiti-bpmn-converte ...

  6. Liferay7 BPM门户开发之32: 实现自定义认证登陆(定制Authentication Hook)

    第一步:修改liferay-hook.xml <?xml version="1.0"?> <!DOCTYPE hook PUBLIC "-//Lifer ...

  7. Liferay7 BPM门户开发之27: MVC Portlet插件工程开发

    官网上的教材说实话实在精简不清晰. https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/creating-an-mvc-por ...

  8. Liferay7 BPM门户开发之8: Activiti实用问题集合

    1.如何实现审核的上级获取(任务逐级审批) 这个是必备功能,通过Spring的注入+Activiti表达式可以很容易解决. 可参考: http://blog.csdn.net/sunxing007/a ...

  9. Liferay7 BPM门户开发之46: 集成Activiti用户、用户组、成员关系同步

    在实际的BPM集成开发过程中,Liferay和Activiti这两个异构的系统之间,用户.组的同步需求非常重要,用来实现签收组的概念,比如指定签收组.会签.抢签都需要用到. Activiti可以通过自 ...

随机推荐

  1. MATLAB 画出三个通信小区cell边界示意图

    d=1000; %两个小区中心间距离的一半 rcell=2*d/sqrt(3); %小区半径 ncell=3; %小区个数 cellposition=zeros(ncell,2); %初始化小区中心位 ...

  2. bond配置

    Bonding的模式一共有7种: #defineBOND_MODE_ROUNDROBIN       0   (balance-rr模式)网卡的负载均衡模式 #defineBOND_MODE_ACTI ...

  3. 【开发环境】OFFICE 完全卸载工具(微软)

    OFFICE没有正确安装,每次打开OFFICE都会提示: “The setup controller has encountered a problem during instll.Please re ...

  4. 我对C#的理解

    C#里面所有东西都可以看作对象.接口,类,枚举等等. 类是最常用的,可以继承别的接口,类等,就会自动拥有别人的功能. 接口是类的概要.给别人看的协议,好像一个人对外做出的承诺. 抽象类是实现了部分承诺 ...

  5. 编译器错误信息: CS0433: 类型“ASP.usercontrols_total_ascx”同时存在

    “/”应用程序中的服务器错误. 编译错误 说明: 在编译向该请求提供服务所需资源的过程中出现错误.请检查下列特定错误详细信息并适当地修改源代码. 编译器错误信息: CS0433: 类型“ASP.use ...

  6. iOS开发零基础--Swift教程 字典

    字典的介绍 字典允许按照某个键来访问元素 字典是由两部分集合构成的,一个是键(key)集合,一个是值(value)集合 键集合是不能有重复元素的,而值集合是可以重复的,键和值是成对出现的 Swift中 ...

  7. C++容器之Vector

    vector是C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库.vector之所以被认为是一个容器,是因为它能够像容器一样存放各种类型的对象,简单地说vect ...

  8. javascript opacity兼容性随笔

    一.CSS兼容代码 .transparent { filter:alpha(opacity=50); /* IE */ -moz-opacity:0.5; /* FireFox old version ...

  9. anyncTask的3个参数

    AnyncTask异步处理数据并将数据应用到视图的操作场合 一  其中包含这几个方法 1 onPreExcute() 初始化控件,例如进度条2 doInBackground() 具体的执行动作请求数据 ...

  10. 【原创】还原Hyper-V 到一个新的虚拟机

    Context: I need to restore VM31 backup (via 'Windows Server Backup' tool) as another new Hyper-V mac ...