当前位置: 首页>>代码示例>>Java>>正文


Java PropertyUtils.copyProperties方法代码示例

本文整理汇总了Java中org.apache.commons.beanutils.PropertyUtils.copyProperties方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtils.copyProperties方法的具体用法?Java PropertyUtils.copyProperties怎么用?Java PropertyUtils.copyProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.beanutils.PropertyUtils的用法示例。


在下文中一共展示了PropertyUtils.copyProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AnswerDTO

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
public AnswerDTO(SurveyQuestion question) {
try {
    PropertyUtils.copyProperties(this, question);
} catch (Exception e) {
    logger.error("Error occurs during creating AnswerDTO");
}

// clone options
Set<SurveyOption> optList = question.getOptions();
if (optList != null) {
    SortedSet<SurveyOption> newOptions = new TreeSet<SurveyOption>(new SurveyOptionComparator());
    for (SurveyOption option : optList) {
	SurveyOption newOption = (SurveyOption) option.clone();
	// clone does not copy the UID, here copy it back
	newOption.setUid(option.getUid());
	newOptions.add(newOption);
    }
    this.setOptions(newOptions);
}

String desc = this.getDescription();
desc = desc.replaceAll("<(.|\n)*?>", "");
this.setShortTitle(StringUtils.abbreviate(desc, SHORT_TITLE_LENGTH));

   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:AnswerDTO.java

示例2: initPage

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
AssessmentForm existForm = (AssessmentForm) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT_FORM);

AssessmentForm assessmentForm = (AssessmentForm) form;
try {
    PropertyUtils.copyProperties(assessmentForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(AssessmentConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:AuthoringAction.java

示例3: initPage

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, PeerreviewConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
PeerreviewForm existForm = (PeerreviewForm) sessionMap.get(PeerreviewConstants.ATTR_PEERREVIEW_FORM);

PeerreviewForm peerreviewForm = (PeerreviewForm) form;
try {
    PropertyUtils.copyProperties(peerreviewForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(PeerreviewConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:AuthoringAction.java

示例4: initPage

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, CommonCartridgeConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
CommonCartridgeForm existForm = (CommonCartridgeForm) sessionMap
	.get(CommonCartridgeConstants.ATTR_RESOURCE_FORM);

CommonCartridgeForm commonCartridgeForm = (CommonCartridgeForm) form;
try {
    PropertyUtils.copyProperties(commonCartridgeForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(CommonCartridgeConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:AuthoringAction.java

示例5: initPage

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, DokumaranConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
DokumaranForm existForm = (DokumaranForm) sessionMap.get(DokumaranConstants.ATTR_RESOURCE_FORM);

DokumaranForm dokumaranForm = (DokumaranForm) form;
try {
    PropertyUtils.copyProperties(dokumaranForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(DokumaranConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:AuthoringAction.java

示例6: initPage

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    * 
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   protected ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, DacoConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
DacoForm existForm = (DacoForm) sessionMap.get(DacoConstants.ATTR_DACO_FORM);

DacoForm dacoForm = (DacoForm) form;
try {
    PropertyUtils.copyProperties(dacoForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(DacoConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:AuthoringAction.java

示例7: register

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
public void register(UserToken userToken) throws Exception {

		// 检查用户名和邮箱
		this.chickUserNameExist(userToken.getUsername());
		this.chickEmailExist(userToken.getEmail());
		
		// 判定密码相同与否
		if(!(userToken.getPassword().equals(userToken.getRpassword()))){
			throw new WeiboException("两次密码不一致");
		}
		
		// 整理数据,插入数据库
		User user = new User();
		PropertyUtils.copyProperties(user, userToken);
		user.setWeibo(0);
		user.setFollow(0);
		user.setFollower(0);
		user.setDeleted((byte) 0);
		user.setStatus(DC.STATUS_NORMAL);
		user.setPassword(MD5.getMD5(user.getPassword()));
		userMapper.insertSelective(user);
	}
 
开发者ID:miracle857,项目名称:weibo,代码行数:23,代码来源:UserServiceImpl.java

示例8: initPage

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    */
   private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
ScratchieForm existForm = (ScratchieForm) sessionMap.get(ScratchieConstants.ATTR_RESOURCE_FORM);

ScratchieForm scratchieForm = (ScratchieForm) form;
try {
    PropertyUtils.copyProperties(scratchieForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(ScratchieConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:AuthoringAction.java

示例9: initPage

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, SpreadsheetConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
SpreadsheetForm existForm = (SpreadsheetForm) sessionMap.get(SpreadsheetConstants.ATTR_RESOURCE_FORM);

SpreadsheetForm spreadsheetForm = (SpreadsheetForm) form;
try {
    PropertyUtils.copyProperties(spreadsheetForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(SpreadsheetConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:AuthoringAction.java

示例10: initPage

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
TaskListForm existForm = (TaskListForm) sessionMap.get(TaskListConstants.ATTR_TASKLIST_FORM);

TaskListForm taskListForm = (TaskListForm) form;
try {
    PropertyUtils.copyProperties(taskListForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(TaskListConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:AuthoringAction.java

示例11: showConditions

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   private ActionForward showConditions(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
TaskListForm existForm = (TaskListForm) sessionMap.get(TaskListConstants.ATTR_TASKLIST_FORM);

TaskListForm taskListForm = (TaskListForm) form;
try {
    PropertyUtils.copyProperties(taskListForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

return mapping.findForward(TaskListConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:AuthoringTaskListConditionAction.java

示例12: execute

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
public void execute() throws ServiceAbortException {
    ProjectUser pu = (ProjectUser) page.getUsers().getRowData();

    for (Project p : page.projects) {
        if (p.getProjectId().equals(pu.getProjectId())) {
            page.viewHelper.setSessionValue(Constants.KEY_PROJECT, p);
        }
    }
    page.viewHelper.setSessionValue(Constants.KEY_PROJECT_USER, pu);

    User login = page.getCurrentUser();
    try {
        PropertyUtils.copyProperties(login, pu.getUser());
    } catch (Exception e) {
        throw new ApplicationFatalRuntimeException(e);
    }
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:18,代码来源:DummyMenuPage.java

示例13: find

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
@Mock
public Correspon find(Long id) throws ServiceAbortException {
    if (EX_FIND_BY_ID != null) {
        throw EX_FIND_BY_ID;
    }
    Correspon result = new Correspon();
    Correspon ret;
    if (RET_FIND != null) {
        ret = RET_FIND;
    } else {
        ret = RET_CORRESPON_MAP.get(id);
    }
    try {
        PropertyUtils.copyProperties(result, ret);
    } catch (Exception e) {
        e.printStackTrace();
        throw new AssertionFailedError(e.getMessage());
    }
    return result;
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:21,代码来源:AbstractCorresponSetupStrategyTestCase.java

示例14: toAttachment

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
@Override
public Attachment toAttachment() throws ServiceAbortException {
    Attachment a = new Attachment();
    try {
        PropertyUtils.copyProperties(a, this.attachment);
    } catch (Exception e) {
        throw new ApplicationFatalRuntimeException(e);
    }
    a.setMode(UpdateMode.NEW);
    if (a.getContent() == null) {
        a.setContent(getContent());
        a.setSourcePath(getSourcePath());
    }

    return a;
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:17,代码来源:CopiedAttachmentInfo.java

示例15: to

import org.apache.commons.beanutils.PropertyUtils; //导入方法依赖的package包/类
/** 实例化并复制属性 */
public static final <T> T to(Object orig, Class<T> clazz) {
    T bean = null;
    try {
        bean = clazz.newInstance();
        PropertyUtils.copyProperties(bean, orig);
    } catch (Exception e) {
    }
    return bean;
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:11,代码来源:InstanceUtil.java


注:本文中的org.apache.commons.beanutils.PropertyUtils.copyProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。