本文整理汇总了Java中org.kuali.rice.krad.service.KRADServiceLocator类的典型用法代码示例。如果您正苦于以下问题:Java KRADServiceLocator类的具体用法?Java KRADServiceLocator怎么用?Java KRADServiceLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KRADServiceLocator类属于org.kuali.rice.krad.service包,在下文中一共展示了KRADServiceLocator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
GlobalVariables.setMessageMap(new MessageMap());
GlobalVariables.setUserSession(new UserSession("admin"));
TravelDestination newTravelDestination = new TravelDestination();
newTravelDestination.setTravelDestinationName(DESTINATION_NAME);
newTravelDestination.setCountryCd(COUNTRY_CODE);
newTravelDestination.setStateCd(STATE_CODE);
TRAVEL_DESTINATION_ID = KRADServiceLocator.getDataObjectService().save(
newTravelDestination, PersistenceOption.FLUSH).getTravelDestinationId();
Document newDocument = KRADServiceLocatorWeb.getDocumentService().getNewDocument(TravelAuthorizationDocument.class);
newDocument.getDocumentHeader().setDocumentDescription(DOCUMENT_DESCRIPTION);
TravelAuthorizationDocument newTravelAuthorizationDocument = (TravelAuthorizationDocument) newDocument;
newTravelAuthorizationDocument.setCellPhoneNumber(CELL_PHONE_NUMBER);
newTravelAuthorizationDocument.setTripDestinationId(TRAVEL_DESTINATION_ID);
DOCUMENT_NUMBER = KRADServiceLocatorWeb.getDocumentService().saveDocument(
newTravelAuthorizationDocument).getDocumentNumber();
}
示例2: testTravelExpenseItem
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
/**
* Tests basic {@code TravelExpenseItem} persistence by saving it, reloading it, and checking the data.
*
* @throws java.lang.Exception for any exceptions occurring during creation
*/
@Test
public void testTravelExpenseItem() throws Exception {
assertTrue(TravelExpenseItem.class.getName() + " is not mapped in JPA",
KRADServiceLocator.getDataObjectService().supports(TravelExpenseItem.class));
String id = createTravelExpenseItem();
TravelExpenseItem travelExpenseItem = KRADServiceLocator.getDataObjectService().find(TravelExpenseItem.class, id);
assertNotNull("Travel Expense Item ID is null", travelExpenseItem.getTravelExpenseItemId());
assertEquals("Travel Expense Item document ID is incorrect", DOCUMENT_NUMBER, travelExpenseItem.getTravelAuthorizationDocumentId());
assertEquals("Travel Expense Item type is incorrect", EXPENSE_TYPE, travelExpenseItem.getTravelExpenseTypeCd());
assertEquals("Travel Company name is incorrect", TRAVEL_COMPANY_NAME, travelExpenseItem.getTravelCompanyName());
assertEquals("Travel Expense Item description is incorrect", EXPENSE_DESCRIPTION, travelExpenseItem.getExpenseDesc());
assertEquals("Travel Expense Item date is incorrect", DATE_FORMAT.parse(EXPENSE_DATE), travelExpenseItem.getExpenseDate());
assertEquals("Travel Expense Item amount is incorrect", EXPENSE_AMOUNT, travelExpenseItem.getExpenseAmount());
assertTrue("Travel Expense Item is not reimbursable", travelExpenseItem.isReimbursable());
assertFalse("Travel Expense Item is taxable", travelExpenseItem.isTaxable());
}
示例3: setUp
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
GlobalVariables.setMessageMap(new MessageMap());
GlobalVariables.setUserSession(new UserSession("admin"));
TravelerDetail newTravelerDetail = new TravelerDetail();
newTravelerDetail.setPrincipalId(PRINCIPAL_ID);
TRAVELER_DETAIL_ID = KRADServiceLocator.getDataObjectService().save(
newTravelerDetail, PersistenceOption.FLUSH).getId();
TravelDestination newTravelDestination = new TravelDestination();
newTravelDestination.setTravelDestinationName(DESTINATION_NAME);
newTravelDestination.setCountryCd(COUNTRY_CODE);
newTravelDestination.setStateCd(STATE_CODE);
TRAVEL_DESTINATION_ID = KRADServiceLocator.getDataObjectService().save(
newTravelDestination, PersistenceOption.FLUSH).getTravelDestinationId();
TravelMileageRate newTravelMileageRate = new TravelMileageRate();
newTravelMileageRate.setMileageRateCd(MILEAGE_RATE_CODE);
newTravelMileageRate.setMileageRateName(MILEAGE_RATE_NAME);
newTravelMileageRate.setMileageRate(MILEAGE_RATE);
MILEAGE_RATE_ID = KRADServiceLocator.getDataObjectService().save(
newTravelMileageRate, PersistenceOption.FLUSH).getMileageRateId();
}
示例4: initGRL
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Before
public void initGRL() throws Exception {
GlobalResourceLoader.stop();
SimpleConfig config = new SimpleConfig();
config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
ConfigContext.init(config);
StaticListableBeanFactory testBf = new StaticListableBeanFactory();
when(kualiModuleService.getInstalledModuleServices()).thenReturn(installedModuleServices);
testBf.addBean(KRADServiceLocator.PROVIDER_REGISTRY, mock(ProviderRegistry.class));
testBf.addBean(KRADServiceLocatorWeb.KUALI_MODULE_SERVICE, kualiModuleService);
ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleservicebase-unittest"), testBf);
GlobalResourceLoader.addResourceLoader(rl);
GlobalResourceLoader.start();
}
示例5: getInquiryParameters
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Override
public Map<String, String> getInquiryParameters(Object dataObject, List<String> keys, String propertyName) {
Map<String, String> inquiryParameters = new HashMap<String, String>();
org.kuali.rice.krad.data.metadata.DataObjectRelationship dataObjectRelationship = null;
DataObjectMetadata objectMetadata =
KRADServiceLocator.getDataObjectService().getMetadataRepository().getMetadata(dataObject.getClass());
if (objectMetadata != null) {
dataObjectRelationship = objectMetadata.getRelationshipByLastAttributeInRelationship(propertyName);
}
for (String keyName : keys) {
String keyConversion = keyName;
if (dataObjectRelationship != null) {
keyConversion = dataObjectRelationship.getParentAttributeNameRelatedToChildAttributeName(keyName);
} else if (PropertyAccessorUtils.isNestedOrIndexedProperty(propertyName)) {
String nestedAttributePrefix = KRADUtils.getNestedAttributePrefix(propertyName);
keyConversion = nestedAttributePrefix + "." + keyName;
}
inquiryParameters.put(keyConversion, keyName);
}
return inquiryParameters;
}
示例6: testPostalCodeBoDataObject
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Test
public void testPostalCodeBoDataObject() throws Exception {
assertTrue("PostalCodeBo is mapped in JPA", KRADServiceLocator.getDataObjectService().supports(
PostalCodeBo.class));
PostalCodeBo postalCodeBo = KRADServiceLocator.getDataObjectService().find(PostalCodeBo.class, new PostalCodeId(
"US", "47203"));
assertTrue("PostalCode BO fetched after save", postalCodeBo != null && StringUtils.equals(
postalCodeBo.getCode(), "47203"));
assertTrue("PostalCode BO fetched Country BO correctly",
postalCodeBo.getCountry() != null && StringUtils.equals(postalCodeBo.getCountry().getAlternateCode(),
"USA"));
assertTrue("PostalCode BO fetched State BO correctly", postalCodeBo.getState() != null && StringUtils.equals(
postalCodeBo.getState().getCode(), "IN"));
assertTrue("PostalCode BO fetched County BO correctly", postalCodeBo.getCounty() != null && StringUtils.equals(
postalCodeBo.getCounty().getCode(), "MON"));
}
示例7: setUp
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
/**
* This overridden method ...
*
* @see org.kuali.rice.krad.test.KRADTestCase#setUp()
*/
@Override
public void setUp() throws Exception {
super.setUp();
setupPostalCodeBoDataObjectAndSave();
setupCampusBoDataObjectAndSave();
// If we don't do this, then some of the objects are created without
// their reference object proxies in place. This forces all the objects which
// were created by the above methods to be reloaded as needed during the test.
KRADServiceLocator.getDataObjectService().flush(PostalCodeBo.class);
KRADServiceLocator.getDataObjectService().flush(CountryBo.class);
KRADServiceLocator.getDataObjectService().flush(CountyBo.class);
KRADServiceLocator.getDataObjectService().flush(StateBo.class);
KRADServiceLocator.getDataObjectService().flush(CampusTypeBo.class);
KRADServiceLocator.getDataObjectService().flush(CampusBo.class);
}
示例8: testDocumentTypeServiceFind
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Test
public void testDocumentTypeServiceFind() throws Exception{
DocumentType parentDocType = setupDocumentType(true);
DocumentType childDocType = setupDocumentType(false);
childDocType.setDocTypeParentId(parentDocType.getDocumentTypeId());
childDocType.setName("CoolNewDocType");
childDocType = KRADServiceLocator.getDataObjectService().save(childDocType, PersistenceOption.FLUSH);
assertTrue("Child doc type now has a parent doc type",childDocType != null &&
StringUtils.isNotBlank(childDocType.getDocTypeParentId()));
List<DocumentType> documentTypes = (List<DocumentType>)
KEWServiceLocator.getDocumentTypeService().find(childDocType,parentDocType.getName(),true);
assertTrue("Fetched correct number of documentTypes", documentTypes != null && documentTypes.size() == 1);
}
示例9: testParseNotificationRequestMessage
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
private void testParseNotificationRequestMessage(String samplePath) throws Exception {
NotificationMessageContentService impl = services.getNotificationMessageContentService();
InputStream is = this.getClass().getResourceAsStream(samplePath);
System.out.println(is);
NotificationBo notification = impl.parseNotificationRequestMessage(is);
assertEquals(SAMPLE_CHANNEL, notification.getChannel().getName());
System.out.println(notification.getSenders());
System.out.println("notification id: " + notification.getId());
List<NotificationSenderBo> sl = notification.getSenders();
assertTrue(sl.size() > 0);
for (NotificationSenderBo s :sl) {
assertNotNull(s);
assertNotNull(s.getSenderName());
}
List<NotificationRecipientBo> rl = notification.getRecipients();
assertTrue(rl.size() > 0);
for (NotificationRecipientBo r : rl) {
assertNotNull(r);
assertNotNull(r.getRecipientId());
}
//fail("Not yet implemented");
notification.setCreationDateTimeValue(new Timestamp(System.currentTimeMillis()));
KRADServiceLocator.getDataObjectService().save(notification, PersistenceOption.FLUSH);
//setComplete();
}
示例10: testDocumentStatusTransition
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Test
public void testDocumentStatusTransition() throws Exception{
DocumentRouteHeaderValue documentRouteHeaderValue = setupDocumentRouteHeaderValueWithRouteHeaderAssigned();
DocumentStatusTransition documentStatusTransition = setupDocumentStatusTransition();
//Modify status
documentRouteHeaderValue.getAppDocStatusHistory().add(documentStatusTransition);
documentStatusTransition.setOldAppDocStatus("R");
assertTrue("Document Status Transition saved and persisted",
documentStatusTransition != null && StringUtils.isNotEmpty(
documentStatusTransition.getStatusTransitionId()));
DocumentStatusTransition fetchedVal = KRADServiceLocator.getDataObjectService().
find(DocumentStatusTransition.class, documentStatusTransition.getStatusTransitionId());
assertTrue("DocumentStatusTransition fetched after save",fetchedVal != null &&
StringUtils.equals(fetchedVal.getDocumentId(),fetchedVal.getDocumentId()));
KRADServiceLocator.getDataObjectService().save(documentRouteHeaderValue);
DocumentRouteHeaderValue newHeaderVal = KRADServiceLocator.getDataObjectService().find(
DocumentRouteHeaderValue.class,documentRouteHeaderValue.getDocumentId());
assertTrue("On fetch app doc history updated", newHeaderVal != null &&
StringUtils.equals(newHeaderVal.getAppDocStatusHistory().get(0).getOldAppDocStatus(),"R"));
}
示例11: testRouteNodeServiceDeleteByRouteNodeInstance
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Test
public void testRouteNodeServiceDeleteByRouteNodeInstance() throws Exception{
DocumentType documentType = setupDocumentType();
RouteNode rn = setupRouteNode(documentType);
RouteNodeInstance routeNodeInstance = setupRouteNodeInstance(rn);
routeNodeInstance.setRouteNode(rn);
routeNodeInstance = KRADServiceLocator.getDataObjectService().save(routeNodeInstance);
assertTrue("Route node instance persisted with route node",
routeNodeInstance != null && StringUtils.isNotBlank(routeNodeInstance.getRouteNodeId()));
String routeNodeInstanceId = routeNodeInstance.getRouteNodeInstanceId();
KEWServiceLocator.getRouteNodeService().deleteByRouteNodeInstance(routeNodeInstance);
routeNodeInstance = KradDataServiceLocator.getDataObjectService().find(RouteNodeInstance.class,
routeNodeInstanceId);
assertTrue("RouteNodeInstanceDeleted successfully", routeNodeInstance == null);
}
示例12: testRouteNodeServiceGetTerminalNodeInstances
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Test
public void testRouteNodeServiceGetTerminalNodeInstances() throws Exception{
DocumentType documentType = setupDocumentType();
RouteNode rn = setupRouteNode(documentType);
RouteNodeInstance routeNodeInstance = setupRouteNodeInstance(rn);
routeNodeInstance.setActive(false);
routeNodeInstance.setComplete(true);
routeNodeInstance.setRouteNode(rn);
routeNodeInstance = KRADServiceLocator.getDataObjectService().save(routeNodeInstance);
assertTrue("Route node instance persisted with route node",
routeNodeInstance != null && StringUtils.isNotBlank(routeNodeInstance.getRouteNodeId()));
List<RouteNodeInstance> routeNodeList = KEWServiceLocator.getRouteNodeService().
getTerminalNodeInstances(routeNodeInstance.getDocumentId());
assertTrue("Route node instances found", routeNodeList != null && routeNodeList.size() == 1);
List<String> routeNodeNames = KEWServiceLocator.getRouteNodeService().getTerminalRouteNodeNames(
routeNodeInstance.getDocumentId());
assertTrue("Route node instances found", routeNodeNames != null && routeNodeNames.size() == 1);
}
示例13: testRouteNodeServiceGetInitialNodeInstances
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Test
public void testRouteNodeServiceGetInitialNodeInstances() throws Exception{
DocumentType documentType = setupDocumentType();
RouteNode rn = setupRouteNode(documentType);
RouteNodeInstance routeNodeInstance = setupRouteNodeInstance(rn);
routeNodeInstance.setRouteNode(rn);
routeNodeInstance = KRADServiceLocator.getDataObjectService().save(routeNodeInstance);
assertTrue("Route node instance persisted with route node",
routeNodeInstance != null && StringUtils.isNotBlank(routeNodeInstance.getRouteNodeId()));
DocumentRouteHeaderValue drv = setupDocumentRouteHeaderValueWithRouteHeaderAssigned();
drv.getInitialRouteNodeInstances().add(routeNodeInstance);
KRADServiceLocator.getDataObjectService().save(drv);
List<RouteNodeInstance> routeNodeInstances = KEWServiceLocator.getRouteNodeService().getInitialNodeInstances(
routeNodeInstance.getDocumentId());
assertTrue("Route node instances found", routeNodeInstances != null && routeNodeInstances.size() == 1);
}
示例14: testRouteNodeServiceSaveRouteNodeInstance
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
@Test
public void testRouteNodeServiceSaveRouteNodeInstance() throws Exception {
DocumentType documentType = KEWServiceLocator.getDocumentTypeService().findByName("gooddoctype");
if(documentType != null){
KRADServiceLocator.getDataObjectService().delete(documentType);
}
documentType = setupDocumentType();
RouteNode rn = setupRouteNode(documentType);
assertNotNull(rn.getRouteNodeId());
RouteNodeInstance rni = new RouteNodeInstance();
rni.setDocumentId(TEST_DOC_ID);
rni.setRouteNode(rn);
rni = KRADServiceLocator.getDataObjectService().save(rni);
assertNotNull(rni.getRouteNodeId());
assertEquals(rn.getName(), rni.getName());
}
示例15: setupDocumentRouteHeaderValue
import org.kuali.rice.krad.service.KRADServiceLocator; //导入依赖的package包/类
private DocumentRouteHeaderValue setupDocumentRouteHeaderValue() {
DocumentRouteHeaderValue routeHeader = new DocumentRouteHeaderValue();
routeHeader.setAppDocId("Test");
routeHeader.setApprovedDate(null);
routeHeader.setCreateDate(new Timestamp(new Date().getTime()));
routeHeader.setDocContent("test");
routeHeader.setDocRouteLevel(1);
routeHeader.setDocRouteStatus(KewApiConstants.ROUTE_HEADER_ENROUTE_CD);
routeHeader.setDocTitle("Test");
routeHeader.setDocumentTypeId("1");
routeHeader.setDocVersion(KewApiConstants.DocumentContentVersions.CURRENT);
routeHeader.setRouteStatusDate(new Timestamp(new Date().getTime()));
routeHeader.setDateModified(new Timestamp(new Date().getTime()));
routeHeader.setInitiatorWorkflowId("someone");
return KRADServiceLocator.getDataObjectService().save(routeHeader, PersistenceOption.FLUSH);
}