package org.cloudfoundry.community.servicebroker.postgresql.service;

import java.sql.SQLException;
import java.util.UUID;

public class Utils {
    public static void checkValidUUID(String instanceId) throws SQLException{
        UUID uuid = UUID.fromString(instanceId);

        if(!instanceId.equals(uuid.toString())) {
            throw new SQLException("UUID '" + instanceId + "' is not an UUID.");
        }
    }
}
@@ -83,339 +83,1101 @@
 sql.
-SQLException;%0Aimport java.util.UUID;%0A%0Apublic class Utils %7B%0A    public static void checkValidUUID(String instanceId) throws SQLException%7B%0A        UUID uuid = UUID.fromString(instanceId);%0A%0A        if(!instanceId.equals(uuid.toString())) %7B%0A            throw new SQLException(%22UUID '%22 + instanceId + %22' is not an UUID.%22);%0A        %7D%0A    %7D%0A%7D
+Connection;%0Aimport java.sql.SQLException;%0Aimport java.sql.Statement;%0Aimport java.util.UUID;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Component;%0A%0A@Component%0Apublic class Utils %7B%0A    private static final Logger logger = LoggerFactory.getLogger(Utils.class);%0A    private static Connection conn;%0A%0A    @Autowired%0A    public Utils(Connection conn) %7B%0A        Utils.conn = conn;%0A    %7D%0A%0A    public static void checkValidUUID(String instanceId) throws SQLException%7B%0A        UUID uuid = UUID.fromString(instanceId);%0A%0A        if(!instanceId.equals(uuid.toString())) %7B%0A            throw new SQLException(%22UUID '%22 + instanceId + %22' is not an UUID.%22);%0A        %7D%0A    %7D%0A%0A    public static void executeUpdate(String query) throws SQLException %7B%0A        Statement statement = conn.createStatement();%0A%0A        try %7B%0A            statement.execute(query);%0A        %7D catch (SQLException e) %7B%0A            logger.warn(e.getMessage());%0A        %7D finally %7B%0A            statement.close();%0A        %7D%0A    %7D%0A%7D%0A

add executeUpdate to Utils