...
Code Block | ||
---|---|---|
| ||
/* * Copyright 2018. Intellect Design Arena Limited. All rights reserved. * These materials are confidential and proprietary to Intellect Design Arena Limited * and no part of these materials should be reproduced, published, transmitted * or distributed in any form or by any means, electronic, mechanical, photocopying, * recording or otherwise, or stored in any information storage or retrieval system * of any nature nor should the materials be disclosed to third parties or used in any * other manner for which this is not authorized, without the prior express written * authorization of Intellect Design Arena Limited. */ package com.intellectdesign.modelhouse; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import com.intellectdesign.canvas.entitlement.EntitlementException; import com.intellectdesign.canvas.entitlement.IEntitlementDataProvider; /* * Link this class as the source for all possible values for a given entitlement * criteria * @Version 1.0 */ public class LoanTypesEntitlmentProvider implements IEntitlementDataProvider { /** * Implementation teams have to implement this method and return all * possible values for a given entitlement criteria. * @param product * @param subProduct * @param function * @param criteriaName the name of the entitlement criteria * @return a list of String which are the possible values for given entitlement criteria * @throws EntitlementException in case of any exception in preparing the list * @see com.intellectdesign.canvas.entitlement.IEntitlementDataProvider#getCriteriaValues(java.lang.String, *java.lang.String, java.lang.String, java.lang.String) **/ @Override public List getCriteriaValues(String product, String subProduct, String function, String criteriaName) throws EntitlementException { List<String> possibleCriteriaValues = new ArrayList<String>(); // This is a sample entitlement provider where we will read possible values from a text file // Implementation teams are free to decide the source of this data (from a a DB/Web service/File or anywhere else) File sourceFile = new File("D:\\SampleCritValues.txt"); Scanner fileScanner; try { fileScanner = new Scanner(sourceFile); while (fileScanner.hasNextLine()) possibleCriteriaValues.add(fileScanner.nextLine()); } catch (FileNotFoundException e) { // Throw exception if the file is not found e.printStackTrace(); throw new EntitlementException(e); } return possibleCriteriaValues; } } |
...