我需要通过 json 请求获取 DDL 记录。Liferay 核心没有这样的服务。只有getRecordSet。
我编写 DDLRecordSetService Hook 来添加新方法getRecords(recordSetId)
。我的代码:
public class ExtDDLRecordSetLocalServiceImpl extends DDLRecordSetServiceWrapper {
public ExtDDLRecordSetLocalServiceImpl(DDLRecordSetService ddlRecordSetService) {
super(ddlRecordSetService);
}
public com.liferay.portlet.dynamicdatalists.model.DDLRecordSet getRecordSet(long recordSetId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException{
System.out.println("------override getRecordSet ");
DDLRecordSet set = super.getRecordSet(recordSetId+10);
return set;
}
@JSONWebService
public List<DDLRecord> getRecords(long recordSetId) throws SystemException, PortalException {
System.out.println("------override getRecords");
return getRecordSet(recordSetId).getRecords();
}
}
我可以覆盖 getRecordSet(),但我无法通过 URL 访问 getRecordSet() 方法。
我得到:
{"exception":"No JSON web service action associated with path /ddlrecordset/get-records and method GET for /"}
如何添加新的 DDLRecordSetService,它可以通过 JSONWebService 返回记录集?