⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 partyratecrudcontroller.java

📁 一个很好的开源项目管理系统源代码
💻 JAVA
字号:
package net.java.workeffort.webapp.action;import java.util.ArrayList;import java.util.List;import javax.servlet.http.HttpServletRequest;import net.java.workeffort.infrastructure.exception.IPropertyException;import net.java.workeffort.service.domain.Party;import net.java.workeffort.webapp.support.ConflictingMultiRowDateRangeException;import net.java.workeffort.webapp.support.InvalidDateRangeException;import net.java.workeffort.webapp.support.WebappUtils;import org.springframework.validation.BindException;/** * The party rate crud controller. Needs extra validation to make the date * ranges for the same 'rateType' do not conflict. * <p> * Class Description * </p> * @author Antony Joseph */public class PartyRateCrudController extends OneToManyCrudController {    protected void onBind(HttpServletRequest request, Object command,            BindException errors) throws Exception {        // if there is a validator configured invoke the validator.        if (!errors.hasErrors()) {            getValidator().validate(command, errors);        }        // Need to make sure that the date ranges across multiple rows don't        // conflict during save.        if (!errors.hasErrors()                && SAVE.equals(request.getParameter(DISPATCH_PARAMETER_NAME))) {            try {                // For row with the same 'rateType' check the date ranges for                // conflict.                List filterPropertyNames = new ArrayList();                filterPropertyNames.add("rateTypeCd");                WebappUtils.validateMultiRowDateRange(request,                        ((Party) command).getPartyRate(), filterPropertyNames,                        "fromDt", "thruDt");            }            catch (InvalidDateRangeException idre) {                ((IPropertyException) idre).setCollectionName("partyRate");                ((IPropertyException) idre).setErrorCode("invalid.dateRange");                populatePropertyErrors(errors, (IPropertyException) idre);            }            catch (ConflictingMultiRowDateRangeException ce) {                ((IPropertyException) ce).setCollectionName("partyRate");                ((IPropertyException) ce).setErrorCode("conflict.dateRange");                populatePropertyErrors(errors, (IPropertyException) ce);            }        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -