package kfs.kfsWfl;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import kfs.kfsDbi.*;

/**
 *
 * @author pavedrim
 */
public class wflTask extends kfsDbObject {

    private final kfsIntAutoInc id;
    private final kfsInt idTemplate;
    private final kfsString name;
    private final kfsString ownerLogin;
    private final kfsInt firstNodeId;
    private final kfsDate lastChange;
    private final kfsDate archivedDate;

    public wflTask(final kfsDbServerType serverType) {
        super(serverType, "T_WFL_TASK");
        int pos = 0;
        id = new kfsIntAutoInc("ID", "Id", pos++);
        idTemplate = new kfsInt("ID_TEMPLATE", "Template ID", kfsIntAutoInc.idMaxLen, pos++, true);
        name = new kfsString("NAME", "Name", 48, pos++);
        ownerLogin = new kfsString("OWNER_LOGIN", "Owner Login", wflUser.loginLen, pos++);
        firstNodeId = new kfsInt("FIRST_NODE_ID", "First Node Id", kfsIntAutoInc.idMaxLen, pos++, true);
        lastChange = new kfsDate("LAST_CHNG", "Last Change", pos++);
        archivedDate = new kfsDate("ARCHIVED_DATE", "Archived Date", pos++);

        super.setColumns(new kfsDbiColumn[]{id, idTemplate, ownerLogin, name, firstNodeId, lastChange, archivedDate});
        super.setUpdateColumns(new kfsDbiColumn[]{ownerLogin, name, firstNodeId, lastChange, archivedDate});
        super.setIdsColumns(new kfsDbiColumn[]{id});
    }

    public kfsRowData create(int templId, String ownerLogin) {
        kfsRowData ret = new kfsRowData(this);
        this.idTemplate.setInt(templId, ret);
        this.ownerLogin.setString(ownerLogin, ret);
        return ret;
    }

    public kfsRowData create() {
        return new kfsRowData(this);
    }

    public int getId(kfsRowData r) {
        return id.getInt(r);
    }

    public Integer getTemplateId(kfsRowData r) {
        return idTemplate.getInt(r);
    }

    public String getName(kfsRowData r) {
        return name.getString(r);
    }

    public void setName(kfsRowData r, String newName) {
        name.setString(newName, r);
    }

    public int getFirstNodeId(kfsRowData r) {
        return firstNodeId.getInt(r);
    }

    public void setFirstNodeId(kfsRowData r, int fist) {
        firstNodeId.setInt(fist, r);
    }

    public Date getLastChange(kfsRowData r) {
        return lastChange.getDate(r);
    }

    public void setLastChange(kfsRowData r, Date lch) {
        lastChange.setDate(lch, r);
    }

    public Date getArchivedDate(kfsRowData r) {
        return archivedDate.getDate(r);
    }

    public void setArchivedDate(kfsRowData r, Date lch) {
        archivedDate.setDate(lch, r);
    }
    
    public String sqlGetTaskById() {
        return getSelect(getName(), getColumns(), new kfsDbiColumn[] {id});
    }
    
    public void psGetTaskById(PreparedStatement ps, int taskId) throws SQLException {
        ps.setInt(1, taskId);
    }
    
    public String getOwnerLogin(kfsRowData r) {
        return this.ownerLogin.getString(r);
    }
    
    public void setOwnerLogin(kfsRowData r, String ownerLogin) {
        this.ownerLogin.setString(ownerLogin, r);
    }
}

@@ -2650,36 +2650,32 @@
 (lch, r);%0A    %7D%0A
-    
 %0A    public Stri
@@ -2764,17 +2764,16 @@
 Column%5B%5D
- 
 %7Bid%7D);%0A 
@@ -2769,36 +2769,32 @@
 n%5B%5D%7Bid%7D);%0A    %7D%0A
-    
 %0A    public void
@@ -2892,36 +2892,32 @@
  taskId);%0A    %7D%0A
-    
 %0A    public Stri
@@ -3000,20 +3000,16 @@
 ;%0A    %7D%0A
-    
 %0A    pub
@@ -3121,11 +3121,1387 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public pojo getPojo(kfsRowData row) %7B%0A        return new pojo(row);%0A    %7D%0A%0A    %0A    public class pojo extends kfsPojoObj%3CwflTask%3E %7B%0A%0A        public pojo(kfsRowData rd) %7B%0A            super(wflTask.this, rd);%0A        %7D%0A%0A        public int getId() %7B%0A            return id.getInt(rd);%0A        %7D%0A%0A        public Integer getTemplateId() %7B%0A            return idTemplate.getInt(rd);%0A        %7D%0A%0A        public String getName() %7B%0A            return name.getString(rd);%0A        %7D%0A%0A        public void setName(String newName) %7B%0A            name.setString(newName, rd);%0A        %7D%0A%0A        public int getFirstNodeId() %7B%0A            return firstNodeId.getInt(rd);%0A        %7D%0A%0A        public void setFirstNodeId(int fist) %7B%0A            firstNodeId.setInt(fist, rd);%0A        %7D%0A%0A        public Date getLastChange() %7B%0A            return lastChange.getDate(rd);%0A        %7D%0A%0A        public void setLastChange( Date lch) %7B%0A            lastChange.setDate(lch, rd);%0A        %7D%0A%0A        public Date getArchivedDate() %7B%0A            return archivedDate.getDate(rd);%0A        %7D%0A%0A        public void setArchivedDate(Date lch) %7B%0A            archivedDate.setDate(lch, rd);%0A        %7D%0A%0A%0A        public String getOwnerLogin() %7B%0A            return ownerLogin.getString(rd);%0A        %7D%0A%0A        public void setOwnerLogin(String owner) %7B%0A            ownerLogin.setString(owner, rd);%0A        %7D%0A    %7D
 %0A%7D%0A

add task pojo class