protected SocialEquityActionMapping getMergedEquityActionMapping( long groupId, SocialEquityActionMapping equityActionMapping) throws Exception { SocialEquityActionMapping mergedEquityActionMapping = equityActionMapping.clone(); List<SocialEquitySetting> equitySettings = SocialEquitySettingLocalServiceUtil.getEquitySettings( groupId, equityActionMapping.getClassName(), equityActionMapping.getActionId()); for (SocialEquitySetting equitySetting : equitySettings) { if (equitySetting.getType() == SocialEquitySettingConstants.TYPE_INFORMATION) { mergedEquityActionMapping.setInformationDailyLimit(equitySetting.getDailyLimit()); mergedEquityActionMapping.setInformationLifespan(equitySetting.getLifespan()); mergedEquityActionMapping.setInformationValue(equitySetting.getValue()); } else { mergedEquityActionMapping.setParticipationDailyLimit(equitySetting.getDailyLimit()); mergedEquityActionMapping.setParticipationLifespan(equitySetting.getLifespan()); mergedEquityActionMapping.setParticipationValue(equitySetting.getValue()); } mergedEquityActionMapping.setUnique(equitySetting.isUniqueEntry()); } return mergedEquityActionMapping; }
protected void updateModel( ActionRequest actionRequest, SocialEquityActionMapping equityActionMapping, String param) throws Exception { String className = equityActionMapping.getClassName(); int value = ParamUtil.getInteger( actionRequest, className + "." + equityActionMapping.getActionId() + "." + param, -1); if (value >= 0) { BeanPropertiesUtil.setProperty(equityActionMapping, param, value); } }
protected SocialEquityActionMapping getMergedEquityActionMapping( ActionRequest actionRequest, SocialEquityActionMapping equityActionMapping) throws Exception { SocialEquityActionMapping mergedMapping = equityActionMapping.clone(); updateModel(actionRequest, mergedMapping, "informationDailyLimit"); updateModel(actionRequest, mergedMapping, "informationLifespan"); updateModel(actionRequest, mergedMapping, "informationValue"); updateModel(actionRequest, mergedMapping, "participationDailyLimit"); updateModel(actionRequest, mergedMapping, "participationLifespan"); updateModel(actionRequest, mergedMapping, "participationValue"); boolean unique = ParamUtil.getBoolean( actionRequest, equityActionMapping.getClassName() + "." + equityActionMapping.getActionId() + ".unique"); mergedMapping.setUnique(unique); return mergedMapping; }