FileDocCategorySizeDatePackage
Subscription.javaAPI DocApache Struts 2.0.9 Apps3809Mon Jul 23 13:43:12 BST 2007mailreader2

Subscription

public class Subscription extends MailreaderSupport implements com.opensymphony.xwork2.Preparable

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

Fields Summary
private Map
types

Field to store list of MailServer types

Constructors Summary
Methods Summary
public java.lang.Stringdelete()

Prepare to present a confirmation page before removing Subscription.

return
INPUT or Error, if Subscription is not found


        setTask(Constants.DELETE);
        return find();
    
public java.lang.Stringedit()

Prepare to edit User Subscription.

return
INPUT or Error, if Subscription is not found


        setTask(Constants.EDIT);
        return find();
    
public java.lang.Stringfind()

Load User Subscription 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 Subscription is not found


        org.apache.struts.apps.mailreader.dao.Subscription
                sub = findSubscription();

        if (sub == null) {
            return ERROR;
        }

        setSubscription(sub);

        return INPUT;

    
public java.util.MapgetTypes()

Provide the list of MailServer types.

return
List of MailServer types


                    
       
        return types;
    
public java.lang.Stringinput()

Setup a temporary User Subscription object to capture input values.

return
INPUT

        createInputSubscription();
        setTask(Constants.CREATE);
        return INPUT;
    
public voidprepare()

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


        Map m = new LinkedHashMap();
        m.put("imap", "IMAP Protocol");
        m.put("pop3", "POP3 Protocol");
        types = m;

        setHost(getSubscriptionHost());
    
public java.lang.Stringsave()

Examine the Task property and DELETE, CREATE, or save the User Subscription, as appropriate.

return
SUCCESS
throws
Exception on a database error


        if (Constants.DELETE.equals(getTask())) {
            removeSubscription();
        }

        if (Constants.CREATE.equals(getTask())) {
            copySubscription(getHost());
        }

        if (hasErrors()) return INPUT;

        saveUser();
        return SUCCESS;