import java.sql.*; import java.util.*; import com.adeptia.indigo.services.transport.connector.DatabaseConnectionInfo; import com.adeptia.indigo.storage.Criteria; import com.adeptia.indigo.storage.Entity; import com.adeptia.indigo.storage.EntityManager; import com.adeptia.indigo.storage.EntityManagerFactory; import com.adeptia.indigo.utils.*; import com.adeptia.indigo.security.AuthUtil; Connection _connection = null; Statement statement = null; ResultSet resultSet = null; String query = ""; String databaseInfoName = "myDatabase"; String filePath = context.get("sourceFilePath"); String sourceFileName = context.get("sourceFileName"); String sourceSchemaTypeId = ""; String mappingTypeId = ""; //extracting file name so that the target output file name use the same prefix // this variable is set into the context at the end of this code sourcefileName = sourceFileName.substring(0,sourceFileName.lastIndexOf(".") ); //making a connection using DBInfo try { if ((_connection != null) && (!_connection.isClosed())) { return _connection; } else { DatabaseConnectionInfo databaseConnectionInfo = null; EntityManager entityManager = EntityManagerFactory.getEntityManager(DatabaseConnectionInfo.class, AuthUtil.getAdminSubject()); Criteria criteria = new Criteria("p.entityName=\"" + databaseInfoName + "\""); Iterator it = entityManager.retrieve(criteria); if (it != null) { if (it.hasNext()) { databaseConnectionInfo = (DatabaseConnectionInfo) it.next(); } else { throw new ServiceException("Connection information not available"); } } _connection = JdbcUtils.getConnection(databaseConnectionInfo ,AuthUtil.getAdminSubject()); } } catch (Exception e) { throw e; } //To fetch all vaues from AU_CUSTOM table try { //To Change Table name and Query change here query = "SELECT * FROM AU_CUSTOM where AU_FilePath ='"+filePath +"'"; statement = _connection.createStatement(); resultSet = statement.executeQuery(query); } catch (SQLException e) { throw e; } // To get column value code in following while block // String groupAdminId = ""; String sourceSchemaTypeId = ""; String mappingTypeId = ""; String targetPath = ""; while (resultSet.next()){ sourceSchemaTypeId = resultSet.getString("AU_SchemaId"); mappingTypeId = resultSet.getString("AU_MappingId"); targetPath = resultSet.getString("AU_TargetPath"); } context.put("sourceSchemaTypeId",sourceSchemaTypeId ); context.put("mappingTypeId",mappingTypeId ); context.put("targetPath",targetPath ); context.put("targetFileName",sourceFileName );