1
22
23 package com.liferay.portal.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.model.Company;
28 import com.liferay.portal.model.RoleConstants;
29 import com.liferay.portal.security.auth.PrincipalException;
30 import com.liferay.portal.service.base.CompanyServiceBaseImpl;
31
32 import java.io.File;
33
34
40 public class CompanyServiceImpl extends CompanyServiceBaseImpl {
41
42 public Company addCompany(String webId, String virtualHost, String mx)
43 throws PortalException, SystemException {
44
45 if (!getPermissionChecker().isOmniadmin()) {
46 throw new PrincipalException();
47 }
48
49 return companyLocalService.addCompany(webId, virtualHost, mx);
50 }
51
52 public Company getCompanyById(long companyId)
53 throws PortalException, SystemException {
54
55 return companyLocalService.getCompanyById(companyId);
56 }
57
58 public Company getCompanyByLogoId(long logoId)
59 throws PortalException, SystemException {
60
61 return companyLocalService.getCompanyByLogoId(logoId);
62 }
63
64 public Company getCompanyByMx(String mx)
65 throws PortalException, SystemException {
66
67 return companyLocalService.getCompanyByMx(mx);
68 }
69
70 public Company getCompanyByVirtualHost(String virtualHost)
71 throws PortalException, SystemException {
72
73 return companyLocalService.getCompanyByVirtualHost(virtualHost);
74 }
75
76 public Company getCompanyByWebId(String webId)
77 throws PortalException, SystemException {
78
79 return companyLocalService.getCompanyByWebId(webId);
80 }
81
82 public Company updateCompany(long companyId, String virtualHost, String mx)
83 throws PortalException, SystemException {
84
85 if (!getPermissionChecker().isOmniadmin()) {
86 throw new PrincipalException();
87 }
88
89 return companyLocalService.updateCompany(companyId, virtualHost, mx);
90 }
91
92 public Company updateCompany(
93 long companyId, String virtualHost, String mx, String homeURL,
94 String name, String legalName, String legalId, String legalType,
95 String sicCode, String tickerSymbol, String industry, String type,
96 String size)
97 throws PortalException, SystemException {
98
99 if (!roleLocalService.hasUserRole(
100 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
101
102 throw new PrincipalException();
103 }
104
105 return companyLocalService.updateCompany(
106 companyId, virtualHost, mx, homeURL, name, legalName, legalId,
107 legalType, sicCode, tickerSymbol, industry, type, size);
108 }
109
110 public void updateDisplay(
111 long companyId, String languageId, String timeZoneId)
112 throws PortalException, SystemException {
113
114 if (!roleLocalService.hasUserRole(
115 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
116
117 throw new PrincipalException();
118 }
119
120 companyLocalService.updateDisplay(companyId, languageId, timeZoneId);
121 }
122
123 public void updateLogo(long companyId, File file)
124 throws PortalException, SystemException {
125
126 if (!roleLocalService.hasUserRole(
127 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
128
129 throw new PrincipalException();
130 }
131
132 companyLocalService.updateLogo(companyId, file);
133 }
134
135 public void updateSecurity(
136 long companyId, String authType, boolean autoLogin,
137 boolean sendPassword, boolean strangers, boolean strangersWithMx,
138 boolean strangersVerify, boolean communityLogo)
139 throws PortalException, SystemException {
140
141 if (!roleLocalService.hasUserRole(
142 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
143
144 throw new PrincipalException();
145 }
146
147 companyLocalService.updateSecurity(
148 companyId, authType, autoLogin, sendPassword, strangers,
149 strangersWithMx, strangersVerify, communityLogo);
150 }
151
152 }