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

com.morpheusdata.views.ViewModel Maven / Gradle / Ivy

package com.morpheusdata.views;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import com.morpheusdata.model.User;
import java.util.Map;

/**
 * This model will be provided from Morpheus-ui to the plugin controller. It contains the request/response
 * @param  Type of object in the model.
 */
public class ViewModel {
	public T object;
	public ServletRequest request;
	public ServletResponse response;
	public Integer status = 200;
	public User user;
	public Map opts;

	/**
	 * Helper method to create a successful ViewModel of an object
	 * @param data The object to base the model off of
	 * @return a ViewModel
	 */
	static ViewModel of(Object data) {
		ViewModel obj = new ViewModel<>();
		obj.object = data;
		return obj;
	}

}