當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。