package mailreader2.subscription; import com.opensymphony.xwork2.Preparable; import mailreader2.MailreaderSupport; import mailreader2.Constants; import java.util.LinkedHashMap; import java.util.Map; /** *

Provide an Edit method for retrieving an existing subscription, and a * Save method for updating or inserting a subscription.

*/ public class Support extends MailreaderSupport implements Preparable { /** *

Field to store list of MailServer types

*/ private Map types = null; /** *

Provide the list of MailServer types.

* * @return List of MailServer types */ public Map getTypes() { return types; } /** *

Setup the MailerServer types and set the local Host property from * the User Support (if any).

*/ public void prepare() { Map m = new LinkedHashMap(); m.put("imap", "IMAP Protocol"); m.put("pop3", "POP3 Protocol"); types = m; setHost(getSubscriptionHost()); } /** *

Load User Support for the local Host property.

*

*

Usually, the Host is being set from the request by a link to an Edit * or Delete task.

* * @return INPUT or Error, if Support is not found */ public String find() { org.apache.struts.apps.mailreader.dao.Subscription sub = findSubscription(); if (sub == null) { addActionError("find (Subscription): "); addActionError(Constants.ERROR_INVALID_WORKFLOW); return ERROR; } setSubscription(sub); return SUCCESS; } }