Subversion Repositories WebE

Compare Revisions

Last modification

Regard whitespace Rev 33 → Rev 34

/trunk/src/ch/ffhs/webE/action/RelationshipTypeAction.java
5,12 → 5,13
 
import javax.servlet.http.HttpServletRequest;
 
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsStatics;
 
import ch.ffhs.webE.dao.RelationshipTypeDAO;
import ch.ffhs.webE.dao.RelationshipTypeDAOImpl;
import ch.ffhs.webE.domain.RelationshipType;
 
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
23,38 → 24,38
 
private RelationshipType relType = new RelationshipType();
private List<RelationshipType> relTypeList = new ArrayList<RelationshipType>();
private RelationshipTypeDAO relTypeDAO = new RelationshipTypeDAOImpl();
private final RelationshipTypeDAO relTypeDAO = new RelationshipTypeDAOImpl();
 
@Override
public RelationshipType getModel()
{
return relType;
return this.relType;
}
 
public String addOrUpdate()
{
relTypeDAO.saveOrUpdateRelType(relType);
return SUCCESS;
this.relTypeDAO.saveOrUpdateRelType(this.relType);
return Action.SUCCESS;
}
 
public String list()
{
relTypeList = relTypeDAO.listRelationshipTypes();
return SUCCESS;
this.relTypeList = this.relTypeDAO.getRelTypes();
return Action.SUCCESS;
}
public String edit()
{
int id = getIdParameter();
int id = this.getIdParameter();
 
if (id > 0)
{
relType = relTypeDAO.listRelTypeById(id);
return SUCCESS;
this.relType = this.relTypeDAO.getRelTypeById(id);
return Action.SUCCESS;
}
else
{
return ERROR;
return Action.ERROR;
}
}
66,7 → 67,7
private int getIdParameter()
{
HttpServletRequest request = (HttpServletRequest) ActionContext
.getContext().get(ServletActionContext.HTTP_REQUEST);
.getContext().get(StrutsStatics.HTTP_REQUEST);
 
int id = -1;
try
89,17 → 90,17
*/
public String delete()
{
int id = getIdParameter();
int id = this.getIdParameter();
 
// Check for malicious ID values
if (id > 0)
{
relTypeDAO.deleteRelationshipType(id);
return SUCCESS;
this.relTypeDAO.deleteRelationshipType(id);
return Action.SUCCESS;
}
else
{
return ERROR;
return Action.ERROR;
}
}
 
109,7 → 110,7
 
public RelationshipType getRelType()
{
return relType;
return this.relType;
}
 
public void setRelType(RelationshipType relType)
119,7 → 120,7
 
public List<RelationshipType> getRelTypeList()
{
return relTypeList;
return this.relTypeList;
}
 
public void setRelTypeList(List<RelationshipType> relTypeList)