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 */
019 package org.apache.isis.viewer.restfulobjects.applib.domaintypes;
020
021 import javax.ws.rs.GET;
022 import javax.ws.rs.Path;
023 import javax.ws.rs.PathParam;
024 import javax.ws.rs.Produces;
025 import javax.ws.rs.QueryParam;
026 import javax.ws.rs.core.MediaType;
027 import javax.ws.rs.core.Response;
028
029 import org.jboss.resteasy.annotations.ClientResponseType;
030
031 import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
032
033 @Path("/domainTypes")
034 public interface DomainTypeResource {
035
036 // /////////////////////////////////////////////////////
037 // domainTypes (list of all )
038 // /////////////////////////////////////////////////////
039
040 @GET
041 @Path("/")
042 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_LIST })
043 @ClientResponseType(entityType = String.class)
044 public abstract Response domainTypes();
045
046 // /////////////////////////////////////////////////////
047 // domainType + member description
048 // /////////////////////////////////////////////////////
049
050 @GET
051 @Path("/{domainType}")
052 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_DOMAIN_TYPE })
053 @ClientResponseType(entityType = String.class)
054 public abstract Response domainType(@PathParam("domainType") final String domainType);
055
056 @GET
057 @Path("/{domainType}/properties/{propertyId}")
058 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_PROPERTY_DESCRIPTION })
059 @ClientResponseType(entityType = String.class)
060 public abstract Response typeProperty(@PathParam("domainType") final String domainType, @PathParam("propertyId") final String propertyId);
061
062 @GET
063 @Path("/{domainType}/collections/{collectionId}")
064 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_COLLECTION_DESCRIPTION })
065 @ClientResponseType(entityType = String.class)
066 public abstract Response typeCollection(@PathParam("domainType") final String domainType, @PathParam("collectionId") final String collectionId);
067
068 @GET
069 @Path("/{domainType}/actions/{actionId}")
070 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_DESCRIPTION })
071 @ClientResponseType(entityType = String.class)
072 public abstract Response typeAction(@PathParam("domainType") final String domainType, @PathParam("actionId") final String actionId);
073
074 @GET
075 @Path("/{domainType}/actions/{actionId}/params/{paramNum}")
076 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_PARAMETER_DESCRIPTION })
077 @ClientResponseType(entityType = String.class)
078 public abstract Response typeActionParam(@PathParam("domainType") final String domainType, @PathParam("actionId") final String actionId, @PathParam("paramNum") final String paramName);
079
080 // //////////////////////////////////////////////////////////
081 // domain type actions
082 // //////////////////////////////////////////////////////////
083
084 @GET
085 @Path("/{domainType}/isSubtypeOf/invoke")
086 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
087 @ClientResponseType(entityType = String.class)
088 public abstract Response domainTypeIsSubtypeOf(@PathParam("domainType") final String domainType, @QueryParam("supertype") String superType, // simple
089 // style
090 @QueryParam("args") final String argumentsQueryString // formal
091 // style
092 );
093
094 @GET
095 @Path("/{domainType}/isSupertypeOf/invoke")
096 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
097 @ClientResponseType(entityType = String.class)
098 public abstract Response domainTypeIsSupertypeOf(@PathParam("domainType") final String domainType, @QueryParam("supertype") String superType, // simple
099 // style
100 @QueryParam("args") final String argumentsQueryString // formal
101 // style
102 );
103
104 @GET
105 @Path("/{domainType}/newTransientInstance/invoke")
106 @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
107 @ClientResponseType(entityType = String.class)
108 public Response newTransientInstance(@QueryParam("domainType") final String domainType, @QueryParam("args") final String args);
109
110 }