Package com.suarte.webapp.action

Source Code of com.suarte.webapp.action.ResolutionForm

package com.suarte.webapp.action;

import com.suarte.core.Resolution;
import org.appfuse.service.GenericManager;

import java.io.Serializable;

/**
* Created by IntelliJ IDEA.
* User: Gcastillo
* Date: Mar 14, 2011
* Time: 7:54:50 PM
* To change this template use File | Settings | File Templates.
*/
public class ResolutionForm extends BasePage implements Serializable {
    private GenericManager<Resolution, Long> resolutionManager;
    private Resolution resolution = new Resolution();
    private Long id;

    public void setResolutionManager(GenericManager<Resolution, Long> resolutionManager) {
        this.resolutionManager = resolutionManager;
    }

    public Resolution getResolution() {
        return resolution;
    }

    public void setResolution(Resolution resolution) {
        this.resolution = resolution;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String delete() {
        resolutionManager.remove(resolution.getId());
        addMessage("resolution.deleted");

        return "list";
    }

    public String edit() {
        if (id != null) {
            resolution = resolutionManager.get(id);
        } else {
            resolution = new Resolution();
        }

        return "edit";
    }

    public String add() {
        resolution = new Resolution();

        return "add";
    }

    public String save() {
        boolean isNew = (resolution.getId() == null);
        resolutionManager.save(resolution);

        String key = (isNew) ? "resolution.added" : "resolution.updated";
        addMessage(key);

        if (isNew) {
            return "list";
        } else {
            return "edit";
        }
    }
}
TOP

Related Classes of com.suarte.webapp.action.ResolutionForm

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.