List of usage examples for com.liferay.portal.kernel.model ListTypeConstants ORGANIZATION_STATUS_DEFAULT
int ORGANIZATION_STATUS_DEFAULT
To view the source code for com.liferay.portal.kernel.model ListTypeConstants ORGANIZATION_STATUS_DEFAULT.
Click Source Link
From source file:com.bemis.portal.migration.customer.service.impl.CustomerMigrationLocalServiceImpl.java
License:Open Source License
protected Organization addOrganizationFromCustomer(long userId, CustomerOrg aCustomerOrgParent, long setPrototypeId, long parentOrganizationId) { String organizationType = OrganizationConstants.TYPE_ORGANIZATION; long statusId = ListTypeConstants.ORGANIZATION_STATUS_DEFAULT; long countryId = CountryServiceUtil.fetchCountryByA2(aCustomerOrgParent.getCountry()).getCountryId(); long regionId = RegionServiceUtil.fetchRegion(countryId, aCustomerOrgParent.getState()).getRegionId(); String bemisCustomerId = aCustomerOrgParent.getBemisCustomerId(); String bemisParentOrg = aCustomerOrgParent.getBemisParentId(); Organization anOrganization = null;// w w w . j av a 2s.c o m String name = ""; // @TODO Custom fields need to be finalized from the customer profile // Only parent organizations get the default and the short name if (parentOrganizationId == OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID) { name = aCustomerOrgParent.getCustomerName(); organizationType = PARENT_LOCATION_TYPE; } else { name = aCustomerOrgParent.getCustomerName() + " - " + aCustomerOrgParent.getCity(); organizationType = CUSTOMER_LOCATION_TYPE; } try { anOrganization = _organizationLocalService.getOrganization(_bemisPortalService.getDefaultCompanyId(), name); if (_log.isDebugEnabled()) { _log.debug(">>> Organization with id [" + anOrganization.getOrganizationId() + "] already exists"); } } catch (NoSuchOrganizationException nsoe) { // If we are a new organization, let us add it. try { // Create an organization with a site anOrganization = addOrganization(userId, parentOrganizationId, name, organizationType, regionId, countryId, statusId, null, true, null, bemisCustomerId, bemisParentOrg); // Now we map the site to the customer template Group organizationGroup = anOrganization.getGroup(); SitesUtil.updateLayoutSetPrototypesLinks(organizationGroup, 0, setPrototypeId, true, true); _log.debug(">>> Created an Organization with id [" + anOrganization.getOrganizationId() + "]"); } catch (Exception pe) { _log.error(pe); } } catch (PortalException pe) { _log.error(">>> Error creating Organization for Customer [" + name + "]", pe); } return anOrganization; }
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);//from w ww. j a v a 2 s . c o 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);/*from w w w. j a v a 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()); }