List of usage examples for com.liferay.portal.kernel.service OrganizationLocalServiceUtil addOrganization
public static com.liferay.portal.kernel.model.Organization addOrganization(long userId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusId, String comments, boolean site, ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException
From source file:com.liferay.asset.service.test.AssetCategoryLocalServiceTest.java
License:Open Source License
@Test public void testDeleteCategory() throws Exception { Map<Locale, String> titleMap = new HashMap<>(); titleMap.put(LocaleUtil.US, RandomTestUtil.randomString()); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId(), TestPropsValues.getUserId()); AssetVocabulary assetVocabulary = AssetVocabularyLocalServiceUtil.addVocabulary(TestPropsValues.getUserId(), _group.getGroupId(), RandomTestUtil.randomString(), titleMap, null, null, serviceContext); AssetCategory assetCategory = AssetCategoryLocalServiceUtil.addCategory(TestPropsValues.getUserId(), _group.getGroupId(), RandomTestUtil.randomString(), assetVocabulary.getVocabularyId(), serviceContext);/* w ww .ja v a2 s . co m*/ serviceContext.setAssetCategoryIds(new long[] { assetCategory.getCategoryId() }); _organization = OrganizationLocalServiceUtil.addOrganization(TestPropsValues.getUserId(), OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID, RandomTestUtil.randomString(), OrganizationConstants.TYPE_ORGANIZATION, 0, 0, ListTypeConstants.ORGANIZATION_STATUS_DEFAULT, RandomTestUtil.randomString(), true, serviceContext); TestAssetIndexer testAssetIndexer = new TestAssetIndexer(); testAssetIndexer.setExpectedValues(Organization.class.getName(), _organization.getOrganizationId()); if (_organizationIndexer == null) { _organizationIndexer = IndexerRegistryUtil.getIndexer(Organization.class); } IndexerRegistryUtil.register(testAssetIndexer); AssetCategoryLocalServiceUtil.deleteCategory(assetCategory, true); }
From source file:com.liferay.asset.service.test.AssetTagLocalServiceTest.java
License:Open Source License
@Test public void testDeleteTag() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId(), TestPropsValues.getUserId()); AssetTag assetTag = AssetTagLocalServiceUtil.addTag(TestPropsValues.getUserId(), _group.getGroupId(), "Tag", serviceContext);//w w w. ja va 2 s . co m serviceContext.setAssetTagNames(new String[] { assetTag.getName() }); _organization = OrganizationLocalServiceUtil.addOrganization(TestPropsValues.getUserId(), OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID, RandomTestUtil.randomString(), OrganizationConstants.TYPE_ORGANIZATION, 0, 0, ListTypeConstants.ORGANIZATION_STATUS_DEFAULT, RandomTestUtil.randomString(), true, serviceContext); TestAssetIndexer testAssetIndexer = new TestAssetIndexer(); testAssetIndexer.setExpectedValues(Organization.class.getName(), _organization.getOrganizationId()); if (_organizationIndexer == null) { _organizationIndexer = IndexerRegistryUtil.getIndexer(Organization.class); } IndexerRegistryUtil.register(testAssetIndexer); AssetTagLocalServiceUtil.deleteTag(assetTag); Assert.assertNull(AssetTagLocalServiceUtil.fetchAssetTag(assetTag.getTagId())); long classNameId = PortalUtil.getClassNameId(Organization.class); AssetTagStats assetTagStats = AssetTagStatsLocalServiceUtil.getTagStats(assetTag.getTagId(), classNameId); Assert.assertEquals(0, assetTagStats.getAssetCount()); }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularOrganizationServiceImpl.java
License:Open Source License
@Override public Organization createOrganization(String name, String type, long regionId, long countryId, long statusId, String comment, boolean site, long[] addresses, long[] emailAddresses, long[] phones, long[] websites, long[] orgLabors) throws PortalException { _log.info("Creating organization ... "); _log.debug(" ... security check ..."); PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.ADD_ORGANIZATION); _log.debug(" ... saving information ... "); User creator = this.getGuestOrUser(); ServiceContext serviceContext = new ServiceContext(); Organization organization = OrganizationLocalServiceUtil.addOrganization(creator.getUserId(), OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID, name, type, regionId, countryId, statusId, comment, site, serviceContext); _log.debug(" ... organization ..."); this.updateOrganizationParts(organization, addresses, emailAddresses, phones, websites, orgLabors); return organization; }