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


Java InactivatableFromTo类代码示例

本文整理汇总了Java中org.kuali.rice.krad.bo.InactivatableFromTo的典型用法代码示例。如果您正苦于以下问题:Java InactivatableFromTo类的具体用法?Java InactivatableFromTo怎么用?Java InactivatableFromTo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testFindMatchingActive_nullBeginDate

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Test query results when begin date is null
 *
 * @see InactivateableFromToService#findMatchingActive(Class, Map)
 */
@Test
public void testFindMatchingActive_nullBeginDate() throws Exception {
	InactivateableFromToService inactivateableFromToService = getInactivateableFromToService();

	Map fieldValues = new HashMap();
	fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "04/01/2010");
	fieldValues.put("number", "a4");

	List<? extends InactivatableFromTo> results = inactivateableFromToService.findMatchingActive(TravelAccountUseRate.class,
			fieldValues);
	assertEquals(1, results.size());

	TravelAccountUseRate useRate = (TravelAccountUseRate) results.get(0);
	assertTrue("Incorrect inactive record returned, does not match expected id", "6".equals(useRate.getId()));

	fieldValues = new HashMap();
	fieldValues.put(KRADPropertyConstants.ACTIVE, "N");
	fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "04/01/2010");
	fieldValues.put("number", "a4");

	results = (List<? extends InactivatableFromTo>) findCollectionBySearchUnbounded(TravelAccountUseRate.class, fieldValues);
	assertEquals(0, results.size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:InactivateableFromToServiceTest.java

示例2: testFindMatchingActive_nullEndDate

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Test query results when end date is null
 *
 * @see InactivateableFromToService#findMatchingActive(Class, Map)
 */
@Test
public void testFindMatchingActive_nullEndDate() throws Exception {
	InactivateableFromToService inactivateableFromToService = getInactivateableFromToService();

	Map fieldValues = new HashMap();
	fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "04/01/2030");
	fieldValues.put("number", "a5");

	List<InactivatableFromTo> results = inactivateableFromToService.findMatchingActive(TravelAccountUseRate.class,
			fieldValues);
	assertEquals(1, results.size());

	TravelAccountUseRate useRate = (TravelAccountUseRate) results.get(0);
	assertTrue("Incorrect active record returned, does not match expected id", "7".equals(useRate.getId()));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:InactivateableFromToServiceTest.java

示例3: testFindMatchingActive_nullBeginEndDate

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Test query results when the begin and end date is null
 *
 * @see InactivateableFromToService#findMatchingActive(Class, Map)
 */
@Test
public void testFindMatchingActive_nullBeginEndDate() throws Exception {
	InactivateableFromToService inactivateableFromToService = getInactivateableFromToService();

	Map fieldValues = new HashMap();
	fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "04/01/2010");
	fieldValues.put("number", "a6");

	List<InactivatableFromTo> results = inactivateableFromToService.findMatchingActive(TravelAccountUseRate.class,
			fieldValues);
	assertEquals(1, results.size());

	TravelAccountUseRate useRate = (TravelAccountUseRate) results.get(0);
	assertTrue("Incorrect active record returned, does not match expected id", "8".equals(useRate.getId()));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:InactivateableFromToServiceTest.java

示例4: testFilterOutNonActive

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Test for the filterOutNonActive method
 *
 * @see InactivateableFromToService#filterOutNonActive(List)
 */
@Test
public void testFilterOutNonActive() throws Exception {
	InactivateableFromToService inactivateableFromToService = getInactivateableFromToService();

	List<InactivatableFromTo> filterList = new ArrayList<InactivatableFromTo>();
	filterList.add(constructUseRate("1", "a1", "01/01/2010", "01/01/2011"));
	filterList.add(constructUseRate("2", "a1", "01/01/2012", "01/01/2013"));
	filterList.add(constructUseRate("3", "a2", "01/01/2009", "01/01/2010"));
	filterList.add(constructUseRate("4", "a3", "01/01/2010", "05/16/2010"));
	filterList.add(constructUseRate("5", "a4", null, "01/01/2011"));

	Date activeAsOfDate = CoreApiServiceLocator.getDateTimeService().convertToSqlDate("06/01/2010");
	List<InactivatableFromTo> accessibleList = inactivateableFromToService.filterOutNonActive(filterList,
			activeAsOfDate);
	assertEquals(2, accessibleList.size());

	TravelAccountUseRate useRate = (TravelAccountUseRate) accessibleList.get(0);
	assertTrue("Incorrect active records returned, do not match expected ids", "1".equals(useRate.getId()) || "5".equals(useRate.getId()));

	useRate = (TravelAccountUseRate) accessibleList.get(1);
	assertTrue("Incorrect active records returned, do not match expected ids", "1".equals(useRate.getId()) || "5".equals(useRate.getId()));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:InactivateableFromToServiceTest.java

示例5: testFilterOutNonCurrent

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Test for the filterOutNonCurrent method
 *
 * @see InactivateableFromToService#filterOutNonCurrent(List)
 */
@Test
public void testFilterOutNonCurrent() throws Exception {
	InactivateableFromToService inactivateableFromToService = getInactivateableFromToService();

	List<InactivatableFromTo> filterList = new ArrayList<InactivatableFromTo>();
	filterList.add(constructUseRate("1", "a1", "01/01/2010", "01/01/2011"));
	filterList.add(constructUseRate("2", "a1", "01/16/2010", "01/01/2011"));
	filterList.add(constructUseRate("3", "a1", "01/01/2012", "01/01/2013"));
	filterList.add(constructUseRate("4", "a2", "01/01/2009", "01/01/2010"));
	filterList.add(constructUseRate("5", "a3", "01/01/2010", "05/16/2011"));
	filterList.add(constructUseRate("6", "a3", "06/01/2010", "05/16/2011"));

	Date activeAsOfDate = CoreApiServiceLocator.getDateTimeService().convertToSqlDate("06/10/2010");
	List<InactivatableFromTo> accessibleList = inactivateableFromToService.filterOutNonCurrent(filterList,
			activeAsOfDate);
	assertEquals(2, accessibleList.size());

	TravelAccountUseRate useRate = (TravelAccountUseRate) accessibleList.get(0);
	assertTrue("Incorrect curren records returned, do not match expected ids",
			"2".equals(useRate.getId()) || "6".equals(useRate.getId()));

	useRate = (TravelAccountUseRate) accessibleList.get(1);
	assertTrue("Incorrect curren records returned, do not match expected ids",
			"2".equals(useRate.getId()) || "6".equals(useRate.getId()));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:InactivateableFromToServiceTest.java

示例6: filterCurrentDataObjects

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
protected <T> Collection<T> filterCurrentDataObjects(Class<T> dataObjectClass, Collection<T> unfiltered,
        Map<String, String> formProps) {
    if (InactivatableFromTo.class.isAssignableFrom(dataObjectClass)) {
        Boolean currentSpecifier = lookupCriteriaCurrentSpecifier(formProps);
        if (currentSpecifier != null) {
            List<InactivatableFromTo> onlyCurrent =
                    KRADServiceLocator.getInactivateableFromToService().filterOutNonCurrent(new ArrayList(
                            unfiltered), new Date(LookupUtils.getActiveDateTimestampForCriteria(formProps)
                            .getTime()));
            if (currentSpecifier) {
                return (Collection<T>) onlyCurrent;
            } else {
                unfiltered.removeAll(onlyCurrent);
                return unfiltered;
            }
        }
    }
    return unfiltered;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:KRADLegacyDataAdapterImpl.java

示例7: testFindMatchingActive_inactive

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Test finding inactive records through LookupService
 */
@Test
public void testFindMatchingActive_inactive() throws Exception {
	Map fieldValues = new HashMap();
	fieldValues.put(KRADPropertyConstants.ACTIVE, "N");
	fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "04/01/2010");
	fieldValues.put("number", "a2");

	List<? extends InactivatableFromTo> results = (List<? extends InactivatableFromTo>) findCollectionBySearchUnbounded(TravelAccountUseRate.class,
			fieldValues);
	assertEquals(1, results.size());

	TravelAccountUseRate useRate = (TravelAccountUseRate) results.get(0);
	assertTrue("Incorrect inactive record returned, does not match expected id",
			"4".equals(useRate.getId()));

	fieldValues = new HashMap();
	fieldValues.put(KRADPropertyConstants.ACTIVE, "N");
	fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "07/01/2010");
	fieldValues.put("number", "a3");

	results = (List<? extends InactivatableFromTo>) findCollectionBySearchUnbounded(TravelAccountUseRate.class, fieldValues);
	assertEquals(1, results.size());

	useRate = (TravelAccountUseRate) results.get(0);
	assertTrue("Incorrect inactive record returned, does not match expected id", "5".equals(useRate.getId()));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:InactivateableFromToServiceTest.java

示例8: testFindMatchingCurrent

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Test finding current records through the findMatchingCurrent method
 *
 * @see InactivateableFromToService#findMatchingCurrent(Class, Map)
 */
@Test
public void testFindMatchingCurrent() throws Exception {
	InactivateableFromToService inactivateableFromToService = getInactivateableFromToService();

	Map fieldValues = new HashMap();
	fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "06/01/2010");
	fieldValues.put("number", "a2");

	List<InactivatableFromTo> results = inactivateableFromToService.findMatchingCurrent(TravelAccountUseRate.class,
			fieldValues);
	assertEquals(1, results.size());

       // should find the record with the latest valid "from date"
       TravelAccountUseRate result = (TravelAccountUseRate)results.get(0);
       assertEquals("Incorrect current record returned, does not match expected id", "3", result.getId());

       fieldValues = new HashMap();
       fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "02/01/2010");
       fieldValues.put("number", "a2");

       results = inactivateableFromToService.findMatchingCurrent(TravelAccountUseRate.class,
               fieldValues);
       assertEquals(1, results.size());

       // since our record with id 3 has an active from date of 03/01/2010, it won't be returned so we should get the other one
       result = (TravelAccountUseRate) results.get(0);
	assertEquals("Incorrect current record returned, does not match expected id", "2", result.getId());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:34,代码来源:InactivateableFromToServiceTest.java

示例9: testFindMatchingNonCurrent

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Test that finding non-current records is the same as finding active with current filtered
 *
 * @see InactivateableFromToService#findMatchingCurrent(Class, Map)
 */
@Test
public void testFindMatchingNonCurrent() throws Exception {
    InactivateableFromToService inactivateableFromToService = getInactivateableFromToService();

    Map fieldValues = new HashMap();
    fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, "04/01/2010");
    fieldValues.put("number", "a2");

    List<InactivatableFromTo> results = inactivateableFromToService.findMatchingActive(TravelAccountUseRate.class,
            fieldValues);
    assertEquals(2, results.size());

    TravelAccountUseRate useRate = (TravelAccountUseRate) results.get(0);
    assertTrue("Incorrect active records returned, do not match expected ids",
            "2".equals(useRate.getId()) || "3".equals(useRate.getId()));

    useRate = (TravelAccountUseRate) results.get(1);
    assertTrue("Incorrect active records returned, do not match expected ids",
            "2".equals(useRate.getId()) || "3".equals(useRate.getId()));

    List<InactivatableFromTo> nonCurrent = inactivateableFromToService.filterOutNonCurrent(results, CoreApiServiceLocator.getDateTimeService().convertToSqlDate("04/01/2010"));

    //
    fieldValues.put(KRADPropertyConstants.ACTIVE, "true");
    fieldValues.put(KRADPropertyConstants.CURRENT, "true");
    Collection<TravelAccountUseRate> nonCurrentLookup = findCollectionBySearchUnbounded(TravelAccountUseRate.class, fieldValues);

    assertEquals(nonCurrent.size(), nonCurrentLookup.size());
    List<TravelAccountUseRate> nonCurrentLookupList = new ArrayList<TravelAccountUseRate>(nonCurrentLookup);
    for (int i = 0; i < nonCurrent.size(); i++) {
        TravelAccountUseRate expected = (TravelAccountUseRate) nonCurrent.get(i);
        TravelAccountUseRate actual = nonCurrentLookupList.get(i);

        assertEquals(expected.getId(), actual.getId());
        assertEquals(expected.getRate(), actual.getRate());
        assertEquals(expected.getActiveFromDate(), actual.getActiveFromDate());
        assertEquals(expected.getActiveToDate(), actual.getActiveToDate());
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:45,代码来源:InactivateableFromToServiceTest.java

示例10: createCriteria

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
@Deprecated
protected boolean createCriteria(Object example, String searchValue, String propertyName, boolean caseInsensitive, boolean treatWildcardsAndOperatorsAsLiteral, Predicates criteria, Map<String, String> searchValues) {
    // if searchValue is empty and the key is not a valid property ignore
    if (StringUtils.isBlank(searchValue) || !isWriteable(example, propertyName)) {
        return false;
    }

    // get property type which is used to determine type of criteria
    Class<?> propertyType = getPropertyType(example, propertyName);
    if (propertyType == null) {
    	// Instead of skipping the property if we can't determine a type, assume it's a String
    	// so that the criteria does not get dropped
        propertyType = String.class;
    }

    // build criteria
    if (example instanceof InactivatableFromTo) {
        if (KRADPropertyConstants.ACTIVE.equals(propertyName)) {
            addInactivateableFromToActiveCriteria(example, searchValue, criteria, searchValues);
        } else if (KRADPropertyConstants.CURRENT.equals(propertyName)) {
            addInactivateableFromToCurrentCriteria(example, searchValue, criteria, searchValues);
        } else if (!KRADPropertyConstants.ACTIVE_AS_OF_DATE.equals(propertyName)) {
            addCriteria(propertyName, searchValue, propertyType, caseInsensitive,
                    treatWildcardsAndOperatorsAsLiteral, criteria);
        }
    } else {
        addCriteria(propertyName, searchValue, propertyType, caseInsensitive, treatWildcardsAndOperatorsAsLiteral,
                criteria);
    }

    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:LookupCriteriaGeneratorImpl.java

示例11: findMatchingActiveAsOfDate

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Uses lookup service which will convert the active criteria to active begin/to field criteria
 *
 * @see org.kuali.rice.krad.service.InactivateableFromToService#findMatchingActiveAsOfDate(java.lang.Class, java.util.Map,
 *      java.util.Date)
 */
public List<InactivatableFromTo> findMatchingActiveAsOfDate(Class<? extends InactivatableFromTo> clazz,
        Map fieldValues, Date activeAsOfDate) {
    fieldValues.put(KRADPropertyConstants.ACTIVE, "true");
    fieldValues.put(KRADPropertyConstants.ACTIVE_AS_OF_DATE, dateTimeService.toDateString(activeAsOfDate));

    return (List<InactivatableFromTo>) lookupService.findCollectionBySearchUnbounded(clazz, fieldValues);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:InactivateableFromToServiceImpl.java

示例12: filterOutNonActive

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.InactivateableFromToService#filterOutNonActive(java.util.List, java.util.Date)
 */
public List<InactivatableFromTo> filterOutNonActive(List<InactivatableFromTo> filterList, Date activeAsOfDate) {
    List<InactivatableFromTo> filteredList = new ArrayList<InactivatableFromTo>();

    for (InactivatableFromTo inactivateable : filterList) {
        inactivateable.setActiveAsOfDate(new java.sql.Timestamp(activeAsOfDate.getTime()));
        if (inactivateable.isActive()) {
            filteredList.add(inactivateable);
        }
    }

    return filteredList;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:InactivateableFromToServiceImpl.java

示例13: findMatchingCurrent

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
/**
 * Uses lookup service which will convert the active and current criteria to active begin/to field criteria
 *
 * @see org.kuali.rice.krad.service.InactivateableFromToService#findMatchingCurrent(java.lang.Class, java.util.Map)
 */
public List<InactivatableFromTo> findMatchingCurrent(Class<? extends InactivatableFromTo> clazz,
        Map fieldValues) {
    fieldValues.put(KRADPropertyConstants.ACTIVE, "true");
    fieldValues.put(KRADPropertyConstants.CURRENT, "true");

    return (List<InactivatableFromTo>) lookupService.findCollectionBySearchUnbounded(clazz, fieldValues);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:InactivateableFromToServiceImpl.java

示例14: createCriteria

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
public boolean createCriteria(Object example, String searchValue, String propertyName, boolean caseInsensitive, boolean treatWildcardsAndOperatorsAsLiteral, Object criteria, Map searchValues) {
      // if searchValue is empty and the key is not a valid property ignore
      if (!(criteria instanceof Criteria) || StringUtils.isBlank(searchValue) || !ObjectUtils.isWriteable(example, propertyName, persistenceStructureService)) {
          return false;
      }

      // get property type which is used to determine type of criteria
      Class propertyType = ObjectUtils.getPropertyType(example, propertyName, persistenceStructureService);
      if (propertyType == null) {
          return false;
      }

// build criteria
if (example instanceof InactivatableFromTo) {
	if (KRADPropertyConstants.ACTIVE.equals(propertyName)) {
		addInactivateableFromToActiveCriteria(example, searchValue, (Criteria) criteria, searchValues);
	} else if (KRADPropertyConstants.CURRENT.equals(propertyName)) {
		addInactivateableFromToCurrentCriteria(example, searchValue, (Criteria) criteria, searchValues);
	} else if (!KRADPropertyConstants.ACTIVE_AS_OF_DATE.equals(propertyName)) {
		addCriteria(propertyName, searchValue, propertyType, caseInsensitive,
				treatWildcardsAndOperatorsAsLiteral, (Criteria) criteria);
	}
} else {
	addCriteria(propertyName, searchValue, propertyType, caseInsensitive, treatWildcardsAndOperatorsAsLiteral,
			(Criteria) criteria);
}
      
      return true;
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:LookupDaoOjb.java

示例15: createCriteria

import org.kuali.rice.krad.bo.InactivatableFromTo; //导入依赖的package包/类
public boolean createCriteria(Object example, String searchValue, String propertyName, boolean caseInsensitive, boolean treatWildcardsAndOperatorsAsLiteral, Object criteria, Map searchValues) {
	// if searchValue is empty and the key is not a valid property ignore
	if (!(criteria instanceof Criteria) || StringUtils.isBlank(searchValue) || !isWriteable(example, propertyName)) {
		return false;
	}

	// get property type which is used to determine type of criteria
	Class propertyType = ObjectUtils.getPropertyType(example, propertyName, persistenceStructureService);
	if (propertyType == null) {
		return false;
	}

	// build criteria
	if (example instanceof InactivatableFromTo) {
		if (KRADPropertyConstants.ACTIVE.equals(propertyName)) {
			addInactivateableFromToActiveCriteria(example, searchValue, (Criteria) criteria, searchValues);
		} else if (KRADPropertyConstants.CURRENT.equals(propertyName)) {
			addInactivateableFromToCurrentCriteria(example, searchValue, (Criteria) criteria, searchValues);
		} else if (!KRADPropertyConstants.ACTIVE_AS_OF_DATE.equals(propertyName)) {
			addCriteria(propertyName, searchValue, propertyType, caseInsensitive,
					treatWildcardsAndOperatorsAsLiteral, (Criteria) criteria);
		}
	} else {
		addCriteria(propertyName, searchValue, propertyType, caseInsensitive, treatWildcardsAndOperatorsAsLiteral,
				(Criteria) criteria);
	}
	
	return true;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:30,代码来源:LookupDaoJpa.java


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