public int compareTo(Organization organization) { int value = 0; value = getName().compareTo(organization.getName()); if (value != 0) { return value; } return 0; }
public static Organization addSite(Organization organization) throws Exception { return OrganizationLocalServiceUtil.updateOrganization( organization.getCompanyId(), organization.getOrganizationId(), organization.getParentOrganizationId(), organization.getName(), organization.getType(), organization.getRegionId(), organization.getCountryId(), organization.getStatusId(), organization.getComments(), false, null, true, null); }
public String getOrganizationEntriesRSS( long organizationId, int max, String type, double version, String displayStyle, String feedURL, String entryURL) throws PortalException, SystemException { Organization organization = organizationPersistence.findByPrimaryKey(organizationId); String name = organization.getName(); List blogsEntries = getOrganizationEntries(organizationId, max); return exportToRSS(name, null, type, version, displayStyle, feedURL, entryURL, blogsEntries); }
@Override public String getDescriptiveName(Locale locale) throws PortalException { Group curGroup = this; String name = getName(locale); if (Validator.isNull(name)) { Locale siteDefaultLocale = PortalUtil.getSiteDefaultLocale(getGroupId()); name = getName(siteDefaultLocale); } if (isCompany() && !isCompanyStagingGroup()) { name = LanguageUtil.get(locale, "global"); } else if (isControlPanel()) { name = LanguageUtil.get(locale, "control-panel"); } else if (isGuest()) { Company company = CompanyLocalServiceUtil.getCompany(getCompanyId()); Account account = company.getAccount(); name = account.getName(); } else if (isLayout()) { Layout layout = LayoutLocalServiceUtil.getLayout(getClassPK()); name = layout.getName(locale); } else if (isLayoutPrototype()) { LayoutPrototype layoutPrototype = LayoutPrototypeLocalServiceUtil.getLayoutPrototype(getClassPK()); name = layoutPrototype.getName(locale); } else if (isLayoutSetPrototype()) { LayoutSetPrototype layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(getClassPK()); name = layoutSetPrototype.getName(locale); } else if (isOrganization()) { long organizationId = getOrganizationId(); Organization organization = OrganizationLocalServiceUtil.getOrganization(organizationId); name = organization.getName(); curGroup = organization.getGroup(); } else if (isUser()) { long userId = getClassPK(); User user = UserLocalServiceUtil.getUser(userId); name = user.getFullName(); } else if (isUserGroup()) { long userGroupId = getClassPK(); UserGroup userGroup = UserGroupLocalServiceUtil.getUserGroup(userGroupId); name = userGroup.getName(); } else if (isUserPersonalSite()) { name = LanguageUtil.get(locale, "user-personal-site"); } if (curGroup.isStaged() && !curGroup.isStagedRemotely() && curGroup.isStagingGroup()) { Group liveGroup = getLiveGroup(); name = liveGroup.getDescriptiveName(locale); } return name; }
protected void notifyUsers(AnnouncementsEntry entry) throws PortalException { Company company = companyPersistence.findByPrimaryKey(entry.getCompanyId()); String className = entry.getClassName(); long classPK = entry.getClassPK(); String toName = PropsValues.ANNOUNCEMENTS_EMAIL_TO_NAME; String toAddress = PropsValues.ANNOUNCEMENTS_EMAIL_TO_ADDRESS; long teamId = 0; LinkedHashMap<String, Object> params = new LinkedHashMap<>(); params.put("announcementsDeliveryEmailOrSms", entry.getType()); if (classPK > 0) { if (className.equals(Group.class.getName())) { Group group = groupPersistence.findByPrimaryKey(classPK); toName = group.getDescriptiveName(); params.put("inherit", Boolean.TRUE); params.put("usersGroups", classPK); } else if (className.equals(Organization.class.getName())) { Organization organization = organizationPersistence.findByPrimaryKey(classPK); toName = organization.getName(); params.put("usersOrgsTree", ListUtil.fromArray(new Organization[] {organization})); } else if (className.equals(Role.class.getName())) { Role role = rolePersistence.findByPrimaryKey(classPK); toName = role.getName(); if (role.getType() == RoleConstants.TYPE_REGULAR) { params.put("inherit", Boolean.TRUE); params.put("usersRoles", classPK); } else if (role.isTeam()) { teamId = role.getClassPK(); } else { params.put("userGroupRole", new Long[] {Long.valueOf(0), classPK}); } } else if (className.equals(UserGroup.class.getName())) { UserGroup userGroup = userGroupPersistence.findByPrimaryKey(classPK); toName = userGroup.getName(); params.put("usersUserGroups", classPK); } } if (className.equals(User.class.getName())) { User user = userPersistence.findByPrimaryKey(classPK); if (Validator.isNull(user.getEmailAddress())) { return; } notifyUsers( ListUtil.fromArray(new User[] {user}), entry, company.getLocale(), user.getEmailAddress(), user.getFullName()); } else { int count = 0; if (teamId > 0) { count = userLocalService.getTeamUsersCount(teamId); } else { count = userLocalService.searchCount( company.getCompanyId(), null, WorkflowConstants.STATUS_APPROVED, params); } int pages = count / Indexer.DEFAULT_INTERVAL; for (int i = 0; i <= pages; i++) { int start = (i * Indexer.DEFAULT_INTERVAL); int end = start + Indexer.DEFAULT_INTERVAL; List<User> users = null; if (teamId > 0) { users = userLocalService.getTeamUsers(teamId, start, end); } else { users = userLocalService.search( company.getCompanyId(), null, WorkflowConstants.STATUS_APPROVED, params, start, end, (OrderByComparator<User>) null); } notifyUsers(users, entry, company.getLocale(), toAddress, toName); } } }