ConfirmationException

From JRapid

Jump to: navigation, search

ConfirmationException is a runtime exception offered in the com.jrapid.exception package used to prompt users for confirmation.

The ConfirmationException constructor takes two parameters. The first parameter is the name of the confirmation, which is necessary for it to be identified. The second parameter is the text to be displayed to the user in the confirmation browser dialog.


Example

For a Company entity, you could overwrite the store() method in the Services class to ask for confirmation on storing a Company with no address.

import com.jrapid.exception.ConfirmationException;

public class CompanyServices extends CompanyServicesAbstract {

	@Override
		public Object store(String id, Company voobj) {	
		
		if("".equals(voobj.getAddress())) {
			if (!Session.getMySession().getConfirmations().contains("emptyAddress")) {
				throw new ConfirmationException("emptyAddress", "Do you really want to store a Company with no address?");
			}
		}
		
		return super.store(id, voobj);
	}
}

See also

Personal tools