Criação de uma classe de atualização
O process action que vai ser criado para a atualização dos registros, utiliza a seguinte classe java:
AخA
1
package corporate.hoteisadmin6;
2
import java.sql.Connection;
3
import java.sql.PreparedStatement;
4
import lumis.portal.PortalException;
5
import lumis.portal.UnexpectedException;
6
import lumis.portal.dao.DaoException;
7
import lumis.portal.dao.jdbc.ITransactionJdbc;
8
import lumis.util.ITransaction;
9
public class HotelDaoJdbc
10
{
11
public void definirLotados(String[] hotelIds, ITransaction transaction) throws DaoException, PortalException
12
{
13
try
14
{
15
ITransactionJdbc daoTransactionJdbc = (ITransactionJdbc) transaction;
16
Connection connection = daoTransactionJdbc.getConnection();
17
String hotelIdsList = "";
18
for(String hotelId : hotelIds)
19
hotelIdsList += "'"+hotelId+"',";
20
21
if(hotelIdsList.length() > 0)
22
hotelIdsList = hotelIdsList.substring(0, hotelIdsList.length()-1);
23
else
24
return;
25
26
PreparedStatement statement = connection.prepareStatement("update tr3_hotel set lotado = 1 where hotelId in ("+hotelIdsList+")");
27
try
28
{
29
statement.executeUpdate();
30
}
31
finally
32
{
33
statement.close();
34
}
35
}
36
catch (PortalException e)
37
{
38
throw e;
39
}
40
catch (Exception e)
41
{
42
throw new UnexpectedException(e);
43
}
44
}
45
}