com.fasterxml.jackson.annotation.JsonManagedReference#org.apache.commons.beanutils.PropertyUtils源码实例Demo

下面列出了com.fasterxml.jackson.annotation.JsonManagedReference#org.apache.commons.beanutils.PropertyUtils 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: nubes   文件: DefaultParameterAdapter.java
@Override
public Object adaptParams(MultiMap params, Class<?> parameterClass) {
  Object instance;
  try {
    instance = parameterClass.newInstance();
    Field[] fields = parameterClass.getDeclaredFields();
    for (Field field : fields) {
      String requestValue = params.get(field.getName());
      if (requestValue != null) {
        Object value = adaptParam(requestValue, field.getType());
        PropertyUtils.setProperty(instance, field.getName(), value);
      }
    }
  } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
    throw new IllegalArgumentException(e);
  }
  return instance;
}
 
源代码2 项目: occurrence   文件: DwcaContactsUtil.java
/**
 * Checks the contacts of a dataset and finds the preferred contact that should be used as the main author
 * of a dataset.
 *
 * @return preferred author contact or null
 */
public static Optional<Contact> getContentProviderContact(Dataset dataset) {
  return findFirstAuthor(dataset).map(author-> {
            Contact provider = null;
            try {
              provider = new Contact();
              PropertyUtils.copyProperties(provider, author);
              provider.setKey(null);
              provider.setType(ContactType.CONTENT_PROVIDER);
              provider.setPrimary(false);
            } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
              LOG.error("Error setting provider contact", e);
            }
            return provider;
            }
          );

}
 
源代码3 项目: MogwaiERDesignerNG   文件: ModelItemProperties.java
public void copyTo(T aObject) {

		ModelProperties theProperties = aObject.getProperties();

		try {
			for (PropertyDescriptor theDescriptor : PropertyUtils.getPropertyDescriptors(this)) {
				if (theDescriptor.getReadMethod() != null && theDescriptor.getWriteMethod() != null) {
					Object theValue = PropertyUtils.getProperty(this, theDescriptor.getName());
					if (theValue != null) {
						theProperties.setProperty(theDescriptor.getName(), theValue.toString());
					} else {
						theProperties.setProperty(theDescriptor.getName(), null);
					}
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
 
源代码4 项目: iaf   文件: JmsRealm.java
/**
 * copies matching properties to any other class
 */
public void copyRealm(Object destination) {
	String logPrefixDest=destination.getClass().getName()+" ";
	if (destination instanceof INamedObject) {
		INamedObject namedDestination = (INamedObject) destination;
		logPrefixDest += "["+namedDestination.getName()+"] ";
	}
	try {
		BeanMap thisBeanMap = new BeanMap(this);
		BeanMap destinationBeanMap = new BeanMap(destination);
		Iterator<String> iterator = thisBeanMap.keyIterator();
		while (iterator.hasNext()) {
			String key = iterator.next();
			Object value = thisBeanMap.get(key);
			if (value != null && !key.equals("class") && destinationBeanMap.containsKey(key)) {
				PropertyUtils.setProperty(destination, key, value);
			}
		}
	}catch (Exception e) {
		log.error(logPrefixDest+"unable to copy properties of JmsRealm", e);
	}
	log.info(logPrefixDest+"loaded properties from jmsRealm ["+toString()+"]");
}
 
源代码5 项目: beast-mcmc   文件: JTextAreaBinding.java
public void get(IValidatable bean) {
	try {
		String text = _textArea.getText();

		if (!text.equals("")) {
			String[] items = text.split("\n");
			List<Object> list = new ArrayList<Object>();

			for (int i = 0; i < items.length; i++) {
				list.add(items[i]);
			}

			PropertyUtils.setProperty(bean, _property, list);
		} else {
			PropertyUtils.setProperty(bean, _property, null);
		}
	} catch (Exception e) {
		throw new BindingException(e);
	}
}
 
源代码6 项目: o2oa   文件: EntityManagerContainer.java
public <T extends JpaObject> List<T> fetchAll(Class<T> clz, List<String> attributes) throws Exception {
	List<T> list = new ArrayList<>();
	List<String> fields = ListTools.trim(attributes, true, true, JpaObject.id_FIELDNAME);
	EntityManager em = this.get(clz);
	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<Tuple> cq = cb.createQuery(Tuple.class);
	Root<T> root = cq.from(clz);
	List<Selection<?>> selections = new ArrayList<>();
	for (String str : fields) {
		selections.add(root.get(str));
	}
	for (Tuple o : em.createQuery(cq.multiselect(selections)).getResultList()) {
		T t = clz.newInstance();
		for (int i = 0; i < fields.size(); i++) {
			PropertyUtils.setProperty(t, attributes.get(i), o.get(selections.get(i)));
		}
		list.add(t);
	}
	return list;
}
 
源代码7 项目: mogu_blog_v2   文件: HighlightResultHelper.java
@Override
public <T> T mapSearchHit(SearchHit searchHit, Class<T> clazz) {
    List<T> results = new ArrayList<>();
    for (HighlightField field : searchHit.getHighlightFields().values()) {
        T result = null;
        if (StringUtils.hasText(searchHit.getSourceAsString())) {
            result = JSONObject.parseObject(searchHit.getSourceAsString(), clazz);
        }
        try {
            PropertyUtils.setProperty(result, field.getName(), concat(field.fragments()));
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
            log.error("设置高亮字段异常:{}", e.getMessage(), e);
        }
        results.add(result);
    }
    return null;
}
 
源代码8 项目: spring-boot-quickstart   文件: Collections3.java
/**
 * 提取集合中的对象的两个属性(通过Getter函数), 组合成Map.
 * 
 * @param collection 来源集合.
 * @param keyPropertyName 要提取为Map中的Key值的属性名.
 * @param valuePropertyName 要提取为Map中的Value值的属性名.
 */
public static Map extractToMap(final Collection collection, final String keyPropertyName,
		final String valuePropertyName) {
	Map map = new HashMap(collection.size());

	try {
		for (Object obj : collection) {
			map.put(PropertyUtils.getProperty(obj, keyPropertyName),
					PropertyUtils.getProperty(obj, valuePropertyName));
		}
	} catch (Exception e) {
		throw Reflections.convertReflectionExceptionToUnchecked(e);
	}

	return map;
}
 
源代码9 项目: frpMgr   文件: BeanUtils.java
/**
 * list转map(1对多)
 */
public static <K, V> Map<K, List<V>> list2Map2(List<V> list, String keyField) {
    Map<K, List<V>> map = new HashMap<>();
    if (list != null && !list.isEmpty()) {
        try {
            for (V s : list) {
                K val = (K) PropertyUtils.getProperty(s, keyField);
                if (map.containsKey(val)) {
                    map.get(val).add(s);
                } else {
                    List<V> listv = new ArrayList<>();
                    listv.add(s);
                    map.put(val, listv);
                }
            }
        } catch (Exception e) {
            logger.error(String.format("keyField [%s] not found !", keyField));
            throw new IllegalArgumentException(String.format("keyField [%s] not found !", keyField));
        }
    }
    return map;
}
 
源代码10 项目: o2oa   文件: OkrCenterWorkQueryService.java
/**
 * 查询上一页的信息数据,直接调用Factory里的方法
 * @param id
 * @param count
 * @param sequence
 * @param wrapIn
 * @return
 * @throws Exception
 */
public List<OkrCenterWorkInfo> listPrevWithFilter( String id, Integer count, WorkCommonQueryFilter wrapIn ) throws Exception {
	Business business = null;
	Object sequence = null;
	try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		business = new Business(emc);
		if( id != null && !"(0)".equals(id) && id.trim().length() > 20 ){
			if (!StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
				sequence = PropertyUtils.getProperty( emc.find( id, OkrCenterWorkInfo.class ),  JpaObject.sequence_FIELDNAME );
			}
		}
		return business.okrCenterWorkInfoFactory().listPrevWithFilter(id, count, sequence, wrapIn);
	} catch ( Exception e ) {
		throw e;
	}
}
 
源代码11 项目: minnal   文件: BaseResourceTest.java
public <T> boolean compare(T model1, T model2, int depth) {
    if (model1 == null || model2 == null) {
        return false;
    }
    for (PropertyDescriptor descriptor : PropertyUtils.getPropertyDescriptors(model1)) {
        if (PropertyUtil.isSimpleProperty(descriptor.getPropertyType())) {
            try {
                Object property1 = PropertyUtils.getProperty(model1, descriptor.getName());
                Object property2 = PropertyUtils.getProperty(model2, descriptor.getName());
                if (property1 != null && property2 != null && !property1.equals(property2)) {
                    return false;
                }
            } catch (Exception e) {
                logger.info(e.getMessage(), e);
            }
        }
    }
    return true;
}
 
源代码12 项目: TranskribusCore   文件: CustomTag.java
public Class<?> getAttributeType(String name) {
	if (!hasAttribute(name))
		return null;

	if (isPredefinedAttribute(name)) { // get type via reflection for
										// predefined attributes
		try {
			return PropertyUtils.getPropertyType(this, name);
		} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	} else {
		CustomTagAttribute att = getAttribute(name);
		return att.getType();
	}
}
 
源代码13 项目: jeecg-cloud   文件: QueryGenerator.java
/**
  * 根据权限相关配置 组装mp需要的权限
 * @param queryWrapper
 * @param clazz
 * @return
 */
public static void installAuthMplus(QueryWrapper<?> queryWrapper,Class<?> clazz) {
	//权限查询
	Map<String,SysPermissionDataRuleModel> ruleMap = getRuleMap();
	PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(clazz);
	for (String c : ruleMap.keySet()) {
		if(oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)){
			queryWrapper.and(i ->i.apply(getSqlRuleValue(ruleMap.get(c).getRuleValue())));
		}
	}
	String name;
	for (int i = 0; i < origDescriptors.length; i++) {
		name = origDescriptors[i].getName();
		if (judgedIsUselessField(name)) {
			continue;
		}
		if(ruleMap.containsKey(name)) {
			addRuleToQueryWrapper(ruleMap.get(name), name, origDescriptors[i].getPropertyType(), queryWrapper);
		}
	}
}
 
源代码14 项目: dubai   文件: Collections3.java
/**
 * 提取集合中的对象的两个属性(通过Getter函数), 组合成Map.
 * 
 * @param collection 来源集合.
 * @param keyPropertyName 要提取为Map中的Key值的属性名.
 * @param valuePropertyName 要提取为Map中的Value值的属性名.
 */
public static Map extractToMap(final Collection collection, final String keyPropertyName,
		final String valuePropertyName) {
	Map map = new HashMap(collection.size());

	try {
		for (Object obj : collection) {
			map.put(PropertyUtils.getProperty(obj, keyPropertyName),
					PropertyUtils.getProperty(obj, valuePropertyName));
		}
	} catch (Exception e) {
		throw Reflections.convertReflectionExceptionToUnchecked(e);
	}

	return map;
}
 
源代码15 项目: o2oa   文件: OkrCenterWorkQueryService.java
/**
 * 查询下一页的信息数据,直接调用Factory里的方法
 * @param id
 * @param count
 * @param sequence
 * @param wrapIn
 * @return
 * @throws Exception
 */
public List<OkrCenterWorkInfo> listNextWithFilter( String id, Integer count, WorkCommonQueryFilter wrapIn ) throws Exception {
	Business business = null;
	Object sequence = null;
	try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		business = new Business(emc);
		if( id != null && !"(0)".equals(id) && id.trim().length() > 20 ){
			if ( !StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
				sequence = PropertyUtils.getProperty( emc.find( id, OkrCenterWorkInfo.class ),  JpaObject.sequence_FIELDNAME );
			}
		}
		return business.okrCenterWorkInfoFactory().listNextWithFilter(id, count, sequence, wrapIn);
	} catch ( Exception e ) {
		throw e;
	}
}
 
源代码16 项目: mycollab   文件: AbstractPreviewItemComp.java
private void toggleFavorite() {
    try {
        if (isFavorite()) {
            favoriteBtn.removeStyleName("favorite-btn-selected");
            favoriteBtn.addStyleName("favorite-btn");
        } else {
            favoriteBtn.addStyleName("favorite-btn-selected");
            favoriteBtn.removeStyleName("favorite-btn");
        }
        FavoriteItem favoriteItem = new FavoriteItem();
        favoriteItem.setExtratypeid(CurrentProjectVariables.getProjectId());
        favoriteItem.setType(getType());
        favoriteItem.setTypeid(PropertyUtils.getProperty(beanItem, "id").toString());
        favoriteItem.setSaccountid(AppUI.getAccountId());
        favoriteItem.setCreateduser(UserUIContext.getUsername());
        FavoriteItemService favoriteItemService = AppContextUtil.getSpringBean(FavoriteItemService.class);
        favoriteItemService.saveOrDelete(favoriteItem);
    } catch (Exception e) {
        LOG.error("Error while set favorite flag to bean", e);
    }
}
 
@Test
public void testAssociateCandidate() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    Candidate entity = bullhornData.findEntity(Candidate.class, testEntities.getCandidateId(), getAssociationFieldSet(AssociationFactory.candidateAssociations()));
    for (AssociationField<Candidate, ? extends BullhornEntity> association : AssociationFactory.candidateAssociations().allAssociations()) {

        Set<Integer> associationIds = new HashSet<Integer>();
        OneToMany<? extends BullhornEntity> linkedIds = (OneToMany<? extends BullhornEntity>) PropertyUtils.getProperty(entity,
            association.getAssociationFieldName());
        if (linkedIds != null && !linkedIds.getData().isEmpty()) {

            associationIds.add(linkedIds.getData().get(0).getId());
            testAssociation(Candidate.class, testEntities.getCandidateId(), associationIds, association);

        }
    }

}
 
源代码18 项目: kfs   文件: ObjectUtil.java
/**
 * Populate the given fields of the target object with the values of an array
 * 
 * @param targetObject the target object
 * @param sourceObject the given array
 * @param keyFields the given fields of the target object that need to be popluated
 */
public static void buildObject(Object targetObject, Object[] sourceObject, List<String> keyFields) {
    int indexOfArray = 0;
    for (String propertyName : keyFields) {
        if (PropertyUtils.isWriteable(targetObject, propertyName) && indexOfArray < sourceObject.length) {
            try {
                Object value = sourceObject[indexOfArray];
                String propertyValue = value != null ? value.toString() : StringUtils.EMPTY;

                String type = getSimpleTypeName(targetObject, propertyName);
                Object realPropertyValue = valueOf(type, propertyValue);

                if (realPropertyValue != null && !StringUtils.isEmpty(realPropertyValue.toString())) {
                    PropertyUtils.setProperty(targetObject, propertyName, realPropertyValue);
                }
                else {
                    PropertyUtils.setProperty(targetObject, propertyName, null);
                }
            }
            catch (Exception e) {
                LOG.debug(e);
            }
        }
        indexOfArray++;
    }
}
 
源代码19 项目: bean-query   文件: ClassSelector.java
/**
 * @param clazz
 *          null will cause the select methods returning an empty Map or a
 *          list of Empty map as the result.
 */
public ClassSelector(Class<?> clazz) {
  if (null == clazz) {
    logger.warn("Input class is null");
    return;
  }
  PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(clazz);
  for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
    boolean propertyReadable = propertyDescriptor.getReadMethod() != null;
    String propertyName = propertyDescriptor.getName();
    // ignore the class property
    if ("class".equals(propertyName)) {
      continue;
    }

    if (propertyReadable) {
      PropertySelector propertySelector = new PropertySelector(propertyDescriptor.getName());
      propertySelectors.add(propertySelector);
      compositeSelector.addSubSelector(propertySelector);
    }
  }
}
 
源代码20 项目: excelReader   文件: ExcelWorkSheetHandler.java
private void assignValue(Object targetObj, String cellReference, String value) {
  if (null == targetObj || StringUtils.isEmpty(cellReference) || StringUtils.isEmpty(value)) {
    return;
  }

  try {
    String propertyName = this.cellMapping.get(cellReference);
    if (null == propertyName) {
      LOG.error("Cell mapping doesn't exists!");
    } else {
      PropertyUtils.setSimpleProperty(targetObj, propertyName, value);
    }
  } catch (IllegalAccessException iae) {
    LOG.error(iae.getMessage());
  } catch (InvocationTargetException ite) {
    LOG.error(ite.getMessage());
  } catch (NoSuchMethodException nsme) {
    LOG.error(nsme.getMessage());
  }
}
 
源代码21 项目: sakai   文件: PersistableHelper.java
public void modifyPersistableFields(Persistable persistable)
{
	Date now = new Date(); // time sensitive
	if (log.isDebugEnabled())
	{
		log.debug("modifyPersistableFields(Persistable " + persistable + ")");
	}
	if (persistable == null) throw new IllegalArgumentException("Illegal persistable argument passed!");

	try
	{
		String actor = getActor();

		PropertyUtils.setProperty(persistable, LASTMODIFIEDBY, actor);
		PropertyUtils.setProperty(persistable, LASTMODIFIEDDATE, now);
	}
	catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e)
	{
		log.error(e.getMessage());
		throw new RuntimeException(e);
	}
}
 
源代码22 项目: mycollab   文件: MultiSelectComp.java
private boolean compareVal(T value1, T value2) {
    if (value1 == null && value2 == null) {
        return true;
    } else if (value1 == null || value2 == null) {
        return false;
    } else {
        try {
            Integer field1 = (Integer) PropertyUtils.getProperty(value1, "id");
            Integer field2 = (Integer) PropertyUtils.getProperty(value2, "id");
            return field1.equals(field2);
        } catch (final Exception e) {
            LOG.error("Error when compare value", e);
            return false;
        }
    }
}
 
源代码23 项目: o2oa   文件: OkrWorkReportQueryService.java
/**
 * 上一页
 * @param id
 * @param count
 * @param wrapIn
 * @return
 * @throws Exception 
 */
public List<OkrWorkReportBaseInfo> listPrevWithFilter( String id, Integer count, WrapInFilter wrapIn ) throws Exception {
	Business business = null;
	Object sequence = null;
	List<OkrWorkReportBaseInfo> okrWorkReportBaseInfoList = new ArrayList<OkrWorkReportBaseInfo>();
	if( count == null ){
		count = 20;
	}
	if( wrapIn == null ){
		throw new Exception( "wrapIn is null!" );
	}
	try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		business = new Business(emc);
		if( id != null && !"(0)".equals(id) && id.trim().length() > 20 ){
			if (!StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
				sequence = PropertyUtils.getProperty( emc.find( id, OkrWorkReportBaseInfo.class ),  JpaObject.sequence_FIELDNAME );
			}
		}
		okrWorkReportBaseInfoList = business.okrWorkReportBaseInfoFactory().listPrevWithFilter( id, count, sequence, wrapIn );
	} catch ( Exception e ) {
		throw e;
	}
	return okrWorkReportBaseInfoList;
}
 
源代码24 项目: beast-mcmc   文件: JTextAreaBinding.java
public void put(IValidatable bean) {
	try {
		List<?> list = (List<?>) PropertyUtils.getProperty(bean, _property);
		StringBuffer sb = new StringBuffer();

		if (list != null) {
			for (int i = 0; i < list.size(); i++) {
				sb.append(list.get(i));
				if (i < list.size() - 1) {
					sb.append("\n");
				}
			}
		}

		_textArea.setText(sb.toString());
	} catch (Exception e) {
		throw new BindingException(e);
	}
}
 
源代码25 项目: o2oa   文件: ListTools.java
@SuppressWarnings("unchecked")
public static <T> List<T> addWithProperty(Object obj, String propertyName, boolean ignoreNull, List<T> ts)
		throws Exception {
	List<T> list = new ArrayList<>();
	ListOrderedSet<T> set = new ListOrderedSet<T>();
	Object o = PropertyUtils.getProperty(obj, propertyName);
	if (null != o) {
		set.addAll((List<T>) o);
	}
	if (null != ts) {
		for (T t : ts) {
			if (null == t && ignoreNull) {
				continue;
			}
			if (!set.contains(t)) {
				set.add(t);
				list.add(t);
			}
		}
	}
	PropertyUtils.setProperty(obj, propertyName, set.asList());
	return list;
}
 
源代码26 项目: o2oa   文件: OkrWorkChatService.java
/**
 * 查询下一页的信息数据,直接调用Factory里的方法
 * 
 * @param id
 * @param count
 * @param sequence
 * @param wrapIn
 * @return
 * @throws Exception
 */
public List<OkrWorkChat> listChatNextWithFilter(String id, Integer count, String workId, String sequenceField,
		String order) throws Exception {

	Business business = null;
	Object sequence = null;
	if (workId == null) {
		throw new Exception("workId is null!");
	}
	try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		business = new Business(emc);
		if (id != null && !"(0)".equals(id) && id.trim().length() > 20) {
			if (!StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
				sequence = PropertyUtils.getProperty(emc.find(id, OkrWorkChat.class),  JpaObject.sequence_FIELDNAME);
			}
		}
		return business.okrWorkChatFactory().listNextWithFilter(id, count, sequence, workId, sequenceField, order);

	} catch (Exception e) {
		throw e;
	}
}
 
源代码27 项目: o2oa   文件: OkrWorkBaseInfoQueryService.java
/**
 * 查询下一页的信息数据,直接调用Factory里的方法
 * 
 * @param id
 * @param count
 * @param sequence
 * @param wrapIn
 * @return
 * @throws Exception
 */
public List<OkrWorkBaseInfo> listNextWithFilter(String id, Integer count, WrapInFilter wrapIn) throws Exception {
	Business business = null;
	Object sequence = null;
	try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		business = new Business(emc);
		if (id != null && !"(0)".equals(id) && id.trim().length() > 20) {
			if (!StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
				sequence = PropertyUtils.getProperty(emc.find(id, OkrWorkBaseInfo.class),  JpaObject.sequence_FIELDNAME);
			}
		}
		return business.okrWorkBaseInfoFactory().listNextWithFilter(id, count, sequence, wrapIn);
	} catch (Exception e) {
		throw e;
	}
}
 
源代码28 项目: o2oa   文件: EntityManagerContainer.java
public <T extends JpaObject> List<T> fetchIsMember(Class<T> clz, List<String> attributes, String attribute,
		Object value) throws Exception {
	List<T> list = new ArrayList<>();
	List<String> fields = ListTools.trim(attributes, true, true, JpaObject.id_FIELDNAME);
	EntityManager em = this.get(clz);
	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<Tuple> cq = cb.createQuery(Tuple.class);
	Root<T> root = cq.from(clz);
	List<Selection<?>> selections = new ArrayList<>();
	for (String str : fields) {
		selections.add(root.get(str));
	}
	Predicate p = cb.isMember(value, root.get(attribute));
	cq.multiselect(selections).where(p);
	for (Tuple o : em.createQuery(cq).getResultList()) {
		T t = clz.newInstance();
		for (int i = 0; i < fields.size(); i++) {
			PropertyUtils.setProperty(t, fields.get(i), o.get(selections.get(i)));
		}
		list.add(t);
	}
	return list;
}
 
源代码29 项目: o2oa   文件: OkrWorkReportQueryService.java
/**
 * 上一页
 * @param id
 * @param count
 * @param wrapIn
 * @return
 * @throws Exception 
 */
public List<OkrWorkReportBaseInfo> listPrevWithFilter( String id, Integer count, WrapInFilter wrapIn ) throws Exception {
	Business business = null;
	Object sequence = null;
	List<OkrWorkReportBaseInfo> okrWorkReportBaseInfoList = new ArrayList<OkrWorkReportBaseInfo>();
	if( count == null ){
		count = 20;
	}
	if( wrapIn == null ){
		throw new Exception( "wrapIn is null!" );
	}
	try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		business = new Business(emc);
		if( id != null && !"(0)".equals(id) && id.trim().length() > 20 ){
			if (!StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
				sequence = PropertyUtils.getProperty( emc.find( id, OkrWorkReportBaseInfo.class ),  JpaObject.sequence_FIELDNAME );
			}
		}
		okrWorkReportBaseInfoList = business.okrWorkReportBaseInfoFactory().listPrevWithFilter( id, count, sequence, wrapIn );
	} catch ( Exception e ) {
		throw e;
	}
	return okrWorkReportBaseInfoList;
}
 
源代码30 项目: o2oa   文件: OkrWorkReportPersonLinkService.java
/**
 * 上一页
 * @param id
 * @param count
 * @param wrapIn
 * @return
 * @throws Exception 
 */
public List<OkrWorkReportPersonLink> listPrevWithFilter( String id, Integer count, WorkPersonSearchFilter wrapIn ) throws Exception {
	Business business = null;
	Object sequence = null;
	List<OkrWorkReportPersonLink> okrWorkReportPersonLinkList = new ArrayList<OkrWorkReportPersonLink>();
	if( count == null ){
		count = 20;
	}
	if( wrapIn == null ){
		throw new Exception( "wrapIn is null!" );
	}
	try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
		business = new Business(emc);
		if( id != null && !"(0)".equals(id) && id.trim().length() > 20 ){
			if (!StringUtils.equalsIgnoreCase(id, StandardJaxrsAction.EMPTY_SYMBOL)) {
				sequence = PropertyUtils.getProperty( emc.find( id, OkrWorkReportPersonLink.class ),  JpaObject.sequence_FIELDNAME );
			}
		}
		okrWorkReportPersonLinkList = business.okrWorkReportPersonLinkFactory().listPrevWithFilter( id, count, sequence, wrapIn );
	} catch ( Exception e ) {
		throw e;
	}
	return okrWorkReportPersonLinkList;
}