public void updateService(ApiService service) {
   Connection conn = null;
   PreparedStatement stat = null;
   try {
     conn = this.getConnection();
     conn.setAutoCommit(false);
     stat = conn.prepareStatement(UPDATE_SERVICE);
     // SET resource = ? , description = ? , parameters = ? , tag = ? , freeparameters = ? ,
     // isactive = ? , ispublic = ? WHERE servicekey = ? ";
     stat.setString(1, service.getMaster().getResourceName());
     stat.setString(2, service.getDescription().toXml());
     stat.setString(3, service.getParameters().toXml());
     stat.setString(4, service.getTag());
     if (null == service.getFreeParameters() || service.getFreeParameters().length == 0) {
       stat.setNull(5, Types.VARCHAR);
     } else {
       ServiceExtraConfigDOM dom = new ServiceExtraConfigDOM();
       stat.setString(5, dom.extractXml(service.getFreeParameters()));
     }
     int isActive = (service.isActive()) ? 1 : 0;
     stat.setInt(6, isActive);
     int isPublic = (service.isPublicService()) ? 1 : 0;
     stat.setInt(7, isPublic);
     int isMyEntando = (service.isMyEntando()) ? 1 : 0;
     stat.setInt(8, isMyEntando);
     stat.setString(9, service.getKey());
     stat.executeUpdate();
     conn.commit();
   } catch (Throwable t) {
     this.executeRollback(conn);
     processDaoException(t, "Error while updating a service", "updateService");
   } finally {
     closeDaoResources(null, stat, conn);
   }
 }
 private void buildService(
     Map<String, ApiMethod> methods,
     Map<String, ApiService> services,
     List<String> invalidServices,
     ResultSet res) {
   String key = null;
   try {
     key = res.getString(1);
     String parentCode = res.getString(2);
     ApiMethod masterMethod = methods.get(parentCode);
     if (null != masterMethod) {
       ApsProperties description = new ApsProperties();
       description.loadFromXml(res.getString(3));
       ApsProperties parameters = new ApsProperties();
       parameters.loadFromXml(res.getString(4));
       String tag = res.getString(5);
       String[] freeParameters = null;
       String freeParamString = res.getString(6);
       if (null != freeParamString && freeParamString.trim().length() > 0) {
         ServiceExtraConfigDOM dom = new ServiceExtraConfigDOM(freeParamString);
         freeParameters = dom.extractFreeParameters();
       }
       boolean isActive = (1 == res.getInt(7)) ? true : false;
       boolean isPublic = (1 == res.getInt(8)) ? true : false;
       boolean isMyEntando = (1 == res.getInt(9)) ? true : false;
       ApiService apiService =
           new ApiService(
               key,
               description,
               masterMethod,
               parameters,
               freeParameters,
               tag,
               isPublic,
               isActive,
               isMyEntando);
       services.put(key, apiService);
     } else {
       invalidServices.add(key);
     }
   } catch (Throwable t) {
     ApsSystemUtils.logThrowable(
         t, this, "buildService", "Error building service - key '" + key + "'");
   }
 }