本文整理汇总了Java中org.apache.commons.beanutils.DynaBean.get方法的典型用法代码示例。如果您正苦于以下问题:Java DynaBean.get方法的具体用法?Java DynaBean.get怎么用?Java DynaBean.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.beanutils.DynaBean
的用法示例。
在下文中一共展示了DynaBean.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchByName
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
public ActionForward searchByName(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
DynaBean lazyForm = (DynaBean) form;
String name = (String)lazyForm.get("search");
String last_name="",first_name="";
if (name != null && !name.equals("")) {
if (name.indexOf(',') < 0) {
last_name = name;
} else {
name = name.substring(0, name.indexOf(','));
first_name = name.substring(name.indexOf(',') + 1, name.length());
}
}
List<ProfessionalSpecialist> referrals = psDao.findByFullName(last_name, first_name);
request.setAttribute("referrals", referrals);
request.setAttribute("searchBy", "searchByName");
return mapping.findForward("list");
}
示例2: addRole
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
public ActionForward addRole(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DynaBean lazyForm = (DynaBean) form;
Site site = (Site) lazyForm.get("site");
String roleId = request.getParameter("roleId");
String roleType = request.getParameter("roleType");
SuperSiteUtil superSiteUtil = (SuperSiteUtil) SpringUtils.getBean("superSiteUtil");
SiteRoleMpgDao siteRoleMpgDao = SpringUtils.getBean(SiteRoleMpgDao.class);
if(roleType!=null)
{
if(roleType.equalsIgnoreCase("access"))
siteRoleMpgDao.addAccessRoleToSite(site.getId(), Integer.parseInt(roleId));
else if(roleType.equalsIgnoreCase("admit_discharge"))
siteRoleMpgDao.addAdmitDischargeRoleToSite(site.getId(), Integer.parseInt(roleId));
}
request.setAttribute("siteId", site.getId()+"");
lazyForm.set("site", site);
return mapping.findForward("details");
}
示例3: deleteRole
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
public ActionForward deleteRole(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DynaBean lazyForm = (DynaBean) form;
Site site = (Site) lazyForm.get("site");
String roleId = request.getParameter("roleId");
String roleType = request.getParameter("roleType");
SuperSiteUtil superSiteUtil = (SuperSiteUtil) SpringUtils.getBean("superSiteUtil");
SiteRoleMpgDao siteRoleMpgDao = SpringUtils.getBean(SiteRoleMpgDao.class);
if(roleType!=null)
{
if(roleType.equalsIgnoreCase("access"))
siteRoleMpgDao.deleteAccessRoleFromSite(site.getId(), Integer.parseInt(roleId));
else if(roleType.equalsIgnoreCase("admit_discharge"))
siteRoleMpgDao.deleteAdmitDischargeRoleToSite(site.getId(), Integer.parseInt(roleId));
}
request.setAttribute("siteId", site.getId()+"");
lazyForm.set("site", site);
return mapping.findForward("details");
}
示例4: buildIdentityFromFK
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Builds an identity object for the specified foreign key using the foreignkey column values
* of the supplied bean.
*
* @param owningTable The table owning the foreign key
* @param fk The foreign key
* @param bean The bean
* @return The identity
*/
private Identity buildIdentityFromFK(Table owningTable, ForeignKey fk, DynaBean bean)
{
Identity identity = new Identity(fk.getForeignTable(), getFKName(owningTable, fk));
for (int idx = 0; idx < fk.getReferenceCount(); idx++)
{
Reference reference = (Reference)fk.getReference(idx);
Object value = bean.get(reference.getLocalColumnName());
if (value == null)
{
return null;
}
identity.setColumnValue(reference.getForeignColumnName(), value);
}
return identity;
}
示例5: getPropertyValue
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Determines the value of the bean's property that has the given name. Depending on the
* case-setting of the current builder, the case of teh name is considered or not.
*
* @param bean The bean
* @param propName The name of the property
* @return The value
*/
protected Object getPropertyValue(DynaBean bean, String propName)
{
if (getPlatform().isDelimitedIdentifierModeOn())
{
return bean.get(propName);
}
else
{
DynaProperty[] props = bean.getDynaClass().getDynaProperties();
for (int idx = 0; idx < props.length; idx++)
{
if (propName.equalsIgnoreCase(props[idx].getName()))
{
return bean.get(props[idx].getName());
}
}
throw new IllegalArgumentException("The bean has no property with the name "+propName);
}
}
示例6: assertEquals
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Compares the specified attribute value of the given bean with the expected object.
*
* @param expected The expected object
* @param bean The bean
* @param attrName The attribute name
*/
protected void assertEquals(Object expected, Object bean, String attrName)
{
DynaBean dynaBean = (DynaBean)bean;
Object value = dynaBean.get(attrName);
if ((value instanceof byte[]) && !(expected instanceof byte[]) && (dynaBean instanceof SqlDynaBean))
{
SqlDynaClass dynaClass = (SqlDynaClass)((SqlDynaBean)dynaBean).getDynaClass();
Column column = ((SqlDynaProperty)dynaClass.getDynaProperty(attrName)).getColumn();
if (TypeMap.isBinaryType(column.getTypeCode()))
{
value = new BinaryObjectsHelper().deserialize((byte[])value);
}
}
if (expected == null)
{
assertNull(value);
}
else
{
assertEquals(expected, value);
}
}
示例7: format
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Formats the input object based on the layout specified in the ColumnModel.
*/
private static String format(Object value, DynaBean columnModel) {
try {
String layout = (String) columnModel.get("layout");
if ("[hh:mm]".equals(layout))
return decimal2hmm(value);
} catch (Exception e) {
}
return value != null ? value.toString() : "";
}
示例8: format
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Formats the input object based on the layout specified in the
* ColumnModel.
*/
private static String format(Object value, DynaBean columnModel) {
try {
String layout = (String) columnModel.get("layout");
if (value != null && value instanceof Double) {
return Formatter.format((Double) value);
} else {
if ("[hh:mm]".equals(layout)) {
return decimal2hmm(value);
}
}
} catch (Exception e) {
}
return value != null ? value.toString() : "";
}
示例9: searchByNo
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
public ActionForward searchByNo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
DynaBean lazyForm = (DynaBean) form;
String referralNo = (String)lazyForm.get("search");
List<ProfessionalSpecialist> referrals = psDao.findByReferralNo(referralNo);
request.setAttribute("referrals", referrals);
request.setAttribute("searchBy", "searchByNo");
return mapping.findForward("list");
}
示例10: searchBySpecialty
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
public ActionForward searchBySpecialty(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
DynaBean lazyForm = (DynaBean) form;
String specialty = (String)lazyForm.get("search");
List<ProfessionalSpecialist> referrals = psDao.findBySpecialty(specialty);
request.setAttribute("referrals", referrals);
request.setAttribute("searchBy", "searchBySpecialty");
return mapping.findForward("list");
}
示例11: addDynaClasspathEntries
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Adds the classpath entries to .classpath file from the modules in the Vector<DynaBean>
*
*/
private void addDynaClasspathEntries(Vector<DynaBean> dModulesToInstall) throws Exception {
if (!(new File(obDir + "/.classpath").exists())) {
log4j.info("No " + obDir + "/.classpath file");
return;
}
log4j.info("Adding .claspath entries");
final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
final DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
final Document doc = docBuilder.parse(obDir + "/.classpath");
for (final DynaBean module : dModulesToInstall) {
final String dir = "modules/" + (String) module.get("JAVAPACKAGE") + "/src";
if (new File(obDir + "/" + dir).exists()) {
addClassPathEntry(doc, dir);
} else {
log4j.info(dir + " does not exist, no claspath entry added");
}
}
// Save the modified xml file to .classpath file
final Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
final FileOutputStream fout = new FileOutputStream(obDir + "/.classpath");
final StreamResult result = new StreamResult(fout);
final DOMSource source = new DOMSource(doc);
transformer.transform(source, result);
fout.close();
}
示例12: testPKColumnTypeIntegerToVarchar
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Tests the alteration of a pk column datatype change from integer to varchar.
*/
public void testPKColumnTypeIntegerToVarchar()
{
final String model1Xml =
"<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
"<database xmlns='" + DatabaseIO.DDLUTILS_NAMESPACE + "' name='roundtriptest'>\n"+
" <table name='roundtrip'>\n"+
" <column name='pk' type='INTEGER' primaryKey='true' required='true'/>\n"+
" </table>\n"+
"</database>";
final String model2Xml =
"<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
"<database xmlns='" + DatabaseIO.DDLUTILS_NAMESPACE + "' name='roundtriptest'>\n"+
" <table name='roundtrip'>\n"+
" <column name='pk' type='VARCHAR' size='20' primaryKey='true' required='true'/>\n"+
" </table>\n"+
"</database>";
createDatabase(model1Xml);
insertRow("roundtrip", new Object[] { new Integer(1) });
alterDatabase(model2Xml);
assertEquals(getAdjustedModel(),
readModelFromDatabase("roundtriptest"));
List beans = getRows("roundtrip");
DynaBean bean = (DynaBean)beans.get(0);
// Some databases (e.g. DB2) pad the string for some reason, so we manually trim it
if (bean.get("pk") instanceof String)
{
bean.set("pk", ((String)bean.get("pk")).trim());
}
assertEquals((Object)"1", beans.get(0), "pk");
}
示例13: isModuleUpdate
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Checks whether the given .obx InputStream contains an update to an already installed version.
*
* @param is
* an InputStream to the module .obx file
* @return true if the .obx represents an update to the module
* @throws Exception
* if an error occurs performing the comparison
*/
public boolean isModuleUpdate(InputStream is) throws Exception {
boolean isUpdate = false;
final Vector<DynaBean> modulesInObx = new Vector<DynaBean>();
getModulesFromObx(modulesInObx, dependencies, dbprefix, is, new HashMap<String, String>());
// don't care about merges at this stage
for (final DynaBean module : modulesInObx) {
String moduleId = (String) module.get("AD_MODULE_ID");
String moduleName = (String) module.get("NAME");
String version = (String) module.get("VERSION");
if (ImportModuleData.moduleInstalled(pool, moduleId)) {
String installedVersion = ImportModuleData.selectVersion(pool, moduleId);
VersionUtility.VersionComparator comparator = new VersionUtility.VersionComparator();
if (comparator.compare(version, installedVersion) > 0) {
isUpdate = true;
} else {
addLog(moduleName + " " + version + " is not an update to "
+ " already installed version " + installedVersion, MSG_WARN);
}
} else {
return true;
}
}
return isUpdate;
}
示例14: addSearchCode
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
public ActionForward addSearchCode(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DynaBean lazyForm = (DynaBean) form;
String quickListName = (String)lazyForm.get("quicklistname");
List codeSearch = dxresearchdao.getQuickListItems(quickListName);
dxCodeSearchBean newAddition = null;
String codeSingle = request.getParameter("codesearch");
if (codeSingle!=null && codeSingle.contains("-->")) // buggy here as user can input "-->" and press ADD button, little odds
{
newAddition = new dxCodeSearchBean();
newAddition.setType("icd9"); // ichppccode/icd10 not supported yet
newAddition.setDxSearchCode(codeSingle.split("-->")[0]);
newAddition.setDescription(codeSingle.split("-->")[1]);
}
String action = request.getParameter( "action" );
if( action != null && action.equalsIgnoreCase( "edit" ) && newAddition != null)
{
// List editingCodeList = new ArrayList();
// editingCodeList.add( newAddition );
// request.getSession().setAttribute("editingCode", editingCodeList );
// request.getSession().setAttribute("codeSearch", editingCodeList );
//editingCodeType
request.getSession().setAttribute( "editingCodeType", newAddition.getType() );
request.getSession().setAttribute( "editingCodeCode", newAddition.getDxSearchCode() );
String description = newAddition.getDescription().trim();
description = String.format( "\"%s\"", description );
request.getSession().setAttribute( "editingCodeDesc", description );
return mapping.findForward(EDIT_DESC);
}
List existcodeSearch;
if (request.getSession().getAttribute("codeSearch")!=null && ((List)(request.getSession().getAttribute("codeSearch"))).size()>0)
{
existcodeSearch = (List)(request.getSession().getAttribute("codeSearch"));
codeSearch.addAll(existcodeSearch);
}
if (newAddition!=null)
codeSearch.add(newAddition);
request.getSession().setAttribute("codeSearch", codeSearch);
return mapping.findForward(SUCCESS);
}
示例15: dyanaBeanToDependencies
import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
* Returns the dependencies in Vector<DynaBean> dynDependencies for the ad_module_id module as a
* ModuleDependency[], used by dyanaBeanToModules method
*
*/
private ModuleDependency[] dyanaBeanToDependencies(Vector<DynaBean> dynDependencies,
String ad_module_id, HashMap<String, String> enforcements) {
final ArrayList<ModuleDependency> dep = new ArrayList<ModuleDependency>();
try {
OBContext.setAdminMode();
for (final DynaBean dynModule : dynDependencies) {
if (((String) dynModule.get("AD_MODULE_ID")).equals(ad_module_id)) {
final ModuleDependency md = new ModuleDependency();
String modId = (String) dynModule.get("AD_DEPENDENT_MODULE_ID");
md.setModuleID(modId);
md.setVersionStart((String) dynModule.get("STARTVERSION"));
md.setVersionEnd((String) dynModule.get("ENDVERSION"));
md.setModuleName((String) dynModule.get("DEPENDANT_MODULE_NAME"));
// calculate enforcements, set the local one in case is editable and there is one, other
// case set the defined in the obx
OBCriteria<org.openbravo.model.ad.module.ModuleDependency> qDependentMod = OBDal
.getInstance().createCriteria(org.openbravo.model.ad.module.ModuleDependency.class);
qDependentMod
.add(Restrictions.eq(org.openbravo.model.ad.module.ModuleDependency.PROPERTY_MODULE
+ ".id", ad_module_id));
qDependentMod.add(Restrictions.eq(
org.openbravo.model.ad.module.ModuleDependency.PROPERTY_DEPENDENTMODULE + ".id",
modId));
String enforcement = null;
if (!qDependentMod.list().isEmpty()
&& qDependentMod.list().get(0).isUserEditableEnforcement()
&& qDependentMod.list().get(0).getInstanceEnforcement() != null) {
enforcement = qDependentMod.list().get(0).getInstanceEnforcement();
} else {
enforcement = (String) dynModule.get("DEPENDENCY_ENFORCEMENT");
}
if (enforcement == null || enforcement.isEmpty()) {
enforcement = "MAJOR";
}
enforcements.put(modId, enforcement);
dep.add(md);
}
}
final ModuleDependency rt[] = new ModuleDependency[dep.size()];
for (int i = 0; i < rt.length; i++) {
rt[i] = dep.get(i);
}
return rt;
} finally {
OBContext.restorePreviousMode();
}
}