blob: 93f2397ccecdecadf9d39a54fcff621dd9af8bd6 [file] [log] [blame]
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.sample.expenses.shared;
import com.google.gwt.requestfactory.shared.EntityKey;
import com.google.gwt.requestfactory.shared.EntityListRequest;
import com.google.gwt.requestfactory.shared.LongString;
import com.google.gwt.requestfactory.shared.RequestFactory;
import com.google.gwt.valuestore.shared.DeltaValueStore;
import com.google.gwt.valuestore.shared.ValueRef;
/**
* "API generated" for the service methods of
* com.google.gwt.sample.expenses.server.domain.
* <p>
* IRL this interface will be generated by a JPA-savvy tool run before
* compilation.
*/
public interface ExpenseRequestFactory extends RequestFactory {
/**
* Request selector.
*/
interface EmployeeRequest {
/**
* @return a request object
*/
EntityListRequest<EmployeeKey> findAllEmployees();
}
/**
* Request selector.
*/
interface ReportRequest {
/**
* @return a request object
*/
EntityListRequest<ReportKey> findReportsByEmployee(
@LongString ValueRef<EmployeeKey, String> id);
/**
* @return a request object
*/
EntityListRequest<ReportKey> findAllReports();
}
/**
* Represents the server side operation to be carried out. This enum will be
* generated by the JPA-aware tool.
*
*/
public enum ServerSideOperation implements RequestDefinition {
FIND_ALL_EMPLOYEES("com.google.gwt.sample.expenses.server.domain.Employee",
"findAllEmployees", null,
com.google.gwt.sample.expenses.shared.EmployeeKey.class), //
FIND_ALL_REPORTS("com.google.gwt.sample.expenses.server.domain.Report",
"findAllReports", null,
com.google.gwt.sample.expenses.shared.ReportKey.class), //
FIND_EMPLOYEE("com.google.gwt.sample.expenses.server.domain.Employee",
"findEmployee", new Class[] {java.lang.Long.class},
com.google.gwt.sample.expenses.shared.EmployeeKey.class), //
FIND_REPORTS_BY_EMPLOYEE(
"com.google.gwt.sample.expenses.server.domain.Report",
"findReportsByEmployee", new Class[] {java.lang.Long.class},
com.google.gwt.sample.expenses.shared.ReportKey.class); //
/**
* the server side domain class.
*/
private final String domainClassName;
/**
* the methodName of the domain class that is to be invoked.
*/
private final String domainMethodName;
/**
* the parameterTypes of the parameters the domain method requires.
*/
private final Class<?>[] parameterTypes;
/**
* for "READ" methods, the methods return a List. This class denotes the types
* of the elements of the list.
*/
private final Class<? extends EntityKey<?>> returnType;
private ServerSideOperation(String domainClassName, String domainMethodName,
Class<?> parameterTypes[], Class<? extends EntityKey<?>> entryReturnType) {
this.domainClassName = domainClassName;
this.domainMethodName = domainMethodName;
this.parameterTypes = parameterTypes;
this.returnType = entryReturnType;
}
public String getDomainClassName() {
return domainClassName;
}
public String getDomainMethodName() {
return domainMethodName;
}
public Class<?>[] getParameterTypes() {
return parameterTypes;
}
public Class<? extends EntityKey<?>> getReturnType() {
return returnType;
}
}
/**
* @return a request selector
*/
EmployeeRequest employeeRequest();
/**
* @return a request selector based on new values
*/
EmployeeRequest employeeRequest(DeltaValueStore deltas);
/**
* @return a request selector
*/
ReportRequest reportRequest();
/**
* @return a request selector based on new values
*/
ReportRequest reportRequest(DeltaValueStore deltas);
}