List of usage examples for org.apache.commons.beanutils PropertyUtils getProperty
public static Object getProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
Return the value of the specified property of the specified bean, no matter which property reference format is used, with no type conversions.
For more details see PropertyUtilsBean
.
From source file:com.modelsolv.kaboom.object.beanImpl.CanonicalObjectBeanReader.java
@Override public Object getPropertyValue(Object obj, String propName) { try {/*from w w w . j a v a 2 s .c om*/ return PropertyUtils.getProperty(obj, propName); } catch (Exception e) { throw new RuntimeException("Could not retrieve value for property " + propName, e); } }
From source file:com.pasteur.ci.action.gene.CreerGeneCyanoAction.java
/** * This is the action called from the Struts framework. * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception//from www . j av a 2 s .c om * @return */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String design_gene_cyano = (String) PropertyUtils.getProperty(form, "design_gene_cyano"); boolean visib = (Boolean) PropertyUtils.getProperty(form, "visib"); GeneCyano gene_cyano = new GeneCyano(); gene_cyano.setDesign_gene_cyano(design_gene_cyano); gene_cyano.setVisib(visib); GeneCyanoDAOImplement gdaoi = new GeneCyanoDAOImplement(DAOFactory.getInstance()); gdaoi.create(gene_cyano); return mapping.findForward(SUCCESS); }
From source file:com.pasteur.ci.action.gene.EnregistreModifGeneCyanoAction.java
/** * This is the action called from the Struts framework. * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception//from w w w . ja v a 2s.c o m * @return */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int idgene_cyano = (Integer) PropertyUtils.getProperty(form, "idgene_cyano"); String design_gene_cyano = (String) PropertyUtils.getProperty(form, "design_gene_cyano"); boolean visib = (Boolean) PropertyUtils.getProperty(form, "visib"); GeneCyano gene_cyano = new GeneCyano(); gene_cyano.setIdgene_cyano(idgene_cyano); gene_cyano.setDesign_gene_cyano(design_gene_cyano); gene_cyano.setVisib(visib); GeneCyanoDAOImplement gdaoi = new GeneCyanoDAOImplement(DAOFactory.getInstance()); gdaoi.update(gene_cyano); return mapping.findForward(SUCCESS); }
From source file:com.pasteur.ci.action.creation.ExempleAction.java
/** * This is the action called from the Struts framework. * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception/*from w ww . j a v a 2s . com*/ * @return */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String list = (String) PropertyUtils.getProperty(form, "listeGenreCyano"); System.out.println(" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + list); String[] tb = list.split(","); int bk = tb.length / 3; //creer un arraylist d'objet ArrayList<Object> ligne_genre_cyanos = new ArrayList<Object>(); int cp = 0; for (int i = 0; i < bk; i++) { LigneGenreCyano ligne_genre_cyano = new LigneGenreCyano(); for (int j = 0; j < 3; j++) { if (j == 0) { //A chaque item remplir une propriete System.out.println("idgenre_cyano: " + tb[cp++]); ligne_genre_cyano.setIdcyano(Integer.parseInt(tb[cp++])); } if (j == 1) { //A chaque item remplir une propriete System.out.println("Denombrement: " + tb[cp++]); ligne_genre_cyano.setIdespece_cyano(Integer.parseInt(tb[cp++])); } if (j == 2) { //A chaque item remplir une propriete System.out.println("idespece_cyano: " + tb[cp++]); if (tb[cp++] != "") { ligne_genre_cyano.setDenombrement_esp_cyano(Integer.parseInt(tb[cp++])); } } } //Apres chaque boucle ajoute l'objet creer et remplis a l'arrayList System.out.println("---------"); ligne_genre_cyanos.add(ligne_genre_cyano); } return mapping.findForward(SUCCESS); }
From source file:com.pasteur.ci.action.type_toxine.CreerTypeToxineAction.java
/** * This is the action called from the Struts framework. * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception/* ww w .jav a 2 s . c o m*/ * @return */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String design_toxine = (String) PropertyUtils.getProperty(form, "design_toxine"); double conc_toxine = (Double) PropertyUtils.getProperty(form, "conc_toxine"); boolean visible = (Boolean) PropertyUtils.getProperty(form, "visible"); TypeToxine type_toxine = new TypeToxine(); type_toxine.setDesign_toxine(design_toxine); type_toxine.setVisible(visible); TypeToxineDAOImplement gdaoi = new TypeToxineDAOImplement(DAOFactory.getInstance()); gdaoi.create(type_toxine); return mapping.findForward(SUCCESS); }
From source file:com.pasteur.ci.action.type_toxine.GestionModifPageTypeToxineAction.java
/** * This is the action called from the Struts framework. * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception//ww w .j a va 2 s.co m * @return */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int comId = (Integer) PropertyUtils.getProperty(form, "idtype_toxine"); TypeToxine type_toxine = new TypeToxine(); type_toxine.setIdtype_toxine(comId); TypeToxineDAOImplement cdaoi = new TypeToxineDAOImplement(DAOFactory.getInstance()); type_toxine = (TypeToxine) cdaoi.find(type_toxine); request.setAttribute("tyToxi_trouve", type_toxine); return mapping.findForward(SUCCESS); }
From source file:com.prashsoft.javakiva.KivaUtil.java
public static Object getBeanProperty(Object bean, String name) { Object beanProperty = null;//from w w w . ja va2s . co m try { beanProperty = PropertyUtils.isReadable(bean, name) ? PropertyUtils.getProperty(bean, name) : null; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return beanProperty; }
From source file:com.pasteur.ci.action.type_toxine.EnregistreModifTypeToxineAction.java
/** * This is the action called from the Struts framework. * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception/*from ww w . j a v a2 s . c o m*/ * @return */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int idtype_toxine = (Integer) PropertyUtils.getProperty(form, "idtype_toxine"); String design_toxine = (String) PropertyUtils.getProperty(form, "design_toxine"); double conc_toxine = (Double) PropertyUtils.getProperty(form, "conc_toxine"); boolean visible = (Boolean) PropertyUtils.getProperty(form, "visible"); TypeToxine toxine = new TypeToxine(); toxine.setIdtype_toxine(idtype_toxine); toxine.setDesign_toxine(design_toxine); toxine.setVisible(visible); TypeToxineDAOImplement gdaoi = new TypeToxineDAOImplement(DAOFactory.getInstance()); gdaoi.update(toxine); return mapping.findForward(SUCCESS); }
From source file:com.esofthead.mycollab.reporting.BeanDataSource.java
@Override public Object getFieldValue(JRField jrField) throws JRException { try {//w w w. j ava 2 s. c o m String fieldName = jrField.getName(); return PropertyUtils.getProperty(currentRecord, fieldName); } catch (Exception e) { throw new JRException(e); } }
From source file:com.pasteur.ci.action.type_gene_cyano.GestionModifPageTypeGeneCyanoAction.java
/** * This is the action called from the Struts framework. * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception/* www. j av a 2s. c o m*/ * @return */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int comId = (Integer) PropertyUtils.getProperty(form, "idtyp_gene_cyano"); TypeGeneCyano typ_gene_cyano = new TypeGeneCyano(); typ_gene_cyano.setIdtyp_gene_cyano(comId); TypeGeneCyanoDAOImplement cdaoi = new TypeGeneCyanoDAOImplement(DAOFactory.getInstance()); typ_gene_cyano = (TypeGeneCyano) cdaoi.find(typ_gene_cyano); request.setAttribute("tygeneCyan_trouve", typ_gene_cyano); return mapping.findForward(SUCCESS); }