private MapSqlParameterSource getClusterPolicyUnitParameterMap(
     ClusterPolicyUnit clusterPolicyUnit) {
   return getCustomMapSqlParameterSource()
       .addValue("cluster_policy_id", clusterPolicyUnit.getClusterPolicyId())
       .addValue("policy_unit_id", clusterPolicyUnit.getPolicyUnitId())
       .addValue("filter_sequence", clusterPolicyUnit.getFilterSequence())
       .addValue("factor", clusterPolicyUnit.getFactor());
 }
 private void fillClusterPolicy(
     Map<Guid, ClusterPolicy> map, List<ClusterPolicyUnit> clusterPolicyUnits) {
   Map<Guid, PolicyUnit> policyUnitMap = new HashMap<Guid, PolicyUnit>();
   for (PolicyUnit policyUnit : policyUnitDao.getAll()) {
     policyUnitMap.put(policyUnit.getId(), policyUnit);
   }
   for (ClusterPolicyUnit clusterPolicyUnit : clusterPolicyUnits) {
     ClusterPolicy clusterPolicy = map.get(clusterPolicyUnit.getClusterPolicyId());
     if (policyUnitMap.get(clusterPolicyUnit.getPolicyUnitId()).getPolicyUnitType()
         == PolicyUnitType.FILTER) {
       if (clusterPolicy.getFilters() == null) {
         clusterPolicy.setFilters(new ArrayList<Guid>());
       }
       clusterPolicy.getFilters().add(clusterPolicyUnit.getPolicyUnitId());
       if (clusterPolicyUnit.getFilterSequence() != 0) {
         if (clusterPolicy.getFilterPositionMap() == null) {
           clusterPolicy.setFilterPositionMap(new HashMap<Guid, Integer>());
         }
         clusterPolicy
             .getFilterPositionMap()
             .put(clusterPolicyUnit.getPolicyUnitId(), clusterPolicyUnit.getFilterSequence());
       }
     }
     if (policyUnitMap.get(clusterPolicyUnit.getPolicyUnitId()).getPolicyUnitType()
         == PolicyUnitType.WEIGHT) {
       if (clusterPolicy.getFunctions() == null) {
         clusterPolicy.setFunctions(new ArrayList<Pair<Guid, Integer>>());
       }
       clusterPolicy
           .getFunctions()
           .add(
               new Pair<Guid, Integer>(
                   clusterPolicyUnit.getPolicyUnitId(), clusterPolicyUnit.getFactor()));
     }
     if (policyUnitMap.get(clusterPolicyUnit.getPolicyUnitId()).getPolicyUnitType()
         == PolicyUnitType.LOAD_BALANCING) {
       clusterPolicy.setBalance(clusterPolicyUnit.getPolicyUnitId());
     }
   }
 }