本文整理汇总了Java中org.exoplatform.container.PortalContainer类的典型用法代码示例。如果您正苦于以下问题:Java PortalContainer类的具体用法?Java PortalContainer怎么用?Java PortalContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PortalContainer类属于org.exoplatform.container包,在下文中一共展示了PortalContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDatabaseAutoGeneratingTimestamp
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
@Test
public void testDatabaseAutoGeneratingTimestamp () throws NoSuchFieldException, IllegalAccessException {
//Given
IndexingOperation indexingOperation1 = new IndexingOperation();
indexingOperation1.setEntityType("blog");
indexingOperation1.setOperation(OperationType.INIT);
indexingOperationDAO.create(indexingOperation1);
PortalContainer container = PortalContainer.getInstance();
entityMgrService = container.getComponentInstanceOfType(EntityManagerService.class);
entityMgrService.getEntityManager().flush();
entityMgrService.getEntityManager().refresh(indexingOperation1);
//When
indexingOperation1 = indexingOperationDAO.find(indexingOperation1.getId());
//Then
Field privateField = IndexingOperation.class.getDeclaredField("timestamp");
privateField.setAccessible(true);
Date timestamp = (Date) privateField.get(indexingOperation1);
assertNotNull(timestamp);
}
开发者ID:exo-archives,项目名称:exo-es-search,代码行数:20,代码来源:IndexingOperationDAOTest.java
示例2: getProvider
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
@Override
public <T> Provider<? extends T> getProvider(final Class<T> implementationType) throws Exception {
final PortalContainer container = PortalContainer.getInstance();
if (container == null) {
return null;
}
final ComponentAdapter adapter = container.getComponentAdapterOfType(implementationType);
if (adapter != null) {
return new Provider<T>() {
@Override
public T get() {
Object service = adapter.getComponentInstance(container);
if (service == null) {
throw new RuntimeException("Could not obtain service " + implementationType + " from container " + container);
}
return implementationType.cast(service);
}
};
} else {
return null;
}
}
开发者ID:exo-addons,项目名称:invite-friend,代码行数:23,代码来源:KernelProviderFactory.java
示例3: generateActivity
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
private void generateActivity() throws Exception {
// Get current user and assign to ownerStream
String username = ConversationState.getCurrent().getIdentity().getUserId();
IdentityManager identityM =
(IdentityManager) PortalContainer.getInstance().getComponentInstanceOfType(IdentityManager.class);
Identity userIdentity = identityM.getOrCreateIdentity(OrganizationIdentityProvider.NAME, username, false);
Identity ownerStream = userIdentity;
// New activity
ExoSocialActivityImpl activity = new ExoSocialActivityImpl();
activity.setUserId(userIdentity.getId());
activity.setTitle("This is an activity of type <b>" + ACTIVITY_TYPE + "</b>.");
activity.setBody("This is for testing");
activity.setType(ACTIVITY_TYPE);
// Save activity
ActivityManager activityM =
(ActivityManager) PortalContainer.getInstance().getComponentInstanceOfType(ActivityManager.class);
activityM.saveActivityNoReturn(ownerStream, activity);
}
开发者ID:exo-samples,项目名称:docs-samples,代码行数:19,代码来源:GenerateActivity4Testing.java
示例4: getProvider
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
public <T> Provider<? extends T> getProvider(final Class<T> implementationType)
{
return new Provider<T>() {
public T get() {
ExoContainer container = ExoContainerContext.getCurrentContainer();
T ret = (T)container.getComponentInstance(implementationType);
if(ret == null)
{
PortalContainer portalContainer = PortalContainer.getInstance();
ret = (T)portalContainer.getComponentInstanceOfType(implementationType);
if(ret == null)
{
RootContainer rootContainer = RootContainer.getInstance();
ret = (T)rootContainer.getComponentInstanceOfType(implementationType);
}
}
return ret;
}
};
}
开发者ID:exo-addons,项目名称:portlet-pack,代码行数:21,代码来源:GateInMetaProvider.java
示例5: setUserLastCheckDate
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
/**
*
* Sets exo and exchange last check full synchronization operation date
*
* @param username
* @param time
* @throws Exception
*/
public void setUserLastCheckDate(long time) throws Exception {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).startRequest(PortalContainer.getInstance());
}
try {
UserProfile userProfile = organizationService.getUserProfileHandler().findUserProfileByName(username);
userProfile.setAttribute(USER_EXCHANGE_HANDLED_ATTRIBUTE, "" + time);
long savedTime = userProfile.getAttribute(USER_EXO_HANDLED_ATTRIBUTE) == null ? 0 : Long.valueOf(userProfile.getAttribute(USER_EXO_HANDLED_ATTRIBUTE));
if (time > savedTime) {
userProfile.setAttribute(USER_EXO_HANDLED_ATTRIBUTE, "" + time);
}
organizationService.getUserProfileHandler().saveUserProfile(userProfile, false);
} finally {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).endRequest(PortalContainer.getInstance());
}
}
}
开发者ID:exo-addons,项目名称:exchange-extension,代码行数:27,代码来源:IntegrationService.java
示例6: getUserLastCheckDate
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
/**
*
* Gets last check full synchronization operation date
*
* @return
* @throws Exception
*/
public Date getUserLastCheckDate() throws Exception {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).startRequest(PortalContainer.getInstance());
}
try {
UserProfile userProfile = organizationService.getUserProfileHandler().findUserProfileByName(username);
long time = userProfile.getAttribute(USER_EXCHANGE_HANDLED_ATTRIBUTE) == null ? 0 : Long.valueOf(userProfile.getAttribute(USER_EXCHANGE_HANDLED_ATTRIBUTE));
Date lastSyncDate = null;
if (time > 0) {
lastSyncDate = new Date(time);
}
return lastSyncDate;
} finally {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).endRequest(PortalContainer.getInstance());
}
}
}
开发者ID:exo-addons,项目名称:exchange-extension,代码行数:26,代码来源:IntegrationService.java
示例7: setUserExoLastCheckDate
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
/**
*
* Sets exo last check operation date.
*
* @param username
* @param time
* @throws Exception
*/
public void setUserExoLastCheckDate(long time) throws Exception {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).startRequest(PortalContainer.getInstance());
}
try {
UserProfile userProfile = organizationService.getUserProfileHandler().findUserProfileByName(username);
long savedTime = userProfile.getAttribute(USER_EXO_HANDLED_ATTRIBUTE) == null ? 0 : Long.valueOf(userProfile.getAttribute(USER_EXO_HANDLED_ATTRIBUTE));
if (savedTime <= 0) {
if (LOG.isTraceEnabled()) {
LOG.trace("User '" + username + "' exo last check time was not set before, may be the synhronization was not run before or an error occured in the meantime.");
}
} else {
userProfile.setAttribute(USER_EXO_HANDLED_ATTRIBUTE, "" + time);
organizationService.getUserProfileHandler().saveUserProfile(userProfile, false);
}
} finally {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).endRequest(PortalContainer.getInstance());
}
}
}
开发者ID:exo-addons,项目名称:exchange-extension,代码行数:30,代码来源:IntegrationService.java
示例8: getUserExoLastCheckDate
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
/**
*
* Gets exo last check operation date
*
* @return
* @throws Exception
*/
public Date getUserExoLastCheckDate() throws Exception {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).startRequest(PortalContainer.getInstance());
}
try {
UserProfile userProfile = organizationService.getUserProfileHandler().findUserProfileByName(username);
long time = userProfile.getAttribute(USER_EXO_HANDLED_ATTRIBUTE) == null ? 0 : Long.valueOf(userProfile.getAttribute(USER_EXO_HANDLED_ATTRIBUTE));
Date lastSyncDate = null;
if (time > 0) {
lastSyncDate = new Date(time);
}
return lastSyncDate;
} finally {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).endRequest(PortalContainer.getInstance());
}
}
}
开发者ID:exo-addons,项目名称:exchange-extension,代码行数:26,代码来源:IntegrationService.java
示例9: setUserArrtibute
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
/**
*
* @param organizationService
* @param username
* @param name
* @param value
* @throws Exception
*/
public static void setUserArrtibute(OrganizationService organizationService, String username, String name, String value) throws Exception {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).startRequest(PortalContainer.getInstance());
}
try {
if (USER_EXCHANGE_PASSWORD_ATTRIBUTE.equals(name)) {
value = encodePassword(value);
}
UserProfile userProfile = organizationService.getUserProfileHandler().findUserProfileByName(username);
if (userProfile == null) {
userProfile = organizationService.getUserProfileHandler().createUserProfileInstance(username);
organizationService.getUserProfileHandler().saveUserProfile(userProfile, true);
}
userProfile.setAttribute(name, value);
organizationService.getUserProfileHandler().saveUserProfile(userProfile, false);
} finally {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).endRequest(PortalContainer.getInstance());
}
}
}
开发者ID:exo-addons,项目名称:exchange-extension,代码行数:30,代码来源:IntegrationService.java
示例10: getUserArrtibute
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
/**
*
* @param organizationService
* @param username
* @param name
* @return
* @throws Exception
*/
public static String getUserArrtibute(OrganizationService organizationService, String username, String name) throws Exception {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).startRequest(PortalContainer.getInstance());
}
try {
UserProfile userProfile = organizationService.getUserProfileHandler().findUserProfileByName(username);
String value = null;
if (userProfile != null) {
value = userProfile.getAttribute(name);
if (value != null && USER_EXCHANGE_PASSWORD_ATTRIBUTE.equals(name)) {
value = decodePassword(value);
}
}
return value;
} finally {
if (organizationService instanceof ComponentRequestLifecycle) {
((ComponentRequestLifecycle) organizationService).endRequest(PortalContainer.getInstance());
}
}
}
开发者ID:exo-addons,项目名称:exchange-extension,代码行数:29,代码来源:IntegrationService.java
示例11: initializeContainerAndStartRequestLifecycle
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
@Before
public void initializeContainerAndStartRequestLifecycle() {
PortalContainer container = PortalContainer.getInstance();
RequestLifeCycle.begin(container);
entityMgrService = container.getComponentInstanceOfType(EntityManagerService.class);
entityMgrService.getEntityManager().getTransaction().begin();
}
开发者ID:exo-archives,项目名称:exo-es-search,代码行数:10,代码来源:AbstractDAOTest.java
示例12: getService
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
/**
* Gets the service.
*
* @param clazz the class
* @param containerName the container's name
*
* @return the service
*/
public static <T> T getService(Class<T> clazz, String containerName) {
ExoContainer container = ExoContainerContext.getCurrentContainer();
if (containerName != null) {
container = RootContainer.getInstance().getPortalContainer(containerName);
}
if (container.getComponentInstanceOfType(clazz)==null) {
containerName = PortalContainer.getCurrentPortalContainerName();
container = RootContainer.getInstance().getPortalContainer(containerName);
}
return clazz.cast(container.getComponentInstanceOfType(clazz));
}
开发者ID:exo-addons,项目名称:marketplace-extension,代码行数:20,代码来源:UIAddOnSearchForm.java
示例13: getRelationshipStorage
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
private RelationshipStorage getRelationshipStorage() {
if (relationshipStorage == null) {
relationshipStorage = (RelationshipStorage) PortalContainer.getInstance().
getComponentInstanceOfType(RelationshipStorage.class);
}
return relationshipStorage;
}
开发者ID:exosocial,项目名称:addons-social-activity-mongodb,代码行数:8,代码来源:ActivityMongoStorageImpl.java
示例14: getSpaceStorage
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
private SpaceStorage getSpaceStorage() {
if (spaceStorage == null) {
spaceStorage = (SpaceStorage) PortalContainer.getInstance().getComponentInstanceOfType(SpaceStorage.class);
}
return spaceStorage;
}
开发者ID:exosocial,项目名称:addons-social-activity-mongodb,代码行数:8,代码来源:ActivityMongoStorageImpl.java
示例15: getIdentityStorage
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
private IdentityStorage getIdentityStorage() {
if (identityStorage == null) {
identityStorage = (IdentityStorage) PortalContainer.getInstance().getComponentInstanceOfType(IdentityStorage.class);
}
return identityStorage;
}
开发者ID:exosocial,项目名称:addons-social-activity-mongodb,代码行数:8,代码来源:ActivityMongoStorageImpl.java
示例16: getStorage
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
private ActivityStorage getStorage() {
if (activityStorage == null) {
activityStorage = (ActivityStorage) PortalContainer.getInstance().getComponentInstanceOfType(ActivityStorage.class);
}
return activityStorage;
}
开发者ID:exosocial,项目名称:addons-social-activity-mongodb,代码行数:8,代码来源:ActivityMongoStorageImpl.java
示例17: getExchangeListenerService
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
public IntegrationListener getExchangeListenerService() {
if (exchangeListenerService == null) {
try {
this.exchangeListenerService = (IntegrationListener) PortalContainer.getInstance().getComponentInstanceOfType(IntegrationListener.class);
} catch (Exception e) {
LOG.error(e);
}
}
return exchangeListenerService;
}
开发者ID:exo-addons,项目名称:exchange-extension,代码行数:11,代码来源:ExchangeLoginListener.java
示例18: setUp
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
@Before
public void setUp() {
PortalContainer container = PortalContainer.getInstance();
indexingOperationDAO = container.getComponentInstanceOfType(IndexingOperationDAO.class);
}
开发者ID:exo-archives,项目名称:exo-es-search,代码行数:6,代码来源:IndexingOperationDAOTest.java
示例19: getMongoStorage
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
private MongoStorage getMongoStorage() {
if (mongoStorage == null) {
mongoStorage = (MongoStorage) PortalContainer.getInstance().getComponentInstanceOfType(MongoStorage.class);
}
return mongoStorage;
}
开发者ID:exosocial,项目名称:addons-social-activity-mongodb,代码行数:7,代码来源:ActivityMongoStorageImpl.java
示例20: getSession
import org.exoplatform.container.PortalContainer; //导入依赖的package包/类
private Session getSession() throws RepositoryException {
PortalContainer container = PortalContainer.getInstance();
RepositoryService repositoryService = (RepositoryService) container.getComponentInstance(RepositoryService.class);
ManageableRepository repository = repositoryService.getCurrentRepository();
return repository.getSystemSession("portal-test");
}
开发者ID:exosocial,项目名称:addons-social-activity-mongodb,代码行数:7,代码来源:AbstractCoreTest.java
注:本文中的org.exoplatform.container.PortalContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论