use of com.liferay.portal.kernel.model.Group in project liferay-imex by jpdacunha.
the class SiteImporter method doUpdateSitesHierarchy.
private void doUpdateSitesHierarchy(long companyId, Map<String, String> toUpdateParentGroups, boolean debug) {
reportService.getStartMessage(_log, "Managing sites hierarchy");
if (toUpdateParentGroups.size() == 0) {
reportService.getMessage(_log, "no hierarchy to manage");
} else {
for (Entry<String, String> entry : toUpdateParentGroups.entrySet()) {
String friendlyURL = null;
try {
friendlyURL = entry.getKey();
String parentGroupIdFriendlyUrl = entry.getValue();
Group group = groupLocalService.getFriendlyURLGroup(companyId, friendlyURL);
siteCommonService.attachToParentSite(group, parentGroupIdFriendlyUrl);
} catch (Exception e) {
reportService.getError(_log, friendlyURL, e);
if (debug) {
_log.error(e, e);
}
}
}
}
reportService.getEndMessage(_log, "Managing sites hierarchy");
}
use of com.liferay.portal.kernel.model.Group in project liferay-imex by jpdacunha.
the class SiteImporter method updateLiferayGroup.
private Group updateLiferayGroup(UnicodeProperties typeSettingsProperties, ServiceContext serviceContext, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, int type, String friendlyURL, boolean active, int membershipRestriction, boolean manualMembership, boolean inheritContent, long defaultParentGroupId, Group group) throws PortalException {
long groupId = group.getGroupId();
Group updatedGroup = groupLocalService.updateGroup(groupId, defaultParentGroupId, nameMap, descriptionMap, type, manualMembership, membershipRestriction, friendlyURL, inheritContent, active, serviceContext);
updatedGroup = groupLocalService.updateGroup(groupId, typeSettingsProperties.toString());
return updatedGroup;
}
use of com.liferay.portal.kernel.model.Group in project liferay-imex by jpdacunha.
the class SiteCommonServiceImpl method eraseSiteHierarchy.
@Override
@Transactional
public void eraseSiteHierarchy(Group group) throws PortalException {
ClassLoader classLoader = getClass().getClassLoader();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Group.class, classLoader).add(RestrictionsFactoryUtil.eq("parentGroupId", group.getGroupId())).setProjection(ProjectionFactoryUtil.property("groupId"));
List<Long> siteChilds = groupLocalService.dynamicQuery(dynamicQuery);
for (long childGroupId : siteChilds) {
Group childGroup = groupLocalService.getGroup(childGroupId);
this.detachGroupFromParent(childGroup);
reportService.getMessage(_log, "Detached [" + childGroup.getFriendlyURL() + "] from [" + group.getFriendlyURL() + "] ...");
}
}
use of com.liferay.portal.kernel.model.Group in project liferay-imex by jpdacunha.
the class AdtExporter method doExport.
@Override
public void doExport(User user, Properties config, File adtDir, long companyId, Locale locale, List<ExporterRawContent> rawContentToExport, boolean debug) {
reportService.getStartMessage(_log, "ADT export process");
boolean enabled = GetterUtil.getBoolean(config.get(ImExWCDDmExporterPropsKeys.EXPORT_ADT_ENABLED));
if (enabled) {
String stringList = GetterUtil.getString(config.get(ImExWCDDmExporterPropsKeys.EXPORT_ADT_TYPES_LIST));
List<String> types = CollectionUtil.getList(stringList);
if (types != null && types.size() > 0) {
try {
List<Group> groups = groupLocalService.getCompanyGroups(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
for (Group group : groups) {
boolean isSite = group.isSite() && !group.getFriendlyURL().equals("/control_panel");
if (isSite) {
reportService.getStartMessage(_log, group, locale);
for (String classType : types) {
doExport(config, group, adtDir, locale, debug, classType, rawContentToExport);
}
reportService.getEndMessage(_log, group, locale);
} else {
reportService.getSkipped(_log, "group : " + GroupUtil.getGroupName(group, locale));
}
}
} catch (ImexException e) {
_log.error(e, e);
reportService.getError(_log, e);
}
} else {
reportService.getMessage(_log, "No configured types to export");
}
} else {
reportService.getDisabled(_log, DESCRIPTION);
}
reportService.getEndMessage(_log, "ADT export process");
}
use of com.liferay.portal.kernel.model.Group in project liferay-imex by jpdacunha.
the class SiteCommonServiceImpl method getSiteParentGroupId.
@Override
public long getSiteParentGroupId(long companyId, String parentGroupIdFriendlyUrl) throws PortalException {
long parentGroupId = GroupConstants.DEFAULT_PARENT_GROUP_ID;
Group parentGroup = this.getSiteByFriendlyURL(companyId, parentGroupIdFriendlyUrl);
if (parentGroup != null) {
parentGroupId = parentGroup.getGroupId();
}
return parentGroupId;
}
Aggregations