package jp.dip.arimodoki.blogic;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jp.dip.arimodoki.common.CConst;
import jp.dip.arimodoki.mapper.TblClassMap;
import jp.dip.arimodoki.model.FormCreatureClassIf;
import jp.dip.arimodoki.model.dto.DtoTblClass;
import jp.dip.arimodoki.model.dto.DtoTblClassIf;
@Service
public class BlCreatureClass implements CConst, BlCreatureClassIf {
@Autowired
private TblClassMap tblClassMap;
private FormCreatureClassIf formCreatureClass;
public void setForm(FormCreatureClassIf form) {
this.formCreatureClass = form;
}
@Transactional(readOnly=true)
public void getClassList() throws Exception {
String parent = this.formCreatureClass.getParent();
String rute = this.formCreatureClass.getRute();
logger.log_info(this, "parent["+parent+"]");
DtoTblClassIf cond = new DtoTblClass();
cond.setParent(parent);
cond.setRute(rute);
List classList = null;
if(rute.equals("root")) {
classList = tblClassMap.getKingdomList(parent);
} else {
classList = tblClassMap.getClassList(cond);
}
if(classList==null) return;
int lsize = classList.size();
int i = 0;
for(DtoTblClassIf entity : classList) {
boolean leaf = false;
if(entity.getLeaf().equals("0") ) {
leaf = true;
entity.setPointer("iconpointer");
} else {
entity.setPointer("nopointer");
}
i++;
if(i==lsize) {
entity.setDivclass("treelistn");
if(leaf) {
entity.setIcon("expand_l_b.gif");
entity.setTooltip("Expand");
} else {
entity.setIcon("l_dot_b.gif");
entity.setTooltip("");
}
} else {
if(leaf) {
entity.setIcon("expand.gif");
entity.setTooltip("Expand");
} else {
entity.setIcon("horizont.gif");
entity.setTooltip("");
}
}
}
this.formCreatureClass.setResult(classList);
}
}
|