Reputation: 690
I need get DDL records via json request. Liferay core have not such service. Only getRecordSet.
I write DDLRecordSetService Hook to add new method getRecords(recordSetId)
.
my code:
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();
}
}
I can override getRecordSet(), but I have not access to getRecordSet() method via URL.
I get:
{"exception":"No JSON web service action associated with path /ddlrecordset/get-records and method GET for /"}
How I can add new DDLRecordSetService that can return me the set of records via JSONWebService?
Upvotes: 0
Views: 1759
Reputation: 1188
The built in JSON services for DDL are richer than just get-record-set. Try pointing your browser at your portal's web service api page. After logging in,
/api/jsonws
There are 7 methods on DDLRecord and 8 more for DDLRecordSet.
It looks to me like the standard API will fit your needs.
If it turns out to be otherwise, then...
JSON Web service methods are created when service builder is run. This reverse engineers your methods into the correct objects for JSON, SOAP and so on.
Since you never run service builder, the reverse engineering never happens. I doubt that running SB for your hook on the core Liferay sources is what you have in mind (and it wouldn't be advisable anyway, imo.)
My suggestion would be to create your own service with Service Builder, and thus create your own API to the service objects you seek to expose. Also see this question
Upvotes: 1