![JAR search and dependency download from the Maven repository](/logo.png)
io.springlets.web.mvc.util.concurrency.ConcurrencyManager Maven / Gradle / Ivy
Show all versions of springlets-web Show documentation
package io.springlets.web.mvc.util.concurrency;
import org.springframework.ui.Model;
import org.springframework.web.servlet.ModelAndView;
/**
* = ConcurrencyManager
*
* Interface that defines all the operations that should be implemented by a controller that wants to
* manage concurrency.
*
* @param The entity managed by the annotated controller.
* @author Juan Carlos García at http://www.disid.com[DISID Corporation S.L.]
*/
public interface ConcurrencyManager {
/**
* All the controllers that implements ConcurrencyManager must implement a method that returns a String with the
* name of the entity used in the model. Ex:
*
* model.addAttribute(getModelName(), entity);
*
* @return
*/
String getModelName();
/**
* All the controllers that implements ConcurrencyManager must implement a method that returns a String with the
* path of the edit view. Ex:
*
* "entities/edit"
*
* @return
*/
String getEditViewPath();
/**
* All the controllers that implements ConcurrencyManager must implement a method that returns the last version of
* the provided record.
*
* @param record
* @return
*/
Integer getLastVersion(T record);
/**
* All the controllers that implements ConcurrencyManager must implement a populateForm method to ensure that the
* populateConcurrencyForm method is able to populate a complete edit form.
*
* @param model
*/
void populateForm(Model model);
/**
* All the controllers that implements ConcurrencyManager could implement a populateConcurrencyForm method to ensure
* that the edit form is populate correctly when a Concurrency Exception appears.
*
* @param entity
* @return
*/
ModelAndView populateAndGetFormView(T entity, Model model);
}