mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
CE-1887 - Add frontend, middleware, and application name & version properties
This commit is contained in:
@ -41,8 +41,17 @@ public class MetaDataExecutor extends AbstractMiddlewareExecutor<MetaDataInput,
|
||||
@Override
|
||||
public void execute(MetaDataInput input, MetaDataOutputInterface output) throws QException
|
||||
{
|
||||
com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataInput actionInput = new com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataInput();
|
||||
|
||||
actionInput.setMiddlewareName(input.getMiddlewareName());
|
||||
actionInput.setMiddlewareVersion(input.getMiddlewareVersion());
|
||||
actionInput.setFrontendName(input.getFrontendName());
|
||||
actionInput.setFrontendVersion(input.getFrontendVersion());
|
||||
actionInput.setApplicationName(input.getApplicationName());
|
||||
actionInput.setApplicationVersion(input.getApplicationVersion());
|
||||
|
||||
MetaDataAction metaDataAction = new MetaDataAction();
|
||||
MetaDataOutput metaDataOutput = metaDataAction.execute(new com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataInput());
|
||||
MetaDataOutput metaDataOutput = metaDataAction.execute(actionInput);
|
||||
output.setMetaDataOutput(metaDataOutput);
|
||||
}
|
||||
|
||||
|
@ -27,5 +27,199 @@ package com.kingsrook.qqq.middleware.javalin.executors.io;
|
||||
*******************************************************************************/
|
||||
public class MetaDataInput extends AbstractMiddlewareInput
|
||||
{
|
||||
private String frontendName;
|
||||
private String frontendVersion;
|
||||
|
||||
private String middlewareName;
|
||||
private String middlewareVersion;
|
||||
|
||||
private String applicationName;
|
||||
private String applicationVersion;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for frontendName
|
||||
*******************************************************************************/
|
||||
public String getFrontendName()
|
||||
{
|
||||
return (this.frontendName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for frontendName
|
||||
*******************************************************************************/
|
||||
public void setFrontendName(String frontendName)
|
||||
{
|
||||
this.frontendName = frontendName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for frontendName
|
||||
*******************************************************************************/
|
||||
public MetaDataInput withFrontendName(String frontendName)
|
||||
{
|
||||
this.frontendName = frontendName;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for frontendVersion
|
||||
*******************************************************************************/
|
||||
public String getFrontendVersion()
|
||||
{
|
||||
return (this.frontendVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for frontendVersion
|
||||
*******************************************************************************/
|
||||
public void setFrontendVersion(String frontendVersion)
|
||||
{
|
||||
this.frontendVersion = frontendVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for frontendVersion
|
||||
*******************************************************************************/
|
||||
public MetaDataInput withFrontendVersion(String frontendVersion)
|
||||
{
|
||||
this.frontendVersion = frontendVersion;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for middlewareName
|
||||
*******************************************************************************/
|
||||
public String getMiddlewareName()
|
||||
{
|
||||
return (this.middlewareName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for middlewareName
|
||||
*******************************************************************************/
|
||||
public void setMiddlewareName(String middlewareName)
|
||||
{
|
||||
this.middlewareName = middlewareName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for middlewareName
|
||||
*******************************************************************************/
|
||||
public MetaDataInput withMiddlewareName(String middlewareName)
|
||||
{
|
||||
this.middlewareName = middlewareName;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for middlewareVersion
|
||||
*******************************************************************************/
|
||||
public String getMiddlewareVersion()
|
||||
{
|
||||
return (this.middlewareVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for middlewareVersion
|
||||
*******************************************************************************/
|
||||
public void setMiddlewareVersion(String middlewareVersion)
|
||||
{
|
||||
this.middlewareVersion = middlewareVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for middlewareVersion
|
||||
*******************************************************************************/
|
||||
public MetaDataInput withMiddlewareVersion(String middlewareVersion)
|
||||
{
|
||||
this.middlewareVersion = middlewareVersion;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for applicationName
|
||||
*******************************************************************************/
|
||||
public String getApplicationName()
|
||||
{
|
||||
return (this.applicationName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for applicationName
|
||||
*******************************************************************************/
|
||||
public void setApplicationName(String applicationName)
|
||||
{
|
||||
this.applicationName = applicationName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for applicationName
|
||||
*******************************************************************************/
|
||||
public MetaDataInput withApplicationName(String applicationName)
|
||||
{
|
||||
this.applicationName = applicationName;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for applicationVersion
|
||||
*******************************************************************************/
|
||||
public String getApplicationVersion()
|
||||
{
|
||||
return (this.applicationVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for applicationVersion
|
||||
*******************************************************************************/
|
||||
public void setApplicationVersion(String applicationVersion)
|
||||
{
|
||||
this.applicationVersion = applicationVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for applicationVersion
|
||||
*******************************************************************************/
|
||||
public MetaDataInput withApplicationVersion(String applicationVersion)
|
||||
{
|
||||
this.applicationVersion = applicationVersion;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.middleware.javalin.specs.v1;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.kingsrook.qqq.backend.core.actions.metadata.MetaDataAction;
|
||||
import com.kingsrook.qqq.backend.core.context.CapturedContext;
|
||||
@ -54,7 +55,10 @@ import com.kingsrook.qqq.middleware.javalin.specs.v1.responses.MetaDataResponseV
|
||||
import com.kingsrook.qqq.middleware.javalin.specs.v1.utils.TagsV1;
|
||||
import com.kingsrook.qqq.openapi.model.Example;
|
||||
import com.kingsrook.qqq.openapi.model.HttpMethod;
|
||||
import com.kingsrook.qqq.openapi.model.In;
|
||||
import com.kingsrook.qqq.openapi.model.Parameter;
|
||||
import com.kingsrook.qqq.openapi.model.Schema;
|
||||
import com.kingsrook.qqq.openapi.model.Type;
|
||||
import io.javalin.http.Context;
|
||||
|
||||
|
||||
@ -94,6 +98,52 @@ public class MetaDataSpecV1 extends AbstractEndpointSpec<MetaDataInput, MetaData
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
@Override
|
||||
public List<Parameter> defineRequestParameters()
|
||||
{
|
||||
return List.of(
|
||||
|
||||
new Parameter()
|
||||
.withName("frontendName")
|
||||
.withDescription("""
|
||||
Name of the frontend requesting the meta-data.
|
||||
Generally a QQQ frontend library, unless a custom application frontend has been built.""")
|
||||
.withIn(In.QUERY)
|
||||
.withSchema(new Schema().withType(Type.STRING))
|
||||
.withExample("qqq-frontend-material-dashboard"),
|
||||
|
||||
new Parameter()
|
||||
.withName("frontendVersion")
|
||||
.withDescription("Version of the frontend requesting the meta-data.")
|
||||
.withIn(In.QUERY)
|
||||
.withSchema(new Schema().withType(Type.STRING))
|
||||
.withExample("0.23.0"),
|
||||
|
||||
new Parameter()
|
||||
.withName("applicationName")
|
||||
.withDescription("""
|
||||
Name of the application requesting the meta-data. e.g., an instance of a specific frontend
|
||||
(i.e., an application might be deployed with 2 different qqq-frontend-material-dashboard frontends,
|
||||
in which case this attribute allows differentiation between them).""")
|
||||
.withIn(In.QUERY)
|
||||
.withSchema(new Schema().withType(Type.STRING))
|
||||
.withExample("my-admin-web-app"),
|
||||
|
||||
new Parameter()
|
||||
.withName("applicationVersion")
|
||||
.withDescription("Version of the application requesting the meta-data.")
|
||||
.withIn(In.QUERY)
|
||||
.withSchema(new Schema().withType(Type.STRING))
|
||||
.withExample("20241021")
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
@ -101,6 +151,16 @@ public class MetaDataSpecV1 extends AbstractEndpointSpec<MetaDataInput, MetaData
|
||||
public MetaDataInput buildInput(Context context) throws Exception
|
||||
{
|
||||
MetaDataInput input = new MetaDataInput();
|
||||
|
||||
input.setMiddlewareName("qqq-middleware-javalin");
|
||||
input.setMiddlewareVersion("v1");
|
||||
|
||||
input.setFrontendName(getRequestParam(context, "frontendName"));
|
||||
input.setFrontendVersion(getRequestParam(context, "frontendVersion"));
|
||||
|
||||
input.setApplicationName(getRequestParam(context, "applicationName"));
|
||||
input.setApplicationVersion(getRequestParam(context, "applicationVersion"));
|
||||
|
||||
return (input);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user