mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
Fix compound data selector V2.02.10b
also a bug in logger forms if malformed UDF's
This commit is contained in:
parent
21b4bc130d
commit
2721095a03
@ -4,7 +4,7 @@
|
||||
<groupId>org.pamguard</groupId>
|
||||
<artifactId>Pamguard</artifactId>
|
||||
<name>Pamguard Java12+</name>
|
||||
<version>2.02.10a</version>
|
||||
<version>2.02.10b</version>
|
||||
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
||||
<url>www.pamguard.org</url>
|
||||
<organization>
|
||||
|
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.pamguard</groupId>
|
||||
<artifactId>Pamguard</artifactId>
|
||||
<version>2.02.10a</version>
|
||||
<version>2.02.10b</version>
|
||||
<name>Pamguard Java12+</name>
|
||||
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
||||
<url>www.pamguard.org</url>
|
||||
@ -748,7 +748,7 @@
|
||||
<dependency>
|
||||
<groupId>net.sf.ucanaccess</groupId>
|
||||
<artifactId>ucanaccess</artifactId>
|
||||
<version>4.0.4</version>
|
||||
<version>5.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-dev -->
|
||||
|
@ -31,7 +31,7 @@ public class PamguardVersionInfo {
|
||||
* Version number, major version.minorversion.sub-release.
|
||||
* Note: can't go higher than sub-release 'f'
|
||||
*/
|
||||
static public final String version = "2.02.10a";
|
||||
static public final String version = "2.02.10b";
|
||||
|
||||
/**
|
||||
* Release date
|
||||
|
@ -19,4 +19,10 @@ public class CompoundParams extends DataSelectParams {
|
||||
public DataSelectParams getSelectorParams(DataSelector dataSelector) {
|
||||
return selectorParams.get(dataSelector.getLongSelectorName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombinationFlag() {
|
||||
return DATA_SELECT_AND;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -200,7 +200,13 @@ public abstract class DataSelectorCreator implements PamSettings {
|
||||
return allSelectors.get(0);
|
||||
}
|
||||
else {
|
||||
return new CompoundDataSelector(pamDataBlock, allSelectors, selectorName, allowScores, selectorType);
|
||||
CompoundDataSelector selector = new CompoundDataSelector(pamDataBlock, allSelectors, selectorName, allowScores, selectorType);
|
||||
DataSelectParams params = dataSelectorSettings.getParams(selectorName);
|
||||
if (params instanceof CompoundParams) {
|
||||
selector.setParams(params);
|
||||
}
|
||||
|
||||
return selector;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,13 @@ package generalDatabase.lookupTables;
|
||||
import java.awt.Color;
|
||||
import java.awt.Window;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import PamController.PamController;
|
||||
import PamView.dialog.warn.WarnOnce;
|
||||
@ -101,9 +104,101 @@ public class LookUpTables {
|
||||
checkedTableConnection = null;
|
||||
if (dbControlUnit.getDbProcess().checkTable(lutTableDef)) {
|
||||
checkedTableConnection = con;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
checkTableRepeats(con, lutTableDef);
|
||||
|
||||
return checkedTableConnection != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* for some reason some repeats have got into the LUT and need to be removed
|
||||
* or it really messes stuff up. So check it automatically.
|
||||
* @param con
|
||||
* @param lutTableDef2
|
||||
*/
|
||||
private boolean checkTableRepeats(PamConnection con, EmptyTableDefinition lutTableDef) {
|
||||
/*
|
||||
* first get a list of unique topics, then check them one at a time.
|
||||
*/
|
||||
ArrayList<String> topics = getTopicList(con, lutTableDef);
|
||||
if (topics == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String topic : topics) {
|
||||
checkTopicRepeats(con, lutTableDef, topic);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void checkTopicRepeats(PamConnection con, EmptyTableDefinition lutTableDef2, String topic) {
|
||||
LookupList lutList = getLookupList(topic);
|
||||
Vector<LookupItem> list = lutList.getList();
|
||||
int n = list.size();
|
||||
boolean[] isRepeat = new boolean[n];
|
||||
int nRepeat = 0;
|
||||
// search for repeats.
|
||||
for (int i = 0; i < n-1; i++) {
|
||||
String code = list.get(i).getCode().trim();
|
||||
for (int j = i+1; j < n; j++) {
|
||||
String code2 = list.get(j).getCode().trim();
|
||||
if (code.equals(code2)) {
|
||||
isRepeat[j] = true;
|
||||
nRepeat++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nRepeat == 0) {
|
||||
return;
|
||||
}
|
||||
// make a clause to delete the repeats.
|
||||
String sql = null;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (isRepeat[i] == false) {
|
||||
continue;
|
||||
}
|
||||
if (sql == null) {
|
||||
sql = String.format("DELETE FROM %s WHERE Id IN (%d", lutTableDef.getTableName(), list.get(i).getDatabaseId());
|
||||
}
|
||||
else {
|
||||
sql = sql + String.format(",%d", list.get(i).getDatabaseId());
|
||||
}
|
||||
}
|
||||
sql += ")";
|
||||
boolean ok = false;
|
||||
try {
|
||||
Statement stmt = con.getConnection().createStatement();
|
||||
ok = stmt.execute(sql);
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> getTopicList(PamConnection con, EmptyTableDefinition lutTableDef) {
|
||||
if (con == null) {
|
||||
return null;
|
||||
}
|
||||
ArrayList<String> topics = new ArrayList<>();
|
||||
String qStr = "SELECT DISTINCT Topic FROM " + lutTableDef.getTableName();
|
||||
try {
|
||||
Statement stmt = con.getConnection().createStatement();
|
||||
boolean ok = stmt.execute(qStr);
|
||||
if (ok == false) {
|
||||
return null;
|
||||
}
|
||||
ResultSet results = stmt.getResultSet();
|
||||
while (results.next()) {
|
||||
String topic = results.getString(1);
|
||||
topics.add(topic);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return topics;
|
||||
}
|
||||
|
||||
public LookupList createLookupList(PamCursor resultSet, String topic) {
|
||||
|
@ -153,7 +153,7 @@ public class UCanAccessSystem extends BaseAccessSystem implements PamSettings {
|
||||
String conStr = "jdbc:ucanaccess://"
|
||||
+ fl.getAbsolutePath() + passwordEntry+noMem;
|
||||
System.out.println("UCanAccess connection string = " + conStr);
|
||||
conn = DriverManager.getConnection(conStr);
|
||||
conn = DriverManager.getConnection(conStr,"","");
|
||||
conn.setAutoCommit(false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1598,7 +1598,9 @@ public class FormDescription implements Cloneable, Comparable<FormDescription> {
|
||||
normalForm.destroyForm();
|
||||
}
|
||||
if (hiddenForm != null) {
|
||||
normalForm.destroyForm();
|
||||
if (normalForm != null) {
|
||||
normalForm.destroyForm();
|
||||
}
|
||||
}
|
||||
if (subtabForms != null) {
|
||||
for (LoggerForm aForm:subtabForms) {
|
||||
|
@ -21,6 +21,7 @@ import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.Timer;
|
||||
@ -529,7 +530,10 @@ public class LoggerForm{
|
||||
innerCenterPanel.add(currentRow);
|
||||
currentRow = new LoggerFormPanel(this, new FlowLayout(FlowLayout.LEFT));
|
||||
}else{
|
||||
currentRow.add(c.makeComponent(this));
|
||||
JPanel component = c.makeComponent(this);
|
||||
if (component != null) {
|
||||
currentRow.add(component);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user