public static BucketSet addAgeBucketSet(RuleDictionary dictionary) throws Exception { DataModel model = dictionary.getDataModel(); // Create a new bucketset holding product weight descriptions BucketSetTable bucketSetTable = model.getBucketSetTable(); BucketSet ageBucketSet = bucketSetTable.getByName("Age"); if (ageBucketSet != null) { System.out.println("Age BucketSet already exists, skipping add"); } else { ageBucketSet = bucketSetTable.add(); ageBucketSet.setName("Age"); ageBucketSet.setForm(BucketSet.FORM_RANGE); ageBucketSet.setType("int"); ageBucketSet.add("<0").setAlias("Minor"); ageBucketSet.add("<18").setAlias("Junior"); ageBucketSet.add("<50").setAlias("Middle"); ageBucketSet.add("<75").setAlias("Senior"); } return ageBucketSet; }
/* This method demonstrates how to add a new BucketSet to a dictionary data model * * @param dict An existing rules dictionary object */ public static BucketSet addBucketSet(RuleDictionary dictionary) throws Exception { DataModel model = dictionary.getDataModel(); // Create a new bucketset holding product weight descriptions BucketSetTable bucketSetTable = model.getBucketSetTable(); BucketSet productWeightBucketSet = bucketSetTable.getByName("ShipWeightType"); if (productWeightBucketSet != null) { System.out.println("ShipWeightType BucketSet already exists, skipping add"); } else { productWeightBucketSet = bucketSetTable.add(); productWeightBucketSet.setName("ShipWeightType"); productWeightBucketSet.setForm(BucketSet.FORM_LOV); productWeightBucketSet.add("Light"); productWeightBucketSet.add("Heavy"); productWeightBucketSet.add("VeryHeavy"); } return productWeightBucketSet; }