package org.gcube.gcat.rest; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.xml.ws.WebServiceException; import org.gcube.gcat.api.GCatConstants; import org.gcube.gcat.persistence.ckan.CKANLicense; import com.webcohesion.enunciate.metadata.rs.ResourceGroup; import com.webcohesion.enunciate.metadata.rs.ResourceLabel; /** * A collection to interact with licenses that are available in the catalogue. * A license is associated with items to define the legal right * to use such an item. * * @author Luca Frosini (ISTI - CNR) */ @Path(License.LICENSES) @ResourceGroup("Item Related APIs") @ResourceLabel("License APIs") public class License extends REST implements org.gcube.gcat.api.interfaces.License { public License() { super(LICENSES, null, CKANLicense.class); } /** * @return the json array containing the licenses available in the catalogue * * @pathExample /licenses * @responseExample application/json classpath:/api-docs-examples/license/list-license-response.json */ @GET @Produces(MediaType.APPLICATION_JSON) public String list() throws WebServiceException { return super.list(-1, -1); } /** * @return the json array containing the licenses available in the catalogue * * @pathExample /licenses * @responseExample application/json classpath:/api-docs-examples/license/list-license-response.json */ @GET @Produces(GCatConstants.APPLICATION_JSON_API) public String listAsJsonAPI() { String ret = super.list(-1, -1); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("{ \"data\":"); stringBuffer.append(ret); stringBuffer.append("}"); return stringBuffer.toString(); } }