001 package com.khubla.pragmatach.framework.controller; 002 003 import java.util.Map; 004 import java.util.Map.Entry; 005 006 import org.apache.commons.beanutils.BeanUtils; 007 008 import com.khubla.pragmatach.framework.api.PragmatachException; 009 010 /** 011 * @author tome 012 */ 013 public class ControllerBeanUtil { 014 public static void populateController( 015 PragmatachController pragmatachController, 016 Map<String, String> fieldValues) throws PragmatachException { 017 try { 018 if (null != fieldValues) { 019 for (final Entry<String, String> entry : fieldValues.entrySet()) { 020 /* 021 * set the fields 022 */ 023 BeanUtils.setProperty(pragmatachController, entry.getKey(), 024 entry.getValue()); 025 } 026 } 027 } catch (final Exception e) { 028 throw new PragmatachException("Exception in populateController", e); 029 } 030 } 031 }