1
14
15 package com.liferay.portal.upgrade.v4_3_0.util;
16
17 import com.liferay.portal.kernel.dao.jdbc.DataAccess;
18
19 import java.sql.Connection;
20 import java.sql.PreparedStatement;
21 import java.sql.ResultSet;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26
31 public class WebIdUtil {
32
33 public static String[] getWebIds() throws Exception {
34 if (_webIds != null) {
35 return _webIds;
36 }
37
38 List<String> webIds = new ArrayList<String>();
39
40 Connection con = null;
41 PreparedStatement ps = null;
42 ResultSet rs = null;
43
44 try {
45 con = DataAccess.getConnection();
46
47 ps = con.prepareStatement(_GET_WEB_IDS);
48
49 rs = ps.executeQuery();
50
51 while (rs.next()) {
52 String companyId = rs.getString("companyId");
53
54 webIds.add(companyId);
55 }
56 }
57 finally {
58 DataAccess.cleanUp(con, ps, rs);
59 }
60
61 _webIds = webIds.toArray(new String[webIds.size()]);
62
63 return _webIds;
64 }
65
66 private static final String _GET_WEB_IDS = "select companyId from Company";
67
68 private static String[] _webIds;
69
70 }