All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adaptrex.core.rest.AdaptrexRestService Maven / Gradle / Ivy

/*
 * Copyright 2012 Adaptrex, LLC
 *
 * 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.adaptrex.core.rest;

import javax.ws.rs.core.UriInfo;

public class AdaptrexRestService implements RestService {

	@Override
	public RestStore getStore(String className, UriInfo uriInfo) {
		return new RestStore(className, uriInfo, null);
	}
	
	@Override
	public RestStore getStore(String className, UriInfo uriInfo, String factoryName) {
		return new RestStore(className, uriInfo, factoryName);
	}
	
	@Override
	public RestModel getModel(String className, Object id, UriInfo uriInfo) {
		return new RestModel(className, id, uriInfo, null);
	}
	
	@Override
	public RestModel getModel(String className, Object id, UriInfo uriInfo, String factoryName) {
		return new RestModel(className, id, uriInfo, factoryName);
	}
	
	@Override
	public RestModel createModel(String className, RequestBody modelData, UriInfo uriInfo) {
		return createModel(className, modelData, uriInfo, null);
	}
	
	@Override
	public RestModel createModel(String className, RequestBody modelData, UriInfo uriInfo, String factoryName) {
		return new RestModel(className, modelData.getData(), uriInfo, factoryName);
	}
	
	@Override
	public RestModel updateModel(String className, Object id, RequestBody modelData, UriInfo uriInfo) {
		return updateModel(className, id, modelData, uriInfo, null);
	}
	
	@Override
	public RestModel updateModel(String className, Object id, RequestBody modelData, UriInfo uriInfo, String factoryName) {
		RestModel model = new RestModel(className, id, uriInfo, factoryName);
		return model.updateEntity(modelData);		
	}	

	@Override
	public RestModel deleteModel(String className, Object id) {
		return deleteModel(className, id, null);
	}
	
	@Override
	public RestModel deleteModel(String className, Object id, String factoryName) {
		RestModel model = new RestModel(className, id, null, factoryName);
		return model.deleteEntity();
	}	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy