mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-21 14:38:43 +00:00
pass tests; redo removed api fields
This commit is contained in:
@ -30,7 +30,6 @@ import com.kingsrook.qqq.api.model.APIVersionRange;
|
||||
import com.kingsrook.qqq.api.model.actions.GetTableApiFieldsInput;
|
||||
import com.kingsrook.qqq.api.model.actions.GetTableApiFieldsOutput;
|
||||
import com.kingsrook.qqq.api.model.metadata.fields.ApiFieldMetaData;
|
||||
import com.kingsrook.qqq.api.model.metadata.fields.RemovedApiFieldMetaData;
|
||||
import com.kingsrook.qqq.api.model.metadata.tables.ApiTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.actions.AbstractQActionFunction;
|
||||
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||
@ -80,7 +79,7 @@ public class GetTableApiFieldsAction extends AbstractQActionFunction<GetTableApi
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// look for removed fields (e.g., not currently in the table anymore), that are in this version //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
for(RemovedApiFieldMetaData removedApiField : CollectionUtils.nonNullList(getRemovedApiFields(table)))
|
||||
for(QFieldMetaData removedApiField : CollectionUtils.nonNullList(getRemovedApiFields(table)))
|
||||
{
|
||||
APIVersionRange versionRange = getApiVersionRangeForRemovedField(removedApiField);
|
||||
|
||||
@ -99,14 +98,14 @@ public class GetTableApiFieldsAction extends AbstractQActionFunction<GetTableApi
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private APIVersionRange getApiVersionRangeForRemovedField(RemovedApiFieldMetaData field)
|
||||
private APIVersionRange getApiVersionRangeForRemovedField(QFieldMetaData field)
|
||||
{
|
||||
ApiFieldMetaData middlewareMetaData = ApiMiddlewareType.getApiFieldMetaData(field);
|
||||
if(middlewareMetaData != null && middlewareMetaData.getInitialVersion() != null)
|
||||
{
|
||||
if(StringUtils.hasContent(field.getFinalVersion()))
|
||||
if(StringUtils.hasContent(middlewareMetaData.getFinalVersion()))
|
||||
{
|
||||
return (APIVersionRange.betweenAndIncluding(middlewareMetaData.getInitialVersion(), field.getFinalVersion()));
|
||||
return (APIVersionRange.betweenAndIncluding(middlewareMetaData.getInitialVersion(), middlewareMetaData.getFinalVersion()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -140,7 +139,7 @@ public class GetTableApiFieldsAction extends AbstractQActionFunction<GetTableApi
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private List<RemovedApiFieldMetaData> getRemovedApiFields(QTableMetaData table)
|
||||
private List<QFieldMetaData> getRemovedApiFields(QTableMetaData table)
|
||||
{
|
||||
ApiTableMetaData apiTableMetaData = ApiMiddlewareType.getApiTableMetaData(table);
|
||||
if(apiTableMetaData != null)
|
||||
|
@ -31,6 +31,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.fields.QMiddlewareFieldMeta
|
||||
public class ApiFieldMetaData extends QMiddlewareFieldMetaData
|
||||
{
|
||||
private String initialVersion;
|
||||
private String finalVersion;
|
||||
|
||||
|
||||
|
||||
@ -74,4 +75,35 @@ public class ApiFieldMetaData extends QMiddlewareFieldMetaData
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for finalVersion
|
||||
*******************************************************************************/
|
||||
public String getFinalVersion()
|
||||
{
|
||||
return (this.finalVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for finalVersion
|
||||
*******************************************************************************/
|
||||
public void setFinalVersion(String finalVersion)
|
||||
{
|
||||
this.finalVersion = finalVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for finalVersion
|
||||
*******************************************************************************/
|
||||
public ApiFieldMetaData withFinalVersion(String finalVersion)
|
||||
{
|
||||
this.finalVersion = finalVersion;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2023. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.api.model.metadata.fields;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class RemovedApiFieldMetaData extends QFieldMetaData
|
||||
{
|
||||
private String finalVersion;
|
||||
private String replacedByFieldName;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Constructor
|
||||
**
|
||||
*******************************************************************************/
|
||||
public RemovedApiFieldMetaData()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Constructor
|
||||
**
|
||||
*******************************************************************************/
|
||||
public RemovedApiFieldMetaData(String name, QFieldType type)
|
||||
{
|
||||
super(name, type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for replacedByFieldName
|
||||
*******************************************************************************/
|
||||
public String getReplacedByFieldName()
|
||||
{
|
||||
return (this.replacedByFieldName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for replacedByFieldName
|
||||
*******************************************************************************/
|
||||
public void setReplacedByFieldName(String replacedByFieldName)
|
||||
{
|
||||
this.replacedByFieldName = replacedByFieldName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for replacedByFieldName
|
||||
*******************************************************************************/
|
||||
public RemovedApiFieldMetaData withReplacedByFieldName(String replacedByFieldName)
|
||||
{
|
||||
this.replacedByFieldName = replacedByFieldName;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for finalVersion
|
||||
*******************************************************************************/
|
||||
public String getFinalVersion()
|
||||
{
|
||||
return (this.finalVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for finalVersion
|
||||
*******************************************************************************/
|
||||
public void setFinalVersion(String finalVersion)
|
||||
{
|
||||
this.finalVersion = finalVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for finalVersion
|
||||
*******************************************************************************/
|
||||
public RemovedApiFieldMetaData withFinalVersion(String finalVersion)
|
||||
{
|
||||
this.finalVersion = finalVersion;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
@ -26,7 +26,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.kingsrook.qqq.api.ApiMiddlewareType;
|
||||
import com.kingsrook.qqq.api.model.metadata.fields.ApiFieldMetaData;
|
||||
import com.kingsrook.qqq.api.model.metadata.fields.RemovedApiFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QMiddlewareTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
@ -40,7 +39,7 @@ public class ApiTableMetaData extends QMiddlewareTableMetaData
|
||||
private String initialVersion;
|
||||
private String finalVersion;
|
||||
|
||||
private List<RemovedApiFieldMetaData> removedApiFields;
|
||||
private List<QFieldMetaData> removedApiFields;
|
||||
|
||||
|
||||
|
||||
@ -86,7 +85,7 @@ public class ApiTableMetaData extends QMiddlewareTableMetaData
|
||||
/*******************************************************************************
|
||||
** Getter for removedApiFields
|
||||
*******************************************************************************/
|
||||
public List<RemovedApiFieldMetaData> getRemovedApiFields()
|
||||
public List<QFieldMetaData> getRemovedApiFields()
|
||||
{
|
||||
return (this.removedApiFields);
|
||||
}
|
||||
@ -96,7 +95,7 @@ public class ApiTableMetaData extends QMiddlewareTableMetaData
|
||||
/*******************************************************************************
|
||||
** Setter for removedApiFields
|
||||
*******************************************************************************/
|
||||
public void setRemovedApiFields(List<RemovedApiFieldMetaData> removedApiFields)
|
||||
public void setRemovedApiFields(List<QFieldMetaData> removedApiFields)
|
||||
{
|
||||
this.removedApiFields = removedApiFields;
|
||||
}
|
||||
@ -106,7 +105,7 @@ public class ApiTableMetaData extends QMiddlewareTableMetaData
|
||||
/*******************************************************************************
|
||||
** Fluent setter for removedApiFields
|
||||
*******************************************************************************/
|
||||
public ApiTableMetaData withRemovedApiFields(List<RemovedApiFieldMetaData> removedApiFields)
|
||||
public ApiTableMetaData withRemovedApiFields(List<QFieldMetaData> removedApiFields)
|
||||
{
|
||||
this.removedApiFields = removedApiFields;
|
||||
return (this);
|
||||
@ -117,7 +116,7 @@ public class ApiTableMetaData extends QMiddlewareTableMetaData
|
||||
/*******************************************************************************
|
||||
** Fluent setter for a single removedApiField
|
||||
*******************************************************************************/
|
||||
public ApiTableMetaData withRemovedApiField(RemovedApiFieldMetaData removedApiField)
|
||||
public ApiTableMetaData withRemovedApiField(QFieldMetaData removedApiField)
|
||||
{
|
||||
if(this.removedApiFields == null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user