List of usage examples for com.liferay.portal.util PropsValues MOBILE_DEVICE_RULES_RULE_GROUP_COPY_POSTFIX
String MOBILE_DEVICE_RULES_RULE_GROUP_COPY_POSTFIX
To view the source code for com.liferay.portal.util PropsValues MOBILE_DEVICE_RULES_RULE_GROUP_COPY_POSTFIX.
Click Source Link
From source file:com.liferay.mobile.device.rules.service.impl.MDRRuleGroupLocalServiceImpl.java
License:Open Source License
@Override public MDRRuleGroup copyRuleGroup(MDRRuleGroup ruleGroup, long groupId, ServiceContext serviceContext) throws PortalException { Group group = groupLocalService.getGroup(groupId); Map<Locale, String> nameMap = ruleGroup.getNameMap(); for (Map.Entry<Locale, String> entry : nameMap.entrySet()) { Locale locale = entry.getKey(); String name = entry.getValue(); if (Validator.isNull(name)) { continue; }/*from ww w . j av a2 s. c om*/ String postfix = LanguageUtil.get(locale, PropsValues.MOBILE_DEVICE_RULES_RULE_GROUP_COPY_POSTFIX); nameMap.put(locale, name.concat(StringPool.SPACE).concat(postfix)); } MDRRuleGroup newRuleGroup = addRuleGroup(group.getGroupId(), nameMap, ruleGroup.getDescriptionMap(), serviceContext); List<MDRRule> rules = mdrRulePersistence.findByRuleGroupId(ruleGroup.getRuleGroupId()); for (MDRRule rule : rules) { serviceContext.setUuid(PortalUUIDUtil.generate()); mdrRuleLocalService.copyRule(rule, newRuleGroup.getRuleGroupId(), serviceContext); } return newRuleGroup; }
From source file:com.liferay.portlet.mobiledevicerules.service.impl.MDRRuleGroupLocalServiceImpl.java
License:Open Source License
public MDRRuleGroup copyRuleGroup(MDRRuleGroup ruleGroup, long groupId, ServiceContext serviceContext) throws PortalException, SystemException { Group group = groupPersistence.findByPrimaryKey(groupId); Map<Locale, String> nameMap = ruleGroup.getNameMap(); for (Map.Entry<Locale, String> entry : nameMap.entrySet()) { Locale locale = entry.getKey(); String name = entry.getValue(); if (Validator.isNull(name)) { continue; }// ww w.j a v a 2 s . c o m String postfix = LanguageUtil.get(locale, PropsValues.MOBILE_DEVICE_RULES_RULE_GROUP_COPY_POSTFIX); nameMap.put(locale, name.concat(StringPool.SPACE).concat(postfix)); } MDRRuleGroup newRuleGroup = addRuleGroup(group.getGroupId(), nameMap, ruleGroup.getDescriptionMap(), serviceContext); List<MDRRule> rules = mdrRulePersistence.findByRuleGroupId(ruleGroup.getRuleGroupId()); for (MDRRule rule : rules) { serviceContext.setUuid(PortalUUIDUtil.generate()); mdrRuleLocalService.copyRule(rule, newRuleGroup.getRuleGroupId(), serviceContext); } return newRuleGroup; }