Java 类org.springframework.beans.BeanUtils 实例源码

项目:TITAN    文件:LinkServiceImpl.java   
/**
 * @desc 分页查询所有链路列表
 *
 * @author liuliang
 *
 * @param pageIndex 当前页
 * @param pageSize 每页条数
 * @return List<LinkBO> 链路BO集合
 * @throws Exception
 */
@Override
public List<LinkBO> getLinkList(String linkName,int pageIndex, int pageSize) throws Exception{
    //1、查询
    List<Link> linkList = null;
    if(StringUtils.isBlank(linkName)){
        linkList = linkDao.queryLinkByPage(pageIndex, pageSize);
    }else{
        linkList = linkDao.queryLinkByPage(linkName,pageIndex, pageSize);
    }
    //2、转换
    List<LinkBO> linkBOList = new ArrayList<LinkBO>();
    if((null != linkList) && (0 < linkList.size())){
        LinkBO linkBO = null;
        for(Link link:linkList){
            linkBO = new LinkBO();
            BeanUtils.copyProperties(link, linkBO);
            linkBOList.add(linkBO);
        }
    }
    //3、返回
    return linkBOList;
}
项目:lams    文件:HandlerMethodInvoker.java   
private WebDataBinder resolveModelAttribute(String attrName, MethodParameter methodParam,
        ExtendedModelMap implicitModel, NativeWebRequest webRequest, Object handler) throws Exception {

    // Bind request parameter onto object...
    String name = attrName;
    if ("".equals(name)) {
        name = Conventions.getVariableNameForParameter(methodParam);
    }
    Class<?> paramType = methodParam.getParameterType();
    Object bindObject;
    if (implicitModel.containsKey(name)) {
        bindObject = implicitModel.get(name);
    }
    else if (this.methodResolver.isSessionAttribute(name, paramType)) {
        bindObject = this.sessionAttributeStore.retrieveAttribute(webRequest, name);
        if (bindObject == null) {
            raiseSessionRequiredException("Session attribute '" + name + "' required - not found in session");
        }
    }
    else {
        bindObject = BeanUtils.instantiateClass(paramType);
    }
    WebDataBinder binder = createBinder(webRequest, bindObject, name);
    initBinder(handler, name, binder, webRequest);
    return binder;
}
项目:configx    文件:ConfigBeanFactory.java   
/**
 * 创建配置Bean
 *
 * @param propertyName               属性名
 * @param beanType                   配置Bean类型
 * @param converterType              转换器类型
 * @param configBeanPropertyResolver 属性解析器
 * @param conversionService          转换服务
 * @param <T>
 * @return
 */
public static <T> T createConfigBean(String propertyName, Class<T> beanType,
                                     Class<? extends ConfigBeanConverter> converterType,
                                     ConfigPropertyResolver configBeanPropertyResolver,
                                     ConfigBeanConversionService conversionService) {

    PropertyResolver propertyResolver = configBeanPropertyResolver.getObject();
    String propertyValue = propertyResolver.getRequiredProperty(propertyName);

    if (converterType != null && !converterType.isInterface()) {
        ConfigBeanConverter converter = BeanUtils.instantiate(converterType);
        return (T) converter.convert(propertyName, propertyValue, TypeDescriptor.valueOf(beanType));

    } else {
        return (T) conversionService.convert(propertyName, propertyValue, TypeDescriptor.valueOf(beanType));
    }
}
项目:Mastering-Microservices-with-Java-9-Second-Edition    文件:BookingController.java   
/**
 * Add booking with the specified information.
 *
 * @param bookingVO
 * @return A non-null booking.
 */
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Booking> add(@RequestBody BookingVO bookingVO) {
    logger.info(String.format("booking-service add() invoked: %s for %s", bookingService.getClass().getName(), bookingVO.getName()));
    System.out.println(bookingVO);
    Booking booking = new Booking(null, null, null, null, null, null, null);
    BeanUtils.copyProperties(bookingVO, booking);
    try {
        bookingService.add(booking);
    } catch (Exception ex) {
        logger.log(Level.WARNING, "Exception raised add Booking REST Call {0}", ex);
        return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
    }
    return new ResponseEntity<>(HttpStatus.CREATED);
}
项目:document-management-store-app    文件:DocumentContentVersionHalResource.java   
public DocumentContentVersionHalResource(DocumentContentVersion documentContentVersion) {
    BeanUtils.copyProperties(documentContentVersion, this);

    add(linkTo(methodOn(StoredDocumentController.class)
            .getMetaData(documentContentVersion.getStoredDocument().getId())).withRel("document"));

    add(linkTo(methodOn(DocumentContentVersionController.class).getDocumentContentVersionDocument(
            documentContentVersion.getStoredDocument().getId(),
            documentContentVersion.getId())).withRel("self"));

    add(linkTo(methodOn(DocumentContentVersionController.class).getDocumentContentVersionDocumentBinary(
            documentContentVersion.getStoredDocument().getId(),
            documentContentVersion.getId())).withRel("binary"));

    add(linkTo(methodOn(DocumentContentVersionController.class).getDocumentContentVersionDocumentPreviewThumbnail(
            documentContentVersion.getStoredDocument().getId(),
        documentContentVersion.getId())).withRel("thumbnail"));
}
项目:sucok-framework    文件:QueryResult.java   
public QueryResult<T> treeSorted(String keyField, String parentKeyField, Object rootValue) {
    try {
        List<T> list = getData();
        if (list.size() <= 0) {
            return this;
        }
        Class<?> itemClass = list.get(0).getClass();
        PropertyDescriptor keyProp = BeanUtils.getPropertyDescriptor(itemClass, keyField);
        PropertyDescriptor parentKeyProp = BeanUtils.getPropertyDescriptor(itemClass, parentKeyField);
        List<T> newList = new ArrayList<>(list.size());
        addTreeNode(newList, list, rootValue, keyProp, parentKeyProp);
        setData(newList);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return this;
}
项目:Yidu    文件:ArticleListAction.java   
@Override
protected void loadData() {
    ArticleSearchBean searchBean = new ArticleSearchBean();
    BeanUtils.copyProperties(this, searchBean, new String[] { "articleno" });
    searchBean.setPageType(ArticleSearchBean.PageType.adminPage);
    if (StringUtils.isEmpty(pagination.getSortColumn())) {
        pagination.setSortColumn("lastupdate");
        pagination.setSortOrder("DESC");
    }
    // 总件数设置
    pagination.setPreperties(articleService.getCount(searchBean));
    searchBean.setPagination(pagination);
    articleList = articleService.find(searchBean);
    // Setting number of records in the particular page
    pagination.setPageRecords(articleList.size());
}
项目:Yidu    文件:ChapterEditAction.java   
@Override
protected void loadData() {
    logger.debug("loadData start.");
    // 初始化种别下拉列表选项
    initCollections(new String[] { "collectionProperties.chapter.isvip" });
    if (chapterno == 0 && articleno == 0) {
        addActionError(getText("errors.unknown"));
        return;
    }

    // 编辑
    if (chapterno != 0) {
        TChapter chapter = chapterService.getByNo(chapterno);
        BeanUtils.copyProperties(chapter, this);
        content = Utils.getContext(chapter, false);
    } else {
        // 追加的话取小说信息
        TArticle article = articleService.getByNo(articleno);
        BeanUtils.copyProperties(article, this);
    }
    logger.debug("loadData normally end.");
}
项目:sporticus    文件:IUserProfile.java   
static IUserProfile COPY(final IUserProfile from, final IUserProfile to) {
    if(from == null) {
        return null;
    }
    if(to == null) {
        return null;
    }
    BeanUtils.copyProperties(from, to);
    if(from.isEnabled() != null) {
        to.setEnabled(from.isEnabled());
    }
    if(from.isVerified() != null) {
        to.setVerified(from.isVerified());
    }

    return to;
}
项目:sporticus    文件:IGroupMember.java   
static IGroupMember COPY(final IGroupMember from, final IGroupMember to) {
    if (from == null) {
        return null;
    }
    if (to == null) {
        return null;
    }
    BeanUtils.copyProperties(from, to);
    if (from.isEnabled() != null) {
        to.setEnabled(from.isEnabled());
    }
    if (from.getStatus() != null) {
        to.setStatus(from.getStatus());
    }
    return to;
}
项目:Mastering-Microservices-with-Java-9-Second-Edition    文件:UserController.java   
/**
 * Add user with the specified information.
 *
 * @param userVO
 * @return A non-null user.
 */
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<User> add(@RequestBody UserVO userVO) {
    logger.info(String.format("user-service add() invoked: %s for %s", userService.getClass().getName(), userVO.getName()));
    System.out.println(userVO);
    User user = new User(null, null, null, null, null);
    BeanUtils.copyProperties(userVO, user);
    try {
        userService.add(user);
    } catch (Exception ex) {
        logger.log(Level.WARNING, "Exception raised add User REST Call {0}", ex);
        return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
    }
    return new ResponseEntity<>(HttpStatus.CREATED);
}
项目:FastBootWeixin    文件:WxApiExecutor.java   
private Object getObjectBody(WxApiMethodInfo wxApiMethodInfo, Object[] args) {
    MethodParameter methodParameter = wxApiMethodInfo.getMethodParameters().stream()
            .filter(p -> !BeanUtils.isSimpleValueType(p.getParameterType()) || p.hasParameterAnnotation(WxApiBody.class))
            .findFirst().orElse(null);
    if (methodParameter == null) {
        throw new WxAppException("没有可处理的参数");
    }
    // 不是简单类型
    if (!BeanUtils.isSimpleValueType(methodParameter.getParameterType())) {
        // 暂时只支持json
        return args[methodParameter.getParameterIndex()];
    }
    if (args[methodParameter.getParameterIndex()] != null) {
        return args[methodParameter.getParameterIndex()].toString();
    } else {
        return "";
    }
}
项目:gemini.blueprint    文件:AbstractOsgiBundleApplicationContext.java   
/**
 * Takes care of enforcing the relationship between exporter and importers.
 * 
 * @param beanFactory
 */
private void enforceExporterImporterDependency(ConfigurableListableBeanFactory beanFactory) {
    Object instance = null;

    instance = AccessController.doPrivileged(new PrivilegedAction<Object>() {

        public Object run() {
            // create the service manager
            ClassLoader loader = AbstractOsgiBundleApplicationContext.class.getClassLoader();
            try {
                Class<?> managerClass = loader.loadClass(EXPORTER_IMPORTER_DEPENDENCY_MANAGER);
                return BeanUtils.instantiateClass(managerClass);
            } catch (ClassNotFoundException cnfe) {
                throw new ApplicationContextException("Cannot load class " + EXPORTER_IMPORTER_DEPENDENCY_MANAGER,
                        cnfe);
            }
        }
    });

    // sanity check
    Assert.isInstanceOf(BeanFactoryAware.class, instance);
    Assert.isInstanceOf(BeanPostProcessor.class, instance);
    ((BeanFactoryAware) instance).setBeanFactory(beanFactory);
    beanFactory.addBeanPostProcessor((BeanPostProcessor) instance);
}
项目:YiDu-Novel    文件:ChapterEditAction.java   
@Override
protected void loadData() {
    logger.debug("loadData start.");
    // 初始化种别下拉列表选项
    initCollections(new String[] { "collectionProperties.chapter.isvip" });
    if (chapterno == 0 && articleno == 0) {
        addActionError(getText("errors.unknown"));
        return;
    }

    // 编辑
    if (chapterno != 0) {
        TChapter chapter = chapterService.getByNo(chapterno);
        BeanUtils.copyProperties(chapter, this);
        content = Utils.getContext(chapter, false);
    } else {
        // 追加的话取小说信息
        TArticle article = articleService.getByNo(articleno);
        BeanUtils.copyProperties(article, this);
    }
    logger.debug("loadData normally end.");
}
项目:YiDu-Novel    文件:BlockEditAction.java   
/**
 * 
 * <p>
 * 保存画面的内容
 * </p>
 * 
 * @return
 */
public String save() {
    logger.debug("save start.");
    // 初始化下拉列表选项
    initCollections(new String[] { "collectionProperties.article.category", "collectionProperties.block.type",
            "collectionProperties.block.target", "collectionProperties.block.sortCol",
            "collectionProperties.boolean" });
    TSystemBlock systemBlock = new TSystemBlock();
    if (blockno != 0) {
        systemBlock = systemBlockService.getByNo(blockno);
    } else {
        systemBlock.setDeleteflag(false);
    }
    BeanUtils.copyProperties(this, systemBlock);
    systemBlock.setModifytime(new Date());
    systemBlock.setModifyuserno(LoginManager.getLoginUser().getUserno());
    systemBlockService.save(systemBlock);
    logger.debug("save normally end.");
    return REDIRECT;
}
项目:lams    文件:AbstractJaxWsServiceExporter.java   
private WebServiceFeature convertWebServiceFeature(Object feature) {
    Assert.notNull(feature, "WebServiceFeature specification object must not be null");
    if (feature instanceof WebServiceFeature) {
        return (WebServiceFeature) feature;
    }
    else if (feature instanceof Class) {
        return (WebServiceFeature) BeanUtils.instantiate((Class<?>) feature);
    }
    else if (feature instanceof String) {
        try {
            Class<?> featureClass = getBeanClassLoader().loadClass((String) feature);
            return (WebServiceFeature) BeanUtils.instantiate(featureClass);
        }
        catch (ClassNotFoundException ex) {
            throw new IllegalArgumentException("Could not load WebServiceFeature class [" + feature + "]");
        }
    }
    else {
        throw new IllegalArgumentException("Unknown WebServiceFeature specification type: " + feature.getClass());
    }
}
项目:YiDu-Novel    文件:ChapterOrderAction.java   
@Override
protected void loadData() {
    logger.debug("loadData start.");
    // 初始化种别下拉列表选项
    initCollections(new String[] { "collectionProperties.chapter.isvip" });
    if (chapterno == 0 && articleno == 0) {
        addActionError(getText("errors.unknown"));
        return;
    }

    // 编辑
    if (chapterno != 0) {
        TChapter chapter = chapterService.getByNo(chapterno);
        BeanUtils.copyProperties(chapter, this);
        content = Utils.getContext(chapter, false);
    }
    logger.debug("loadData normally end.");
}
项目:sell    文件:OrderServiceImpl.java   
@Override
@Transactional
public OrderDto finish(OrderDto orderDto) {

    // 判断订单状态
    if (!orderDto.getOrderStatus().equals(OrderStatusEnum.NEW.getCode())) {
        log.error("【完结订单】订单状态不正确,orderId={}, orderStatus={}", orderDto.getOrderId(), orderDto.getOrderStatus());
        throw new SellException(ResultEnum.ORDER_STATUS_ERROR);
    }

    // 修改订单状态
    orderDto.setOrderStatus(OrderStatusEnum.FINISHED.getCode());
    OrderMaster orderMaster = new OrderMaster();
    BeanUtils.copyProperties(orderDto, orderMaster);
    OrderMaster updateResult = orderMasterRepository.save(orderMaster);
    if (updateResult == null) {
        log.error("【完结订单】更新失败,orderMaster={}", orderMaster);
        throw new SellException(ResultEnum.ORDER_UPDATE_FAIL);
    }

    return orderDto;
}
项目:Yidu    文件:ArticleEditAction.java   
@Override
protected void loadData() {
    logger.debug("loadData start.");
    // 初始化类别下拉列表选项
    initCollections(new String[] { "collectionProperties.article.category",
            "collectionProperties.article.fullflag", "collectionProperties.article.firstflag",
            "collectionProperties.article.permission" });

    // 编辑
    if (articleno != 0) {
        TArticle article = articleService.getByNo(articleno);
        if (article == null) {
            addActionError(getText("errors.not.exsits.article"));
            return;
        }
        if (!checkRight(article)) {
            addActionError(getText("errors.right"));
            return;
        }

        BeanUtils.copyProperties(article, this);

    }
    logger.debug("loadData normally end.");
}
项目:Yidu    文件:UserEditAction.java   
/**
 * <p>
 * 保存画面的内容
 * </p>
 * 
 * @return
 * @throws Exception
 */
public String save() {
    logger.debug("save start.");
    TUser user = new TUser();
    if (userno != 0) {
        user = userService.getByNo(userno);
    } else {
        user.setRegdate(new Date());
        user.setDeleteflag(false);
    }
    BeanUtils.copyProperties(this, user, new String[] { "regdate", "lastlogin", "password" });

    if (StringUtils.isNotEmpty(password)) {
        user.setPassword(Utils.convert2MD5(password));
    }
    user.setActivedflag(true);
    user.setModifytime(new Date());
    user.setModifyuserno(LoginManager.getLoginUser().getUserno());
    userService.save(user);
    logger.debug("save normally end.");
    return REDIRECT;
}
项目:gemini.blueprint    文件:ExtenderConfiguration.java   
protected void addDefaultDependencyFactories() {
    boolean debug = log.isDebugEnabled();

    // default JDK 1.4 processor
    dependencyFactories.add(0, new MandatoryImporterDependencyFactory());

    // load through reflection the dependency and injection processors if running on JDK 1.5 and annotation
    // processing is enabled
    if (processAnnotation) {
        // dependency processor
        Class<?> annotationProcessor = null;
        try {
            annotationProcessor =
                    Class.forName(ANNOTATION_DEPENDENCY_FACTORY, false, ExtenderConfiguration.class
                            .getClassLoader());
        } catch (ClassNotFoundException cnfe) {
            log.warn("Gemini Blueprint extensions bundle not present, annotation processing disabled.");
            log.debug("Gemini Blueprint extensions bundle not present, annotation processing disabled.", cnfe);
            return;
        }
        Object processor = BeanUtils.instantiateClass(annotationProcessor);
        Assert.isInstanceOf(OsgiServiceDependencyFactory.class, processor);
        dependencyFactories.add(1, (OsgiServiceDependencyFactory) processor);

        if (debug)
            log.debug("Succesfully loaded annotation dependency processor [" + ANNOTATION_DEPENDENCY_FACTORY + "]");

        // add injection processor (first in line)
        postProcessors.add(0, new OsgiAnnotationPostProcessor());
        log.info("Gemini Blueprint extensions annotation processing enabled");
    } else {
        if (debug) {
            log.debug("Gemini Blueprint extensions annotation processing disabled; [" + ANNOTATION_DEPENDENCY_FACTORY
                    + "] not loaded");
        }
    }

}
项目:X-mall    文件:UserServiceImpl.java   
@Override
public ServerResponse<List<UserVo>> getUsers() {
    List<User> userList = userMapper.selectAll();
    List<UserVo> userVoList = new ArrayList<>();
    for (User user : userList) {
        UserVo userVo = new UserVo();
        BeanUtils.copyProperties(user, userVo);
        userVoList.add(userVo);
    }
    return ServerResponse.createBySuccess("获取用户成功", userVoList);
}
项目:xq_seckill_microservice    文件:CrawlerServiceImpl.java   
@Override
@Transactional
public void saveInitializeData(byte[] dataArray) throws Exception {
    try {
        EstateItemDTO dto = ProtoStuffUtil.deserialize(dataArray, EstateItemDTO.class);
        EstateItemModel model = new EstateItemModel();

        // 先查看数据库是否已存在该记录
        dataArray = estateFeignClient.findItemByHouseCode(dto.getHouseCode());
        if (dataArray != null) {
            model = ProtoStuffUtil.deserialize(dataArray, EstateItemModel.class);
            BeanUtils.copyProperties(dto, model, "id");
            // 先删除原有图片
            estateFeignClient.deleteImagesByHouseCode(dto.getHouseCode());
        } else {
            BeanUtils.copyProperties(dto, model);
        }
        // 保存房源条目
        estateFeignClient.saveItem(ProtoStuffUtil.serialize(model));
        // 保存房源图片
        saveImages(dto);

        ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
        resolver.setCacheable(true);
        resolver.setCharacterEncoding(AppConstants.CHARSET_UTF8);
        resolver.setTemplateMode(StandardTemplateModeHandlers.LEGACYHTML5.getTemplateModeName());
        resolver.setPrefix("templates/");//模板所在目录
        resolver.setSuffix(".html");//模板文件后缀
        //构造上下文(Model)

        Context context = new Context(Locale.CHINA, BeanMapUtil.beanToMap(dto));
        GenParam genParam = new GenParam(resolver, context, "estate_detailUI", appProperties.getProducesPath(), dto.getHouseCode());
        // 生成静态页面
        PageGenerator.staticPage(genParam);
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    }

}
项目:eventapis    文件:CreateOrderCommand.java   
@RequestMapping(value = "/order/v1/create", method = RequestMethod.POST)
public EventKey execute(@RequestBody @Valid CreateOrderCommandDto dto) throws Exception {

    OrderCreatedEvent orderCreatedEvent = new OrderCreatedEvent();
    BeanUtils.copyProperties(dto,orderCreatedEvent);

    EventKey eventKey = eventRepository.recordAndPublish(orderCreatedEvent);
    return eventKey;
}
项目:exam    文件:ExamSectionQuestion.java   
ExamSectionQuestion copyWithAnswers() {
    ExamSectionQuestion esqCopy = new ExamSectionQuestion();
    BeanUtils.copyProperties(this, esqCopy, "id", "options", "essayAnswer", "clozeTestAnswer");
    // This is a little bit tricky. Need to map the original question options with copied ones so they can be
    // associated with both question and exam section question options :)
    Map<Long, MultipleChoiceOption> optionMap = new HashMap<>();
    Question blueprint = question.copy(optionMap);
    blueprint.setParent(question);
    blueprint.save();
    optionMap.forEach((k, optionCopy) -> {
        optionCopy.setQuestion(blueprint);
        optionCopy.save();
        Optional<ExamSectionQuestionOption> esqoo = options.stream()
                .filter(o -> o.getOption().getId().equals(k))
                .findFirst();
        if (esqoo.isPresent()) {
            ExamSectionQuestionOption esqo = esqoo.get();
            ExamSectionQuestionOption esqoCopy = esqo.copyWithAnswer();
            esqoCopy.setOption(optionCopy);
            esqCopy.getOptions().add(esqoCopy);
        } else {
            Logger.error("Failed to copy a multi-choice question option!");
            throw new RuntimeException();
        }
    });
    esqCopy.setQuestion(blueprint);
    // Essay Answer
    if (essayAnswer != null) {
        esqCopy.setEssayAnswer(essayAnswer.copy());
    }
    if (clozeTestAnswer != null) {
        esqCopy.setClozeTestAnswer(clozeTestAnswer.copy());
    }
    return esqCopy;
}
项目:springboot-shiro-cas-mybatis    文件:RegisteredServiceThemeBasedViewResolver.java   
/**
 * Uses the viewName and the theme associated with the service.
 * being requested and returns the appropriate view.
 * @param viewName the name of the view to be resolved
 * @return a theme-based UrlBasedView
 * @throws Exception an exception
 */
@Override
protected AbstractUrlBasedView buildView(final String viewName) throws Exception {
    final RequestContext requestContext = RequestContextHolder.getRequestContext();
    final WebApplicationService service = WebUtils.getService(requestContext);
    final RegisteredService registeredService = this.servicesManager.findServiceBy(service);

    final String themeId = service != null && registeredService != null
            && registeredService.getAccessStrategy().isServiceAccessAllowed()
            && StringUtils.hasText(registeredService.getTheme()) ? registeredService.getTheme() : defaultThemeId;

    final String themePrefix = String.format("%s/%s/ui/", pathPrefix, themeId);
    LOGGER.debug("Prefix {} set for service {} with theme {}", themePrefix, service, themeId);

    //Build up the view like the base classes do, but we need to forcefully set the prefix for each request.
    //From UrlBasedViewResolver.buildView
    final InternalResourceView view = (InternalResourceView) BeanUtils.instantiateClass(getViewClass());
    view.setUrl(themePrefix + viewName + getSuffix());
    final String contentType = getContentType();
    if (contentType != null) {
        view.setContentType(contentType);
    }
    view.setRequestContextAttribute(getRequestContextAttribute());
    view.setAttributesMap(getAttributesMap());

    //From InternalResourceViewResolver.buildView
    view.setAlwaysInclude(false);
    view.setExposeContextBeansAsAttributes(false);
    view.setPreventDispatchLoop(true);

    LOGGER.debug("View resolved: {}", view.getUrl());

    return view;
}
项目:exam    文件:AutoEvaluationConfig.java   
@Transient
public AutoEvaluationConfig copy() {
    AutoEvaluationConfig clone = new AutoEvaluationConfig();
    BeanUtils.copyProperties(this, clone, "id", "exam", "gradeEvaluations");
    for (GradeEvaluation ge : gradeEvaluations) {
        clone.getGradeEvaluations().add(ge.copy());
    }
    return clone;
}
项目:configx    文件:EnableConfigServiceImportSelector.java   
private List<ConfigBeanConverter> instantiateConverters(List<Class<?>> types) {
    List<ConfigBeanConverter> converters = new ArrayList<>();
    for (Class<?> type : types) {
        ConfigBeanConverter converter = (ConfigBeanConverter) BeanUtils.instantiate(type);
        converters.add(converter);
    }
    return converters;
}
项目:document-management-store-app    文件:FolderHalResource.java   
public FolderHalResource(Folder folder) {
    BeanUtils.copyProperties(folder, this);
    if (folder.getStoredDocuments() != null) {
        Resources<StoredDocumentHalResource> itemResources =
                new Resources<>(folder.getStoredDocuments()
                        .stream()
                        .map(StoredDocumentHalResource::new)
                    .collect(Collectors.toList()));
        embedResource("items", itemResources);
    }
    add(linkTo(methodOn(FolderController.class).get(folder.getId())).withSelfRel());
}
项目:document-management-store-app    文件:StoredDocumentAuditEntryHalResource.java   
public StoredDocumentAuditEntryHalResource(StoredDocumentAuditEntry storedDocumentAuditEntry) {
    BeanUtils.copyProperties(storedDocumentAuditEntry, this);
    setType(storedDocumentAuditEntry.getClass().getSimpleName());
    add(linkTo(methodOn(StoredDocumentController.class).getMetaData(storedDocumentAuditEntry.getStoredDocument().getId())).withRel("document"));
    if (storedDocumentAuditEntry instanceof DocumentContentVersionAuditEntry) {
        DocumentContentVersionAuditEntry documentContentVersionAuditEntry = (DocumentContentVersionAuditEntry) storedDocumentAuditEntry;
        add(linkTo(methodOn(DocumentContentVersionController.class)
                .getDocumentContentVersionDocument(
                        storedDocumentAuditEntry.getStoredDocument().getId(),
                        documentContentVersionAuditEntry.getDocumentContentVersion().getId())).withRel("documentContentVersion"));
    }
}
项目:TITAN    文件:AutomaticTaskController.java   
/**
 * @desc  删除
 *
 * @author liuliang
 *
 * @param automaticTaskBO
 * @param br
 * @return
 */
@RequestMapping(value = "/del")
@ResponseBody
public Result del(@Validated(Groups.Query.class) AutomaticTaskBO automaticTaskBO,BindingResult br) {
    Result result = new Result();
    //参数校验
    Result validateResult = ValidatorUtil.getValidResult(br);
    if(ResultUtil.isfail(validateResult)) {
        return ResultUtil.copy(validateResult, result);
    }
    //删除
    try {
        AutomaticTask automaticTask = automaticTaskService.getDataDetail(automaticTaskBO.getAutomaticTaskId());
        int delResult = automaticTaskService.del(automaticTaskBO.getAutomaticTaskId());
        if(0 < delResult) {
            // 同步定时任务
            AutomaticTaskBO obj = new AutomaticTaskBO();
            BeanUtils.copyProperties(automaticTask, obj);
            this.syncAutomaticTask(obj, TaskSyncTypeEnum.DELETE.value);

            return ResultUtil.success(result);
        }
    } catch (Exception e) {
        logger.error("删除数据异常,params:{}",automaticTaskBO.toString(),e);
    }
    //失败返回
    return ResultUtil.fail(ErrorCode.UPDATE_DB_ERROR,result);
}
项目:rocket-console    文件:MessageView.java   
/**from Message**/

    public static MessageView fromMessageExt(MessageExt messageExt) {
        MessageView messageView = new MessageView();
        BeanUtils.copyProperties(messageExt, messageView);
        if (messageExt.getBody() != null) {
            messageView.setMessageBody(new String(messageExt.getBody(), Charsets.UTF_8));
        }
        return messageView;
    }
项目:TITAN    文件:AutomaticTaskServiceImpl.java   
/**
 * 分页查询所有数据列表
 *
 * @author liuliang
 *
 * @param pageIndex 当前页
 * @param pageSize 每页条数
 * @return List<AutomaticTask> 数据集合
 * @throws Exception
 */
@Override
public List<AutomaticTaskBO> getDataList(int pageIndex, int pageSize)throws Exception {
    List<AutomaticTask> list = automaticTaskDao.queryAutomaticTaskByPage(pageIndex, pageSize);
    List<AutomaticTaskBO> automaticTaskBOList = new ArrayList<AutomaticTaskBO>();
    if((null != list) && (0 < list.size())){
        AutomaticTaskBO automaticTaskBO = null;
        for(AutomaticTask automaticTask:list){
            automaticTaskBO = new AutomaticTaskBO();
            BeanUtils.copyProperties(automaticTask, automaticTaskBO);
            automaticTaskBOList.add(automaticTaskBO);
        }
    }
    return automaticTaskBOList;
}
项目:TITAN    文件:MonitorSetServiceImpl.java   
/**
 * @desc 分页查询数据列表
 *
 * @author liuliang
 *
 * @param pageIndex
 * @param pageSize
 * @return
 */
@Override
public List<MonitorSetBO> getDataList(int pageIndex, int pageSize) throws Exception {
    List<MonitorSet> list = monitorSetDao.getDataList(pageIndex, pageSize);
    List<MonitorSetBO> boList = new ArrayList<MonitorSetBO>();
    if((null != list) && (0 < list.size())){
        MonitorSetBO monitorSetBO = null;
        for(MonitorSet monitorSet:list){
            monitorSetBO = new MonitorSetBO();
            BeanUtils.copyProperties(monitorSet, monitorSetBO);
            boList.add(monitorSetBO);
        }
    }
    return boList;
}
项目:Yidu    文件:UserEditAction.java   
@Override
protected void loadData() {
    logger.debug("loadData start.");
    // 初始化类别下拉列表选项
    initCollections(new String[] { "collectionProperties.user.sex", "collectionProperties.user.type" });
    // 编辑
    if (userno != 0) {
        TUser user = userService.getByNo(userno);
        BeanUtils.copyProperties(user, this);
    }
    logger.debug("loadData normally end.");
}
项目:admin-shiro    文件:JobDetailEditNotesService.java   
@Transactional(propagation = Propagation.NOT_SUPPORTED, rollbackFor = Exception.class)
public void addEditNote(JobDetailEditAO ao){
    JobDetailEditNotesDO jobDetailEditNotesDO = new JobDetailEditNotesDO();
    BeanUtils.copyProperties(ao, jobDetailEditNotesDO);
    jobDetailEditNotesDO.setCron(ao.getJobDetailDO().getCron());
    jobDetailEditNotesDO.setState(ao.getJobDetailDO().getState());
    jobDetailEditNotesDO.setOperatorId(SessionHolderUtils.getCurrentUid());
    jobDetailEditNotesDO.setOperatorName(SessionHolderUtils.getCurrentUname());
    daoSupport.save(jobDetailEditNotesDO);
}
项目:lams    文件:AbstractPropertyBindingResult.java   
/**
 * Retrieve the custom PropertyEditor for the given field, if any.
 * @param fixedField the fully qualified field name
 * @return the custom PropertyEditor, or {@code null}
 */
protected PropertyEditor getCustomEditor(String fixedField) {
    Class<?> targetType = getPropertyAccessor().getPropertyType(fixedField);
    PropertyEditor editor = getPropertyAccessor().findCustomEditor(targetType, fixedField);
    if (editor == null) {
        editor = BeanUtils.findEditorByConvention(targetType);
    }
    return editor;
}
项目:k-framework    文件:ThirdPartyRequestPayInfo.java   
public ThirdPartyRequestPayInfo(PaymentOrderInfo orderInfo, PrepayRequestInfo requestInfo) {
    BeanUtils.copyProperties(orderInfo, this);
    this.tradeId = orderInfo.getTradeId().toString();
    this.amount = orderInfo.getAmount().multiply(BigDecimal.valueOf(100.0)).intValue();
    this.channel = requestInfo.getPayMethod().getChannel();

    this.userIp = requestInfo.getUserIp();
    this.authCode = requestInfo.getCode();
    this.openId = requestInfo.getOpenId();
}
项目:lams    文件:ModelFactory.java   
/**
 * Whether the given attribute requires a {@link BindingResult} in the model.
 */
private boolean isBindingCandidate(String attributeName, Object value) {
    if (attributeName.startsWith(BindingResult.MODEL_KEY_PREFIX)) {
        return false;
    }

    Class<?> attrType = (value != null) ? value.getClass() : null;
    if (this.sessionAttributesHandler.isHandlerSessionAttribute(attributeName, attrType)) {
        return true;
    }

    return (value != null && !value.getClass().isArray() && !(value instanceof Collection) &&
            !(value instanceof Map) && !BeanUtils.isSimpleValueType(value.getClass()));
}
项目:YiDu-Novel    文件:BlockEditAction.java   
@Override
protected void loadData() {
    logger.debug("loadData start.");
    // 初始化下拉列表选项
    initCollections(new String[] { "collectionProperties.article.category", "collectionProperties.block.type",
            "collectionProperties.block.target", "collectionProperties.block.sortCol",
            "collectionProperties.boolean" });
    // 编辑
    if (blockno != 0) {
        TSystemBlock systemBlock = systemBlockService.getByNo(blockno);
        BeanUtils.copyProperties(systemBlock, this);
    }
    logger.debug("loadData normally end.");
}