http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySet.java deleted file mode 100644 index 3460353..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySet.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset; - - -public class SqliteQuerySet extends QuerySet { -}
http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySetHueDb.java new file mode 100644 index 0000000..b5841c3 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySetHueDb.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset; + + +public class SqliteQuerySetHueDb extends QuerySetHueDb { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySet.java deleted file mode 100644 index a9e2ef5..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySet.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; - - -public class MysqlQuerySet extends QuerySet { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySetHueDb.java new file mode 100644 index 0000000..3c84947 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySetHueDb.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; + + +public class MysqlQuerySetHueDb extends QuerySetHueDb { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySet.java deleted file mode 100644 index 4f9e749..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySet.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; - - -public class OracleQuerySet extends QuerySet { - @Override - protected String fetchuserIdfromUsernameSql() { - return "select id from auth_user where username=?"; - - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =?"; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time <= date(?)"; - - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?)"; - - } - @Override - protected String fetchHueQueriesYesStartdateYesEnddateSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?) AND start_time <= date(?)"; - - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job "; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time <= date(?)"; - - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time >= date(?)"; - - } - @Override - protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time >= date(?) AND start_time <= date(?)"; - - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySetHueDb.java new file mode 100644 index 0000000..6066ac5 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySetHueDb.java @@ -0,0 +1,69 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; + + +public class OracleQuerySetHueDb extends QuerySetHueDb { + @Override + protected String fetchuserIdfromUsernameSql() { + return "select id from auth_user where username=?"; + + } + @Override + protected String fetchHueQueriesNoStartdateNoEnddateSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =?"; + } + @Override + protected String fetchHueQueriesNoStartdateYesEnddateSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time <= date(?)"; + + } + @Override + protected String fetchHueQueriesYesStartdateNoEnddateSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?)"; + + } + @Override + protected String fetchHueQueriesYesStartdateYesEnddateSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?) AND start_time <= date(?)"; + + } + @Override + protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job "; + } + @Override + protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time <= date(?)"; + + } + @Override + protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time >= date(?)"; + + } + @Override + protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time >= date(?) AND start_time <= date(?)"; + + } + @Override + protected String fetchUserNameSql() { + return "select username from auth_user where id = ?"; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySet.java deleted file mode 100644 index 84a66f1..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySet.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; - - -public class PostgressQuerySet extends QuerySet { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySetHueDb.java new file mode 100644 index 0000000..4bbaab4 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySetHueDb.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; + + +public class PostgressQuerySetHueDb extends QuerySetHueDb { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySet.java deleted file mode 100644 index b9bdf9a..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySet.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - - -public abstract class QuerySet { - - public PreparedStatement getUseridfromUserName(Connection connection, String username) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql()); - prSt.setString(1, username); - return prSt; - } - - public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection, int id) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql()); - prSt.setInt(1, id); - return prSt; - } - - public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection, int id, String enddate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql()); - prSt.setInt(1, id); - prSt.setString(2, enddate); - return prSt; - } - - public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection, int id, String startdate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql()); - prSt.setInt(1, id); - prSt.setString(2, startdate); - return prSt; - } - - public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection, int id, String startdate, String endate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql()); - prSt.setInt(1, id); - prSt.setString(2, startdate); - prSt.setString(3, endate); - return prSt; - } - - /** - * for all user - */ - public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql()); - return prSt; - } - - public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection, String enddate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql()); - prSt.setString(1, enddate); - return prSt; - } - - public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection, String startdate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql()); - prSt.setString(1, startdate); - return prSt; - } - - public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection, String startdate, String endate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql()); - prSt.setString(1, startdate); - prSt.setString(2, endate); - return prSt; - } - - protected String fetchuserIdfromUsernameSql() { - return "select id from auth_user where username=?;"; - - } - - protected String fetchHueQueriesNoStartdateNoEnddateSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =?;"; - } - - protected String fetchHueQueriesNoStartdateYesEnddateSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time <= date(?);"; - - } - - protected String fetchHueQueriesYesStartdateNoEnddateSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?);"; - - } - - protected String fetchHueQueriesYesStartdateYesEnddateSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?) AND start_time <= date(?);"; - - } - - protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job ;"; - } - - protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time <= date(?);"; - - } - - protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time >= date(?);"; - - } - - protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { - return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time >= date(?) AND start_time <= date(?);"; - - } - - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySetHueDb.java new file mode 100644 index 0000000..dee73d9 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySetHueDb.java @@ -0,0 +1,141 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + + +public abstract class QuerySetHueDb { + + public PreparedStatement getUseridfromUserName(Connection connection, String username) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql()); + prSt.setString(1, username); + return prSt; + } + + public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection, int id) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql()); + prSt.setInt(1, id); + return prSt; + } + + public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection, int id, String enddate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql()); + prSt.setInt(1, id); + prSt.setString(2, enddate); + return prSt; + } + + public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection, int id, String startdate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql()); + prSt.setInt(1, id); + prSt.setString(2, startdate); + return prSt; + } + + public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection, int id, String startdate, String endate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql()); + prSt.setInt(1, id); + prSt.setString(2, startdate); + prSt.setString(3, endate); + return prSt; + } + + /** + * for all user + */ + public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql()); + return prSt; + } + + public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection, String enddate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql()); + prSt.setString(1, enddate); + return prSt; + } + + public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection, String startdate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql()); + prSt.setString(1, startdate); + return prSt; + } + + public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection, String startdate, String endate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql()); + prSt.setString(1, startdate); + prSt.setString(2, endate); + return prSt; + } + + public PreparedStatement getUserName(Connection connection, int id) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchUserNameSql()); + prSt.setInt(1, id); + return prSt; + } + + protected String fetchuserIdfromUsernameSql() { + return "select id from auth_user where username=?;"; + + } + + protected String fetchHueQueriesNoStartdateNoEnddateSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =?;"; + } + + protected String fetchHueQueriesNoStartdateYesEnddateSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time <= date(?);"; + + } + + protected String fetchHueQueriesYesStartdateNoEnddateSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?);"; + + } + + protected String fetchHueQueriesYesStartdateYesEnddateSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?) AND start_time <= date(?);"; + + } + + protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job ;"; + } + + protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time <= date(?);"; + + } + + protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time >= date(?);"; + + } + + protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { + return "select status,start_time,statusdir,script_title,user_id from pig_job where start_time >= date(?) AND start_time <= date(?);"; + + } + + protected String fetchUserNameSql() { + return "select username from auth_user where id = ?;"; + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySet.java deleted file mode 100644 index af216fe..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySet.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; - - -public class SqliteQuerySet extends QuerySet { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySetHueDb.java new file mode 100644 index 0000000..d33495e --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySetHueDb.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset; + + +public class SqliteQuerySetHueDb extends QuerySetHueDb { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySet.java deleted file mode 100644 index 6c27993..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySet.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; - - -public class MysqlQuerySet extends QuerySet { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySetHueDb.java new file mode 100644 index 0000000..1b9eaa8 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySetHueDb.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; + + +public class MysqlQuerySetHueDb extends QuerySetHueDb { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySet.java deleted file mode 100644 index 70e46d7..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySet.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; - - -public class OracleQuerySet extends QuerySet { - - @Override - protected String fetchuserIdfromUsernameSql() { - return "select id from auth_user where username=?"; - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =?"; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created <= date(?)"; - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?)"; - } - @Override - protected String fetchHueQueriesYesStartdateYesEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?) AND date_created <= date(?)"; - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 "; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created <= date(?)"; - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created >= date(?)"; - } - @Override - protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created >= date(?) AND date_created <= date(?)"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySetHueDb.java new file mode 100644 index 0000000..0604ae7 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySetHueDb.java @@ -0,0 +1,64 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; + + +public class OracleQuerySetHueDb extends QuerySetHueDb { + + @Override + protected String fetchuserIdfromUsernameSql() { + return "select id from auth_user where username=?"; + } + @Override + protected String fetchHueQueriesNoStartdateNoEnddateSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =?"; + } + @Override + protected String fetchHueQueriesNoStartdateYesEnddateSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created <= date(?)"; + } + @Override + protected String fetchHueQueriesYesStartdateNoEnddateSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?)"; + } + @Override + protected String fetchHueQueriesYesStartdateYesEnddateSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?) AND date_created <= date(?)"; + } + @Override + protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 "; + } + @Override + protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created <= date(?)"; + } + @Override + protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created >= date(?)"; + } + @Override + protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created >= date(?) AND date_created <= date(?)"; + } + @Override + protected String fetchUserNameSql() { + return "select username from auth_user where id = ?;"; + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySet.java deleted file mode 100644 index 90939f1..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySet.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; - - -public class PostgressQuerySet extends QuerySet { - - @Override - protected String fetchuserIdfromUsernameSql() { - return "select id from auth_user where username=?;"; - - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =?;"; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND date_created <= date(?);"; - - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND date_created >= date(?);"; - - - } - @Override - protected String fetchHueQueriesYesStartdateYesEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND date_created >= date(?) AND date_created <= date(?);"; - - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' ;"; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND date_created <= date(?);"; - - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND date_created >= date(?);"; - - } - @Override - protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND date_created >= date(?) AND date_created <= date(?);"; - - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySetHueDb.java new file mode 100644 index 0000000..3c73c03 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySetHueDb.java @@ -0,0 +1,67 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; + + +public class PostgressQuerySetHueDb extends QuerySetHueDb { + + @Override + protected String fetchuserIdfromUsernameSql() { + return "select id from auth_user where username=?;"; + + } + @Override + protected String fetchHueQueriesNoStartdateNoEnddateSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =?;"; + } + @Override + protected String fetchHueQueriesNoStartdateYesEnddateSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND date_created <= date(?);"; + + } + @Override + protected String fetchHueQueriesYesStartdateNoEnddateSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND date_created >= date(?);"; + + + } + @Override + protected String fetchHueQueriesYesStartdateYesEnddateSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND date_created >= date(?) AND date_created <= date(?);"; + + } + @Override + protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' ;"; + } + @Override + protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND date_created <= date(?);"; + + } + @Override + protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND date_created >= date(?);"; + + } + @Override + protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { + return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND date_created >= date(?) AND date_created <= date(?);"; + + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySet.java deleted file mode 100644 index eebf242..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySet.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - - -public abstract class QuerySet { - - public PreparedStatement getUseridfromUserName(Connection connection,String username) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql()); - prSt.setString(1, username); - return prSt; - } - - public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection,int id) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql()); - prSt.setInt(1, id); - return prSt; - } - - public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection,int id,String enddate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql()); - prSt.setInt(1, id); - prSt.setString(2, enddate); - return prSt; - } - - public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection,int id,String startdate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql()); - prSt.setInt(1, id); - prSt.setString(2, startdate); - return prSt; - } - - public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection,int id,String startdate,String endate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql()); - prSt.setInt(1, id); - prSt.setString(2, startdate); - prSt.setString(3, endate); - return prSt; - } - - /** - * for all user - * */ - public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql()); - return prSt; - } - - public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection,String enddate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql()); - prSt.setString(1, enddate); - return prSt; - } - - public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection,String startdate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql()); - prSt.setString(1, startdate); - return prSt; - } - - public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection,String startdate,String endate) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql()); - prSt.setString(1, startdate); - prSt.setString(2, endate); - return prSt; - } - - - protected String fetchuserIdfromUsernameSql() { - return "select id from auth_user where username=?;"; - - } - - protected String fetchHueQueriesNoStartdateNoEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =?;"; - } - - protected String fetchHueQueriesNoStartdateYesEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created <= date(?);"; - - } - - protected String fetchHueQueriesYesStartdateNoEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?);"; - - - } - - protected String fetchHueQueriesYesStartdateYesEnddateSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?) AND date_created <= date(?);"; - - } - - protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 ;"; - } - - protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created <= date(?);"; - - } - - protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created >= date(?);"; - - } - - protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { - return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created >= date(?) AND date_created <= date(?);"; - - } - - - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySetHueDb.java new file mode 100644 index 0000000..14082a1 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySetHueDb.java @@ -0,0 +1,142 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + + +public abstract class QuerySetHueDb { + + public PreparedStatement getUseridfromUserName(Connection connection,String username) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql()); + prSt.setString(1, username); + return prSt; + } + + public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection,int id) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql()); + prSt.setInt(1, id); + return prSt; + } + + public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection,int id,String enddate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql()); + prSt.setInt(1, id); + prSt.setString(2, enddate); + return prSt; + } + + public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection,int id,String startdate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql()); + prSt.setInt(1, id); + prSt.setString(2, startdate); + return prSt; + } + + public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection,int id,String startdate,String endate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql()); + prSt.setInt(1, id); + prSt.setString(2, startdate); + prSt.setString(3, endate); + return prSt; + } + + /** + * for all user + * */ + public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql()); + return prSt; + } + + public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection,String enddate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql()); + prSt.setString(1, enddate); + return prSt; + } + + public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection,String startdate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql()); + prSt.setString(1, startdate); + return prSt; + } + + public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection,String startdate,String endate) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql()); + prSt.setString(1, startdate); + prSt.setString(2, endate); + return prSt; + } + + public PreparedStatement getUserName(Connection connection, int id) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchUserNameSql()); + prSt.setInt(1, id); + return prSt; + } + + protected String fetchuserIdfromUsernameSql() { + return "select id from auth_user where username=?;"; + + } + + protected String fetchHueQueriesNoStartdateNoEnddateSql() { + return "select user_id, pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =?;"; + } + + protected String fetchHueQueriesNoStartdateYesEnddateSql() { + return "select user_id, pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created <= date(?);"; + + } + + protected String fetchHueQueriesYesStartdateNoEnddateSql() { + return "select user_id, pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?);"; + + + } + + protected String fetchHueQueriesYesStartdateYesEnddateSql() { + return "select user_id, pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?) AND date_created <= date(?);"; + + } + + protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { + return "select user_id, pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 ;"; + } + + protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { + return "select user_id, pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created <= date(?);"; + + } + + protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { + return "select user_id, pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created >= date(?);"; + + } + + protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { + return "select user_id, pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND date_created >= date(?) AND date_created <= date(?);"; + + } + + protected String fetchUserNameSql() { + return "select username from auth_user where id = ?;"; + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySet.java deleted file mode 100644 index 2b1a283..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySet.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; - - -public class SqliteQuerySet extends QuerySet { - - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySetHueDb.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySetHueDb.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySetHueDb.java new file mode 100644 index 0000000..502c37c --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySetHueDb.java @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset; + + +public class SqliteQuerySetHueDb extends QuerySetHueDb { + + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/MysqlQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/MysqlQuerySet.java new file mode 100644 index 0000000..6f993c4 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/MysqlQuerySet.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.udfqueryset; + + +public class MysqlQuerySet extends QuerySet { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/OracleQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/OracleQuerySet.java new file mode 100644 index 0000000..d8bff7e --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/OracleQuerySet.java @@ -0,0 +1,41 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.udfqueryset; + + +public class OracleQuerySet extends QuerySet { + + @Override + protected String fetchuserIdfromUsernameSql() { + return "select id from auth_user where username=?"; + } + + @Override + protected String fetchHueQueriesSql() { + return "select url, file_name, owner_id from pig_udf where owner_id =?"; + } + + @Override + protected String fetchHueQueriesAllUserSql() { + return "select url, file_name, owner_id from pig_udf"; + } + + @Override + protected String fetchuserNamefromUserIdSql() { return "select username from auth_user where id=?";} + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/PostgressQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/PostgressQuerySet.java new file mode 100644 index 0000000..526dde6 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/PostgressQuerySet.java @@ -0,0 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.udfqueryset; + + +public class PostgressQuerySet extends QuerySet { + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/QuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/QuerySet.java new file mode 100644 index 0000000..1400dae --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/QuerySet.java @@ -0,0 +1,75 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.udfqueryset; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + + +public abstract class QuerySet { + + public PreparedStatement getUserNamefromUserId(Connection connection,int id) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchuserNamefromUserIdSql()); + prSt.setInt(1, id); + return prSt; + } + + public PreparedStatement getUseridfromUserName(Connection connection,String username) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql()); + prSt.setString(1, username); + return prSt; + } + + public PreparedStatement getUserQueries(Connection connection,int id) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesSql()); + prSt.setInt(1, id); + return prSt; + } + + /** + * for all users + * */ + public PreparedStatement getAllQueries(Connection connection) throws SQLException { + PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesAllUserSql()); + return prSt; + } + + + protected String fetchuserIdfromUsernameSql() { + return "select id from auth_user where username=?;"; + + } + + protected String fetchuserNamefromUserIdSql(){ + return "select username from auth_user where id=?;"; + } + + protected String fetchHueQueriesSql() { + return "select url, file_name, owner_id from pig_udf where owner_id =?;"; + } + + + protected String fetchHueQueriesAllUserSql() { + return "select url, file_name, owner_id from pig_udf;"; + } + +} + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/SqliteQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/SqliteQuerySet.java new file mode 100644 index 0000000..af83978 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/udfqueryset/SqliteQuerySet.java @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.udfqueryset; + + +public class SqliteQuerySet extends QuerySet { + + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bea5ebb8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java index b1131bb..ff577fc 100644 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java @@ -26,6 +26,7 @@ import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.Migr import org.apache.ambari.view.huetoambarimigration.migration.hive.savedquery.HiveSavedQueryStartJob; import org.apache.ambari.view.huetoambarimigration.migration.pig.pigjob.PigJobStartJob; import org.apache.ambari.view.huetoambarimigration.migration.pig.pigscript.PigSavedScriptStartJob; +import org.apache.ambari.view.huetoambarimigration.migration.pig.pigudf.PigUdfStartJob; import org.json.simple.JSONObject; import javax.ws.rs.GET; @@ -85,6 +86,10 @@ public class InitiateJobMigration implements Runnable { new PigSavedScriptStartJob(username, instance, startdate, enddate, jobid, view).start(); + } else if (jobtype.contains("pigudfmigration")) { + + new PigUdfStartJob(username, instance, jobid, view).start(); + }
