001
014
015 package com.liferay.portal.upgrade.v4_3_0.util;
016
017 import com.liferay.portal.kernel.dao.jdbc.DataAccess;
018
019 import java.sql.Connection;
020 import java.sql.PreparedStatement;
021 import java.sql.ResultSet;
022
023 import java.util.ArrayList;
024 import java.util.List;
025
026
029 public class WebIdUtil {
030
031 public static String[] getWebIds() throws Exception {
032 if (_webIds != null) {
033 return _webIds;
034 }
035
036 List<String> webIds = new ArrayList<String>();
037
038 Connection con = null;
039 PreparedStatement ps = null;
040 ResultSet rs = null;
041
042 try {
043 con = DataAccess.getConnection();
044
045 ps = con.prepareStatement(_GET_WEB_IDS);
046
047 rs = ps.executeQuery();
048
049 while (rs.next()) {
050 String companyId = rs.getString("companyId");
051
052 webIds.add(companyId);
053 }
054 }
055 finally {
056 DataAccess.cleanUp(con, ps, rs);
057 }
058
059 _webIds = webIds.toArray(new String[webIds.size()]);
060
061 return _webIds;
062 }
063
064 private static final String _GET_WEB_IDS = "select companyId from Company";
065
066 private static String[] _webIds;
067
068 }