001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.isis.viewer.restfulobjects.applib.domaintypes; 020 021import javax.ws.rs.GET; 022import javax.ws.rs.Path; 023import javax.ws.rs.PathParam; 024import javax.ws.rs.Produces; 025import javax.ws.rs.QueryParam; 026import javax.ws.rs.core.MediaType; 027import javax.ws.rs.core.Response; 028 029import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType; 030import org.jboss.resteasy.annotations.ClientResponseType; 031 032@Path("/domain-types") 033public interface DomainTypeResource { 034 035 // ///////////////////////////////////////////////////// 036 // domainTypes (list of all ) 037 // ///////////////////////////////////////////////////// 038 039 @GET 040 @Path("/") 041 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_LIST }) 042 @ClientResponseType(entityType = String.class) 043 public abstract Response domainTypes(); 044 045 // ///////////////////////////////////////////////////// 046 // domainType + member description 047 // ///////////////////////////////////////////////////// 048 049 @GET 050 @Path("/{domainType}") 051 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_DOMAIN_TYPE }) 052 @ClientResponseType(entityType = String.class) 053 public abstract Response domainType(@PathParam("domainType") final String domainType); 054 055 @GET 056 @Path("/{domainType}/properties/{propertyId}") 057 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_PROPERTY_DESCRIPTION }) 058 @ClientResponseType(entityType = String.class) 059 public abstract Response typeProperty(@PathParam("domainType") final String domainType, @PathParam("propertyId") final String propertyId); 060 061 @GET 062 @Path("/{domainType}/collections/{collectionId}") 063 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_COLLECTION_DESCRIPTION }) 064 @ClientResponseType(entityType = String.class) 065 public abstract Response typeCollection(@PathParam("domainType") final String domainType, @PathParam("collectionId") final String collectionId); 066 067 @GET 068 @Path("/{domainType}/actions/{actionId}") 069 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_DESCRIPTION }) 070 @ClientResponseType(entityType = String.class) 071 public abstract Response typeAction(@PathParam("domainType") final String domainType, @PathParam("actionId") final String actionId); 072 073 @GET 074 @Path("/{domainType}/actions/{actionId}/params/{paramNum}") 075 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_PARAMETER_DESCRIPTION }) 076 @ClientResponseType(entityType = String.class) 077 public abstract Response typeActionParam(@PathParam("domainType") final String domainType, @PathParam("actionId") final String actionId, @PathParam("paramNum") final String paramName); 078 079 // ////////////////////////////////////////////////////////// 080 // domain type actions 081 // ////////////////////////////////////////////////////////// 082 083 @GET 084 @Path("/{domainType}/isSubtypeOf/invoke") 085 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR }) 086 @ClientResponseType(entityType = String.class) 087 public abstract Response domainTypeIsSubtypeOf( 088 @PathParam("domainType") final String domainType, 089 @QueryParam("supertype") String superType, // simple style 090 @QueryParam("args") final String argumentsQueryString // formal style 091 ); 092 093 @GET 094 @Path("/{domainType}/isSupertypeOf/invoke") 095 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR }) 096 @ClientResponseType(entityType = String.class) 097 public abstract Response domainTypeIsSupertypeOf( 098 @PathParam("domainType") final String domainType, 099 @QueryParam("supertype") String superType, // simple style 100 @QueryParam("args") final String argumentsQueryString // formal style 101 ); 102 103}