mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
QQQ-14 more cleanup in core while building new filesystem modules
This commit is contained in:
@ -33,8 +33,7 @@ import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class QueryResult extends AbstractQResult
|
public class QueryResult extends AbstractQResult
|
||||||
{
|
{
|
||||||
List<QRecord> records;
|
private List<QRecord> records;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -85,10 +85,11 @@ public class QBackendMetaData
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public QBackendMetaData withName(String name)
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T extends QBackendMetaData> T withName(String name)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
return (this);
|
return (T) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -137,10 +138,11 @@ public class QBackendMetaData
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public QBackendMetaData withBackendType(String backendType)
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T extends QBackendMetaData> T withBackendType(String backendType)
|
||||||
{
|
{
|
||||||
this.backendType = backendType;
|
this.backendType = backendType;
|
||||||
return (this);
|
return (T) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ public class QInstance
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@ -87,7 +88,7 @@ public class QInstance
|
|||||||
List<QProcessMetaData> rs = new ArrayList<>();
|
List<QProcessMetaData> rs = new ArrayList<>();
|
||||||
for(QProcessMetaData process : processes.values())
|
for(QProcessMetaData process : processes.values())
|
||||||
{
|
{
|
||||||
if (tableName.equals(process.getTableName()))
|
if(tableName.equals(process.getTableName()))
|
||||||
{
|
{
|
||||||
rs.add(process);
|
rs.add(process);
|
||||||
}
|
}
|
||||||
@ -96,6 +97,7 @@ public class QInstance
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Setter for hasBeenValidated
|
** Setter for hasBeenValidated
|
||||||
**
|
**
|
||||||
@ -112,7 +114,7 @@ public class QInstance
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void addBackend(QBackendMetaData backend)
|
public void addBackend(QBackendMetaData backend)
|
||||||
{
|
{
|
||||||
this.backends.put(backend.getName(), backend);
|
addBackend(backend.getName(), backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -122,6 +124,10 @@ public class QInstance
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void addBackend(String name, QBackendMetaData backend)
|
public void addBackend(String name, QBackendMetaData backend)
|
||||||
{
|
{
|
||||||
|
if(this.backends.containsKey(name))
|
||||||
|
{
|
||||||
|
throw (new IllegalArgumentException("Attempted to add a second backend with name: " + name));
|
||||||
|
}
|
||||||
this.backends.put(name, backend);
|
this.backends.put(name, backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +148,7 @@ public class QInstance
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void addTable(QTableMetaData table)
|
public void addTable(QTableMetaData table)
|
||||||
{
|
{
|
||||||
this.tables.put(table.getName(), table);
|
addTable(table.getName(), table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -152,6 +158,10 @@ public class QInstance
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void addTable(String name, QTableMetaData table)
|
public void addTable(String name, QTableMetaData table)
|
||||||
{
|
{
|
||||||
|
if(this.tables.containsKey(name))
|
||||||
|
{
|
||||||
|
throw (new IllegalArgumentException("Attempted to add a second table with name: " + name));
|
||||||
|
}
|
||||||
this.tables.put(name, table);
|
this.tables.put(name, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +182,7 @@ public class QInstance
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void addPossibleValueSource(QPossibleValueSource<?> possibleValueSource)
|
public void addPossibleValueSource(QPossibleValueSource<?> possibleValueSource)
|
||||||
{
|
{
|
||||||
this.possibleValueSources.put(possibleValueSource.getName(), possibleValueSource);
|
this.addPossibleValueSource(possibleValueSource.getName(), possibleValueSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,6 +192,10 @@ public class QInstance
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void addPossibleValueSource(String name, QPossibleValueSource possibleValueSource)
|
public void addPossibleValueSource(String name, QPossibleValueSource possibleValueSource)
|
||||||
{
|
{
|
||||||
|
if(this.possibleValueSources.containsKey(name))
|
||||||
|
{
|
||||||
|
throw (new IllegalArgumentException("Attempted to add a second possibleValueSource with name: " + name));
|
||||||
|
}
|
||||||
this.possibleValueSources.put(name, possibleValueSource);
|
this.possibleValueSources.put(name, possibleValueSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +232,21 @@ public class QInstance
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void addProcess(QProcessMetaData process)
|
public void addProcess(QProcessMetaData process)
|
||||||
{
|
{
|
||||||
this.processes.put(process.getName(), process);
|
this.addProcess(process.getName(), process);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public void addProcess(String name, QProcessMetaData process)
|
||||||
|
{
|
||||||
|
if(this.processes.containsKey(name))
|
||||||
|
{
|
||||||
|
throw (new IllegalArgumentException("Attempted to add a second process with name: " + name));
|
||||||
|
}
|
||||||
|
this.processes.put(name, process);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,15 @@ public class QTableMetaData
|
|||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
// TODO: resolve confusion over:
|
||||||
|
// Is this name of what backend the table is stored in (yes)
|
||||||
|
// Or the "name" of the table WITHIN the backend (no)
|
||||||
|
// although that's how "backendName" is used in QFieldMetaData.
|
||||||
|
// Idea:
|
||||||
|
// rename "backendName" here to "backend"
|
||||||
|
// add "nameInBackend" (or similar) for the table name in the backend
|
||||||
|
// OR - add a whole "backendDetails" object, with different details per backend-type
|
||||||
private String backendName;
|
private String backendName;
|
||||||
private String primaryKeyField;
|
private String primaryKeyField;
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ public class DeserializerUtils
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
T output = outputClass.getConstructor().newInstance();
|
T output = outputClass.getConstructor().newInstance();
|
||||||
System.out.println("Reflectively deserializing a: " + outputClass.getName());
|
|
||||||
|
|
||||||
Map<String, Consumer<String>> setterMap = new HashMap<>();
|
Map<String, Consumer<String>> setterMap = new HashMap<>();
|
||||||
for(Method method : outputClass.getMethods())
|
for(Method method : outputClass.getMethods())
|
||||||
@ -174,7 +173,6 @@ public class DeserializerUtils
|
|||||||
while(fieldNamesIterator.hasNext())
|
while(fieldNamesIterator.hasNext())
|
||||||
{
|
{
|
||||||
String fieldName = fieldNamesIterator.next();
|
String fieldName = fieldNamesIterator.next();
|
||||||
System.out.println("Handling field [" + fieldName + "]");
|
|
||||||
|
|
||||||
if(!setterMap.containsKey(fieldName))
|
if(!setterMap.containsKey(fieldName))
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,8 @@ public class QBackendModuleDispatcher
|
|||||||
// e.g., backend-core shouldn't need to "know" about the modules.
|
// e.g., backend-core shouldn't need to "know" about the modules.
|
||||||
"com.kingsrook.qqq.backend.core.modules.mock.MockBackendModule",
|
"com.kingsrook.qqq.backend.core.modules.mock.MockBackendModule",
|
||||||
"com.kingsrook.qqq.backend.module.rdbms.RDBMSBackendModule",
|
"com.kingsrook.qqq.backend.module.rdbms.RDBMSBackendModule",
|
||||||
"com.kingsrook.qqq.backend.module.filesystem.FilesystemBackendModule"
|
"com.kingsrook.qqq.backend.module.filesystem.local.FilesystemBackendModule",
|
||||||
|
"com.kingsrook.qqq.backend.module.filesystem.s3.S3BackendModule"
|
||||||
};
|
};
|
||||||
|
|
||||||
for(String moduleClassName : moduleClassNames)
|
for(String moduleClassName : moduleClassNames)
|
||||||
|
Reference in New Issue
Block a user