package modules.admin.Contact;

import org.skyve.domain.Bean;
import org.skyve.metadata.controller.ImplicitActionName;
import org.skyve.metadata.model.document.Bizlet;
import org.skyve.web.WebContext;

import modules.admin.domain.Contact;
import modules.admin.domain.Contact.ContactType;

public class ContactBizlet extends Bizlet<Contact> {
	private static final long serialVersionUID = 6794069388827546373L;

	@Override
	public Contact preExecute(ImplicitActionName actionName,
								Contact bean,
								Bean parentBean,
								WebContext webContext)
	throws Exception {
		if(ImplicitActionName.Add.equals(actionName) ){
			//TODO add default image using resource UnknownContact
		}
		
		return bean;
	}

	public static String bizKey(Contact bean) {
	  	StringBuilder result = new StringBuilder(64);
	  	
	  	String name = bean.getName();
		result.append((name == null) ? "Unnamed Contact" : name);
  		
		ContactType type = bean.getContactType();
  		if (type != null) {
			result.append(" (").append(type).append(')');
		}
		
		String mobile = bean.getMobile();
		if (mobile != null) {
			result.append(" (m) ").append(mobile);
		}
		
		return result.toString();
	}
	
	/**
	 * Returns true if the contact holds no data and can be dispensed with.
	 * 
	 * @param c
	 */
	public static boolean isNothing(Contact c){
		boolean result = true;
		
		result = result && (c.getName()==null);
		result = result && (c.getMobile()==null);
		result = result && (c.getEmail1()==null);
		
		return result;
	}

}

@@ -46,157 +46,37 @@
 yve.
-domain.Bean;%0Aimport org.skyve.metadata.controller.ImplicitActionName;%0Aimport org.skyve.metadata.model.document.Bizlet;%0Aimport org.skyve.web.WebContex
+metadata.model.document.Bizle
 t;%0A%0A
@@ -288,309 +288,8 @@
 L;%0A%0A
-%09@Override%0A%09public Contact preExecute(ImplicitActionName actionName,%0A%09%09%09%09%09%09%09%09Contact bean,%0A%09%09%09%09%09%09%09%09Bean parentBean,%0A%09%09%09%09%09%09%09%09WebContext webContext)%0A%09throws Exception %7B%0A%09%09if(ImplicitActionName.Add.equals(actionName) )%7B%0A%09%09%09//TODO add default image using resource UnknownContact%0A%09%09%7D%0A%09%09%0A%09%09return bean;%0A%09%7D%0A%0A
 %09pub

Remove empty stub in ContactBizlet