本文整理汇总了Java中org.kuali.rice.kew.api.KewApiServiceLocator.getPreferencesService方法的典型用法代码示例。如果您正苦于以下问题:Java KewApiServiceLocator.getPreferencesService方法的具体用法?Java KewApiServiceLocator.getPreferencesService怎么用?Java KewApiServiceLocator.getPreferencesService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.api.KewApiServiceLocator
的用法示例。
在下文中一共展示了KewApiServiceLocator.getPreferencesService方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPreferenceService
import org.kuali.rice.kew.api.KewApiServiceLocator; //导入方法依赖的package包/类
private PreferencesService getPreferenceService() {
if (this.preferencesService == null) {
this.preferencesService = KewApiServiceLocator.getPreferencesService();
}
return this.preferencesService;
}
示例2: getPreferencesService
import org.kuali.rice.kew.api.KewApiServiceLocator; //导入方法依赖的package包/类
/**
* @return the preferencesService
*/
public PreferencesService getPreferencesService() {
if(this.preferencesService == null) {
this.preferencesService = KewApiServiceLocator.getPreferencesService();
}
return this.preferencesService;
}
示例3: initForm
import org.kuali.rice.kew.api.KewApiServiceLocator; //导入方法依赖的package包/类
public void initForm(HttpServletRequest request, ActionForm form) throws Exception {
ActionListFilterForm filterForm = (ActionListFilterForm) form;
filterForm.setUserWorkgroups(getUserWorkgroupsDropDownList(getUserSession().getPrincipalId()));
PreferencesService prefSrv = KewApiServiceLocator.getPreferencesService();
Preferences preferences = prefSrv.getPreferences(getUserSession().getPrincipalId());
request.setAttribute("preferences", preferences);
ActionListService actionListSrv = KEWServiceLocator.getActionListService();
request.setAttribute("delegators", ActionListUtil.getWebFriendlyRecipients(actionListSrv.findUserSecondaryDelegators(getUserSession().getPrincipalId())));
request.setAttribute("primaryDelegates", ActionListUtil.getWebFriendlyRecipients(actionListSrv.findUserPrimaryDelegations(getUserSession().getPrincipalId())));
if (! filterForm.getMethodToCall().equalsIgnoreCase("clear")) {
filterForm.validateDates();
}
}
示例4: testPreferencesDefaultSave
import org.kuali.rice.kew.api.KewApiServiceLocator; //导入方法依赖的package包/类
/**
* Test that the preferences are saved by default when going through the preferences service. This
* means that the preferences service will persist any user option that was not in the db when it went
* to fetch that preferences.
*/
@Test public void testPreferencesDefaultSave() throws Exception {
//verify that user doesn't have any preferences in the db.
final UserOptionsService userOptionsService = KEWServiceLocator.getUserOptionsService();
Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipalByPrincipalName("rkirkend");
Collection userOptions = userOptionsService.findByWorkflowUser(principal.getPrincipalId());
assertTrue("UserOptions should be empty", userOptions.isEmpty());
PreferencesService preferencesService = KewApiServiceLocator.getPreferencesService();
Preferences preferences = preferencesService.getPreferences(principal.getPrincipalId());
assertTrue("Preferences should require a save.", preferences.isRequiresSave());
userOptions = userOptionsService.findByWorkflowUser(principal.getPrincipalId());
assertTrue("UserOptions should not empty", userOptions.isEmpty());
preferencesService.savePreferences(principal.getPrincipalId(), preferences);
userOptions = userOptionsService.findByWorkflowUser(principal.getPrincipalId());
assertTrue("UserOptions should not be empty", !userOptions.isEmpty());
preferences = preferencesService.getPreferences(principal.getPrincipalId());
assertFalse("Preferences should NOT require a save.", preferences.isRequiresSave());
// now delete one of the options
final UserOptions refreshRateOption = userOptionsService.findByOptionId("REFRESH_RATE", principal.getPrincipalId());
assertNotNull("REFRESH_RATE option should exist.", refreshRateOption);
userOptionsService.deleteUserOptions(refreshRateOption);
assertNull("REFRESH_RATE option should no longer exist.", userOptionsService.findByOptionId("REFRESH_RATE", principal.getPrincipalId()));
preferences = preferencesService.getPreferences(principal.getPrincipalId());
assertTrue("Preferences should now require a save again.", preferences.isRequiresSave());
// save refresh rate again
refreshRateOption.setLockVerNbr(null);
userOptionsService.save(refreshRateOption);
preferences = preferencesService.getPreferences(principal.getPrincipalId());
assertFalse("Preferences should no longer require a save.", preferences.isRequiresSave());
}
示例5: testPreferencesMarshallingWithInvalidJson
import org.kuali.rice.kew.api.KewApiServiceLocator; //导入方法依赖的package包/类
/**
* Tests preference marshalling with invalid json.
*/
@Test
public void testPreferencesMarshallingWithInvalidJson() {
final UserOptionsService userOptionsService = KEWServiceLocator.getUserOptionsService();
Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipalByPrincipalName("ewestfal");
Collection<UserOptions> userOptions = userOptionsService.findByWorkflowUser(principal.getPrincipalId());
assertTrue("UserOptions should be empty", userOptions.isEmpty());
PreferencesService preferencesService = KewApiServiceLocator.getPreferencesService();
Preferences preferences = preferencesService.getPreferences(principal.getPrincipalId());
assertTrue("Preferences should require a save.", preferences.isRequiresSave());
preferencesService.savePreferences(principal.getPrincipalId(), preferences);
userOptions = userOptionsService.findByWorkflowUser(principal.getPrincipalId());
UserOptions docSearchOrder = new UserOptions();
docSearchOrder.setOptionId("DocSearch.LastSearch.Order");
docSearchOrder.setWorkflowId(principal.getPrincipalId());
docSearchOrder.setOptionVal("DocSearch.LastSearch.Holding0");
UserOptions badJsonOption = new UserOptions();
badJsonOption.setOptionId("DocSearch.LastSearch.Holding0");
badJsonOption.setWorkflowId(principal.getPrincipalId());
//this be invalid
badJsonOption.setOptionVal("{isAdvancedSearch\":\"NO\",\"dateCreatedFrom\":1339168393063,\"documentStatuses\":[],\"documentStatusCategories\":[],\"documentAttributeValues\":{},\"additionalDocumentTypeNames\":[]}");
userOptionsService.save(docSearchOrder);
userOptionsService.save(badJsonOption);
userOptions = userOptionsService.findByWorkflowUser(principal.getPrincipalId());
assertTrue("UserOptions should not empty", !userOptions.isEmpty());
//UserOptions previousDocSearch0 = userOptionsService.findByOptionId("DocSearch.LastSearch.Holding0", principal.getPrincipalId());
preferences = preferencesService.getPreferences(principal.getPrincipalId());
Preferences.Builder pBuilder = Preferences.Builder.create(preferences);
Map<String, String> docTypeNotification = new HashMap<String, String>();
docTypeNotification.put("hello", "world");
docTypeNotification.put("does_this_thing_have_a", "bookstore example");
pBuilder.setDocumentTypeNotificationPreferences(docTypeNotification);
String marshaledXml = null;
try {
JAXBContext jaxbContext = JAXBContext.newInstance(Preferences.class);
Marshaller marshaller = jaxbContext.createMarshaller();
StringWriter stringWriter = new StringWriter();
marshaller.marshal(pBuilder.build(), stringWriter);
marshaledXml = stringWriter.toString();
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Preferences actual = (Preferences)unmarshaller.unmarshal(new StringReader(marshaledXml));
//Object expected = unmarshaller.unmarshal(new StringReader(XML))
Assert.assertEquals(pBuilder.build(), actual);
} catch (Throwable e) {
e.printStackTrace();
}
}
示例6: getPreferencesService
import org.kuali.rice.kew.api.KewApiServiceLocator; //导入方法依赖的package包/类
private PreferencesService getPreferencesService() {
return KewApiServiceLocator.getPreferencesService();
}
示例7: getPreferencesService
import org.kuali.rice.kew.api.KewApiServiceLocator; //导入方法依赖的package包/类
private PreferencesService getPreferencesService() {
return KewApiServiceLocator.getPreferencesService();
}