本文整理匯總了Java中org.alfresco.service.cmr.preference.PreferenceService類的典型用法代碼示例。如果您正苦於以下問題:Java PreferenceService類的具體用法?Java PreferenceService怎麽用?Java PreferenceService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PreferenceService類屬於org.alfresco.service.cmr.preference包,在下文中一共展示了PreferenceService類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
@Before
public void setUp() throws Exception
{
super.setUp();
preferenceService = ctx.getBean("preferenceService",
PreferenceService.class);
}
示例2: initStaticData
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
@BeforeClass public static void initStaticData() throws Exception
{
CONTENT_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("ContentService", ContentService.class);
PERSON_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("PersonService", PersonService.class);
PREFERENCE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("PreferenceService", PreferenceService.class);
SCRIPT_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("ScriptService", ScriptService.class);
TRANSACTION_HELPER = APP_CONTEXT_INIT.getApplicationContext().getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
Repository repositoryHelper = (Repository) APP_CONTEXT_INIT.getApplicationContext().getBean("repositoryHelper");
COMPANY_HOME = repositoryHelper.getCompanyHome();
}
示例3: setup
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
@Before
public void setup() throws Exception
{
this.dummyTemplateNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
// Mock the required services
this.serviceRegistryMock = mock(ServiceRegistry.class);
this.nodeServiceMock = mock(NodeService.class);
this.searchServiceMock = mock(SearchService.class);
this.namespaceServiceMock = mock(NamespaceService.class);
this.fileFolderServiceMock = mock(FileFolderService.class);
this.personServiceMock = mock(PersonService.class);
this.preferenceServiceMock = mock(PreferenceService.class);
this.repositoryHelperMock = mock(Repository.class);
this.templateLoaderMock = mock(TemplateLoader.class);
when(serviceRegistryMock.getNodeService()).thenReturn(nodeServiceMock);
when(serviceRegistryMock.getSearchService()).thenReturn(searchServiceMock);
when(serviceRegistryMock.getNamespaceService()).thenReturn(namespaceServiceMock);
when(serviceRegistryMock.getFileFolderService()).thenReturn(fileFolderServiceMock);
when(serviceRegistryMock.getPersonService()).thenReturn(personServiceMock);
when(serviceRegistryMock.getContentService()).thenReturn(mock(ContentService.class));
when(repositoryHelperMock.getRootHome()).thenReturn(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()));
when(fileFolderServiceMock.getLocalizedSibling(dummyTemplateNodeRef)).thenReturn(dummyTemplateNodeRef);
this.emailHelper = new EmailHelper();
emailHelper.setServiceRegistry(serviceRegistryMock);
emailHelper.setPreferenceService(preferenceServiceMock);
emailHelper.setRepositoryHelper(repositoryHelperMock);
emailHelper.setCompanyHomeChildName("app:company_home");
//test init
emailHelper.init();
// Note: set the template loader after the init method
emailHelper.setTemplateLoader(templateLoaderMock);
}
示例4: RepoService
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public RepoService(ApplicationContext applicationContext) throws Exception
{
this.applicationContext = applicationContext;
this.publicApiContext = new PublicApiTestContext(applicationContext);
this.authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
this.siteService = (SiteService)applicationContext.getBean("SiteService");
this.activityService = (ActivityService)applicationContext.getBean("activityService");
this.fileFolderService = (FileFolderService)applicationContext.getBean("FileFolderService");
this.contentService = (ContentService)applicationContext.getBean("ContentService");
this.commentService = (CommentService)applicationContext.getBean("CommentService");
this.nodeService = (NodeService)applicationContext.getBean("NodeService");
this.preferenceService = (PreferenceService)applicationContext.getBean("PreferenceService");
this.taggingService = (TaggingService)applicationContext.getBean("TaggingService");
this.ratingService = (RatingService)applicationContext.getBean("RatingService");
this.tenantService = (TenantService)applicationContext.getBean("tenantService");
this.tenantAdminService = (TenantAdminService)applicationContext.getBean("tenantAdminService");
this.personService = (PersonService)applicationContext.getBean("PersonService");
this.contentStoreCleaner = (ContentStoreCleaner)applicationContext.getBean("contentStoreCleaner");
this.postDAO = (ActivityPostDAO)applicationContext.getBean("postDAO");
this.nodeRatingSchemeRegistry = (NamedObjectRegistry<RatingScheme>)applicationContext.getBean("nodeRatingSchemeRegistry");
this.cociService = (CheckOutCheckInService)applicationContext.getBean("CheckoutCheckinService");
this.favouritesService = (FavouritesService)applicationContext.getBean("FavouritesService");
this.dictionaryService = (DictionaryService)applicationContext.getBean("dictionaryService");
this.invitationService = (InvitationService)applicationContext.getBean("InvitationService");
this.lockService = (LockService)applicationContext.getBean("LockService");
this.cmisConnector = (CMISConnector)applicationContext.getBean("CMISConnector");
this.nodeIndexer = (NodeIndexer)applicationContext.getBean("nodeIndexer");
this.activities = (Activities)applicationContext.getBean("activities");
this.hiddenAspect = (HiddenAspect)applicationContext.getBean("hiddenAspect");
this.networksService = (NetworksService)applicationContext.getBean("networksService");
this.namespaceService = (NamespaceService)applicationContext.getBean("namespaceService");
this.transactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper");
Scheduler scheduler = (Scheduler)applicationContext.getBean("schedulerFactory");
JobDetailBean contentStoreCleanerJobDetail = (JobDetailBean)applicationContext.getBean("contentStoreCleanerJobDetail");
scheduler.pauseJob(contentStoreCleanerJobDetail.getName(), contentStoreCleanerJobDetail.getGroup());
ChildApplicationContextFactory activitiesFeed = (ChildApplicationContextFactory)applicationContext.getBean("ActivitiesFeed");
ApplicationContext activitiesFeedCtx = activitiesFeed.getApplicationContext();
this.postLookup = (PostLookup)activitiesFeedCtx.getBean("postLookup");
this.feedGenerator = (FeedGenerator)activitiesFeedCtx.getBean("feedGenerator");
this.feedGeneratorJobDetail = (JobDetailBean)activitiesFeedCtx.getBean("feedGeneratorJobDetail");
this.postLookupJobDetail = (JobDetailBean)activitiesFeedCtx.getBean("postLookupJobDetail");
this.feedCleanerJobDetail = (JobDetailBean)activitiesFeedCtx.getBean("feedCleanerJobDetail");
this.postCleanerJobDetail = (JobDetailBean)activitiesFeedCtx.getBean("postCleanerJobDetail");
this.feedNotifierJobDetail = (JobDetailBean)activitiesFeedCtx.getBean("feedNotifierJobDetail");
this.feedCleaner = (FeedCleaner)activitiesFeedCtx.getBean("feedCleaner");
// Pause activities jobs so that we aren't competing with their scheduled versions
scheduler.pauseJob(feedGeneratorJobDetail.getName(), feedGeneratorJobDetail.getGroup());
scheduler.pauseJob(postLookupJobDetail.getName(), postLookupJobDetail.getGroup());
scheduler.pauseJob(feedCleanerJobDetail.getName(), feedCleanerJobDetail.getGroup());
scheduler.pauseJob(postCleanerJobDetail.getName(), postCleanerJobDetail.getGroup());
scheduler.pauseJob(feedNotifierJobDetail.getName(), feedNotifierJobDetail.getGroup());
this.systemNetwork = new TestNetwork(TenantService.DEFAULT_DOMAIN, true);
}
示例5: setUp
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
@Override
protected void setUp() throws Exception
{
super.setUp();
preferenceService = ctx.getBean("preferenceService",
PreferenceService.class);
}
示例6: setPreferenceService
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
@Deprecated
public void setPreferenceService(PreferenceService preferenceService)
{
// Never used
}
示例7: getFavouriteSites
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
/**
* Return list of "favourite" sites, that belong to the specified user and are marked as "Imap favourite"
*
* @param userName name of user
* @return List of favourite sites.
*/
private List<NodeRef> getFavouriteSites(final String userName)
{
if (logger.isDebugEnabled())
{
logger.debug("[getFavouriteSites] entry for user: " + userName);
}
List<NodeRef> favSites = AlfrescoTransactionSupport.getResource(FAVORITE_SITES);
if (logger.isDebugEnabled())
{
if (favSites == null)
{
logger.debug("[getFavouriteSites] There is no Favorite sites' list bound to transaction " + AlfrescoTransactionSupport.getTransactionId());
}
else
{
logger.debug("[getFavouriteSites] Found Favorite sites' list bound to transaction " + AlfrescoTransactionSupport.getTransactionId());
}
}
if (favSites == null)
{
favSites = new LinkedList<NodeRef>();
PreferenceService preferenceService = (PreferenceService) serviceRegistry
.getService(ServiceRegistry.PREFERENCE_SERVICE);
Map<String, Serializable> prefs = preferenceService.getPreferences(
userName, AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES);
for (String key : prefs.keySet())
{
Boolean isImapFavourite = (Boolean) prefs.get(key);
if (isImapFavourite != null && isImapFavourite)
{
String siteName = key.substring(AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES.length() + 1); // count the dot
boolean isMember = false;
try
{
isMember = serviceRegistry.getSiteService().isMember(siteName, userName);
}
catch (SiteDoesNotExistException sdne)
{
// Ignore, see MNT-13579
// The site might be archived. In this case it will still be in user's preferences.
}
if (isMember)
{
SiteInfo siteInfo = serviceRegistry.getSiteService().getSite(siteName);
if (siteInfo != null)
{
if(logger.isDebugEnabled())
{
logger.debug("[getFavouriteSites] User: " + userName + " Favourite site: " + siteInfo.getShortName());
}
favSites.add(siteInfo.getNodeRef());
}
}
}
}
if (logger.isDebugEnabled())
{
logger.debug("[getFavouriteSites] Bind new Favorite sites' list to transaction " + AlfrescoTransactionSupport.getTransactionId());
}
AlfrescoTransactionSupport.bindResource(FAVORITE_SITES, favSites);
}
if (logger.isDebugEnabled())
{
logger.debug("[getFavouriteSites] end for user: " + userName);
}
return favSites;
}
示例8: setPreferenceService
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
public void setPreferenceService(PreferenceService preferenceService)
{
this.preferenceService = preferenceService;
}
示例9: setPreferenceService
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
public void setPreferenceService(PreferenceService preferenceService)
{
this.preferenceService = preferenceService;
}
示例10: setupTests
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
public static void setupTests(ApplicationContext appCtx)
{
TRANSACTION_SERVICE = appCtx.getBean("TransactionService", TransactionService.class);
ACTION_SERVICE = appCtx.getBean("ActionService", ActionService.class);
ACTION_EXECUTER = appCtx.getBean("OutboundSMTP", ApplicationContextFactory.class).getApplicationContext().getBean("mail", MailActionExecuter.class);
PREFERENCE_SERVICE = appCtx.getBean("PreferenceService", PreferenceService.class);
PERSON_SERVICE = appCtx.getBean("PersonService", PersonService.class);
NODE_SERVICE = appCtx.getBean("NodeService", NodeService.class);
AUTHORITY_SERVICE = appCtx.getBean("AuthorityService", AuthorityService.class);
PERMISSION_SERVICE = appCtx.getBean("PermissionService", PermissionService.class);
WAS_IN_TEST_MODE = ACTION_EXECUTER.isTestMode();
ACTION_EXECUTER.setTestMode(true);
AuthenticationUtil.setRunAsUserSystem();
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
properties.put(ContentModel.PROP_USERNAME, ALFRESCO_EE_USER);
properties.put(ContentModel.PROP_EMAIL, "[email protected]");
PERSON_SERVICE.createPerson(properties, null);
// All these test users are in the same tenant - either they're enterprise where there's only one,
// or they're cloud, where they have the same email domain
final String tenantId = getUsersHomeTenant(FRENCH_USER.getUsername());
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Object>()
{
@Override
public Object doWork() throws Exception
{
final Map<String, Serializable> preferences = new HashMap<String, Serializable>();
preferences.put("locale", "fr");
PREFERENCE_SERVICE.setPreferences(FRENCH_USER.getUsername(), preferences);
preferences.clear();
preferences.put("locale", "en_GB");
PREFERENCE_SERVICE.setPreferences(BRITISH_USER.getUsername(), preferences);
preferences.clear();
preferences.put("locale", "en_AU");
PREFERENCE_SERVICE.setPreferences(AUSTRALIAN_USER.getUsername(), preferences);
return null;
}
}, tenantId);
}
示例11: testGetPerson_withCustomProps
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
@Test
public void testGetPerson_withCustomProps() throws PublicApiException
{
// Create the person directly using the Java services - we don't want to test
// the REST API's "create person" function here, so we're isolating this test from it.
MutableAuthenticationService authService = applicationContext.getBean("AuthenticationService", MutableAuthenticationService.class);
PreferenceService prefService = applicationContext.getBean("PreferenceService", PreferenceService.class);
Map<QName, Serializable> nodeProps = new HashMap<>();
// The papi:lunchable aspect should be auto-added for the papi:lunch property
nodeProps.put(PROP_LUNCH, "Falafel wrap");
nodeProps.put(PROP_LUNCH_COMMENTS, "");
// These properties should not be present when a person is retrieved
// since they are present as top-level fields.
String userName = "[email protected]" + account1.getId();
nodeProps.put(ContentModel.PROP_USERNAME, userName);
nodeProps.put(ContentModel.PROP_FIRSTNAME, "Doc");
nodeProps.put(ContentModel.PROP_LASTNAME, "Brown");
nodeProps.put(ContentModel.PROP_JOBTITLE, "Inventor");
nodeProps.put(ContentModel.PROP_LOCATION, "Location");
nodeProps.put(ContentModel.PROP_TELEPHONE, "123345");
nodeProps.put(ContentModel.PROP_MOBILE, "456456");
nodeProps.put(ContentModel.PROP_EMAIL, "[email protected]");
nodeProps.put(ContentModel.PROP_ORGANIZATION, "Acme");
nodeProps.put(ContentModel.PROP_COMPANYADDRESS1, "123 Acme Crescent");
nodeProps.put(ContentModel.PROP_COMPANYADDRESS2, "Cholsey");
nodeProps.put(ContentModel.PROP_COMPANYADDRESS3, "Oxfordshire");
nodeProps.put(ContentModel.PROP_COMPANYPOSTCODE, "OX10 1AB");
nodeProps.put(ContentModel.PROP_COMPANYTELEPHONE, "098876234");
nodeProps.put(ContentModel.PROP_COMPANYFAX, "098234876");
nodeProps.put(ContentModel.PROP_COMPANYEMAIL, "[email protected]");
nodeProps.put(ContentModel.PROP_SKYPE, "doc.brown");
nodeProps.put(ContentModel.PROP_INSTANTMSG, "doc.brown.instmsg");
nodeProps.put(ContentModel.PROP_USER_STATUS, "status");
nodeProps.put(ContentModel.PROP_USER_STATUS_TIME, new Date());
nodeProps.put(ContentModel.PROP_GOOGLEUSERNAME, "doc.brown.google");
nodeProps.put(ContentModel.PROP_SIZE_QUOTA, 12345000);
nodeProps.put(ContentModel.PROP_SIZE_CURRENT, 1230);
nodeProps.put(ContentModel.PROP_EMAIL_FEED_DISABLED, false);
// TODO: PROP_PERSON_DESCRIPTION?
// Namespaces that should be filtered
nodeProps.put(ContentModel.PROP_ENABLED, true);
nodeProps.put(ContentModel.PROP_SYS_NAME, "name-value");
// Create a password and enable the user so that we can check the usr:* props aren't present later.
AuthenticationUtil.setFullyAuthenticatedUser("[email protected]"+account1.getId());
authService.createAuthentication(userName, "password".toCharArray());
authService.setAuthenticationEnabled(userName, true);
personService.createPerson(nodeProps);
// Set a preference, so that we can test that we're filtering this property correctly.
prefService.setPreferences(userName, Collections.singletonMap("olives", "green"));
// Get the person using the REST API
publicApiClient.setRequestContext(new RequestContext(account1.getId(), account1Admin, "admin"));
Person person = people.getPerson(userName);
// Did we get the correct aspects/properties?
assertEquals(userName, person.getId());
assertEquals("Doc", person.getFirstName());
assertEquals("Falafel wrap", person.getProperties().get("papi:lunch"));
assertTrue(person.getAspectNames().contains("papi:lunchable"));
// Empty (zero length) string values are considered to be
// null values, and will be represented the same as null
// values (i.e. by non-existence of the property).
assertNull(person.getProperties().get("papi:lunchcomments"));
// Check that no properties are present that should have been filtered by namespace.
for (String key : person.getProperties().keySet())
{
if (key.startsWith("cm:") || key.startsWith("sys:") || key.startsWith("usr:"))
{
Object value = person.getProperties().get(key);
String keyValueStr = String.format("(key=%s, value=%s)", key, value);
fail("Property " + keyValueStr +
" found with namespace that should have been excluded.");
}
}
}
示例12: setPreferenceService
import org.alfresco.service.cmr.preference.PreferenceService; //導入依賴的package包/類
/**
* Set the preferenceService
*/
public void setPreferenceService(PreferenceService preferenceService)
{
this.preferenceService = preferenceService;
}