Package app.action.crud

Source Code of app.action.crud.DeleteAction

package app.action.crud;

import app.logic.CrudLogic;

import com.blogger.tcuri.appserver.Action;
import com.blogger.tcuri.appserver.ActionContext;
import com.blogger.tcuri.appserver.Utils;
import com.blogger.tcuri.appserver.db.DbUtils;
import com.blogger.tcuri.appserver.db.SqlBuilder;
import com.blogger.tcuri.appserver.db.Transactional;
import com.blogger.tcuri.appserver.resolution.Resolution;

@Transactional
public class DeleteAction extends Action {

    @Override
    public Resolution execute(ActionContext context) throws Exception {

        String id = context.param("id");

        if (Utils.isNotBlank(id)) {
            SqlBuilder sql = new SqlBuilder(
                    "delete from messages where id=?", id);
            DbUtils.execute(sql);
        }

        return CrudLogic.read();
    }
}
TOP

Related Classes of app.action.crud.DeleteAction

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.