mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-21 14:38:43 +00:00
Merged feature/checkstyle-indentation-enhanced-switch into integration/sprint-43
This commit is contained in:
@ -127,7 +127,6 @@ public enum AutomationStatus implements PossibleValueEnum<Integer>
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
public String getInsertOrUpdate()
|
||||
{
|
||||
return switch(this)
|
||||
|
@ -50,10 +50,7 @@ public interface RecordCustomizerUtilityInterface
|
||||
/*******************************************************************************
|
||||
** Container for an old value and a new value.
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:MethodName")
|
||||
record Change(Serializable oldValue, Serializable newValue)
|
||||
{
|
||||
}
|
||||
record Change(Serializable oldValue, Serializable newValue) {}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -256,7 +256,6 @@ public enum DateTimeGroupBy
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
public Instant roundDown(Instant instant, ZoneId zoneId)
|
||||
{
|
||||
ZonedDateTime zoned = instant.atZone(zoneId);
|
||||
|
@ -500,7 +500,6 @@ public class PermissionsHelper
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
static PermissionSubType getEffectivePermissionSubType(QPermissionRules rules, PermissionSubType originalPermissionSubType)
|
||||
{
|
||||
if(rules == null || rules.getLevel() == null)
|
||||
@ -515,10 +514,10 @@ public class PermissionsHelper
|
||||
if(PrivatePermissionSubType.HAS_ACCESS.equals(originalPermissionSubType))
|
||||
{
|
||||
return switch(rules.getLevel())
|
||||
{
|
||||
case NOT_PROTECTED -> null;
|
||||
default -> PrivatePermissionSubType.HAS_ACCESS;
|
||||
};
|
||||
{
|
||||
case NOT_PROTECTED -> null;
|
||||
default -> PrivatePermissionSubType.HAS_ACCESS;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -527,30 +526,30 @@ public class PermissionsHelper
|
||||
// permission sub-type to what we expect to be set for the table //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
return switch(rules.getLevel())
|
||||
{
|
||||
case NOT_PROTECTED -> null;
|
||||
case HAS_ACCESS_PERMISSION -> PrivatePermissionSubType.HAS_ACCESS;
|
||||
case READ_WRITE_PERMISSIONS ->
|
||||
{
|
||||
case NOT_PROTECTED -> null;
|
||||
case HAS_ACCESS_PERMISSION -> PrivatePermissionSubType.HAS_ACCESS;
|
||||
case READ_WRITE_PERMISSIONS ->
|
||||
if(PrivatePermissionSubType.READ.equals(originalPermissionSubType) || PrivatePermissionSubType.WRITE.equals(originalPermissionSubType))
|
||||
{
|
||||
if(PrivatePermissionSubType.READ.equals(originalPermissionSubType) || PrivatePermissionSubType.WRITE.equals(originalPermissionSubType))
|
||||
{
|
||||
yield (originalPermissionSubType);
|
||||
}
|
||||
else if(TablePermissionSubType.INSERT.equals(originalPermissionSubType) || TablePermissionSubType.EDIT.equals(originalPermissionSubType) || TablePermissionSubType.DELETE.equals(originalPermissionSubType))
|
||||
{
|
||||
yield (PrivatePermissionSubType.WRITE);
|
||||
}
|
||||
else if(TablePermissionSubType.READ.equals(originalPermissionSubType))
|
||||
{
|
||||
yield (PrivatePermissionSubType.READ);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Unexpected permissionSubType: " + originalPermissionSubType);
|
||||
}
|
||||
yield (originalPermissionSubType);
|
||||
}
|
||||
case READ_INSERT_EDIT_DELETE_PERMISSIONS -> originalPermissionSubType;
|
||||
};
|
||||
else if(TablePermissionSubType.INSERT.equals(originalPermissionSubType) || TablePermissionSubType.EDIT.equals(originalPermissionSubType) || TablePermissionSubType.DELETE.equals(originalPermissionSubType))
|
||||
{
|
||||
yield (PrivatePermissionSubType.WRITE);
|
||||
}
|
||||
else if(TablePermissionSubType.READ.equals(originalPermissionSubType))
|
||||
{
|
||||
yield (PrivatePermissionSubType.READ);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Unexpected permissionSubType: " + originalPermissionSubType);
|
||||
}
|
||||
}
|
||||
case READ_INSERT_EDIT_DELETE_PERMISSIONS -> originalPermissionSubType;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,6 @@ public class ExecuteCodeAction
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
public void run(ExecuteCodeInput input, ExecuteCodeOutput output) throws QException, QCodeException
|
||||
{
|
||||
QCodeReference codeReference = input.getCodeReference();
|
||||
|
@ -390,7 +390,6 @@ public class ValidateRecordSecurityLockHelper
|
||||
** MultiRecordSecurityLock, with only the appropriate lock-scopes being included
|
||||
** (e.g., read-locks for selects, write-locks for insert/update/delete).
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:Indentation")
|
||||
static MultiRecordSecurityLock getRecordSecurityLocks(QTableMetaData table, Action action)
|
||||
{
|
||||
List<RecordSecurityLock> allLocksOnTable = CollectionUtils.nonNullList(table.getRecordSecurityLocks());
|
||||
|
@ -118,6 +118,7 @@ public class QPossibleValueTranslator
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Constructor
|
||||
**
|
||||
@ -421,7 +422,6 @@ public class QPossibleValueTranslator
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:Indentation")
|
||||
private String doFormatPossibleValue(String formatString, List<String> valueFields, Object id, String label)
|
||||
{
|
||||
List<Object> values = new ArrayList<>();
|
||||
|
@ -49,7 +49,6 @@ public interface DisplayFormat
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:Indentation")
|
||||
static String getExcelFormat(String javaDisplayFormat)
|
||||
{
|
||||
if(javaDisplayFormat == null)
|
||||
@ -58,21 +57,21 @@ public interface DisplayFormat
|
||||
}
|
||||
|
||||
return switch(javaDisplayFormat)
|
||||
{
|
||||
case DisplayFormat.DEFAULT -> null;
|
||||
case DisplayFormat.COMMAS -> "#,##0";
|
||||
case DisplayFormat.DECIMAL1 -> "0.0";
|
||||
case DisplayFormat.DECIMAL2 -> "0.00";
|
||||
case DisplayFormat.DECIMAL3 -> "0.000";
|
||||
case DisplayFormat.DECIMAL1_COMMAS -> "#,##0.0";
|
||||
case DisplayFormat.DECIMAL2_COMMAS -> "#,##0.00";
|
||||
case DisplayFormat.DECIMAL3_COMMAS -> "#,##0.000";
|
||||
case DisplayFormat.CURRENCY -> "$#,##0.00";
|
||||
case DisplayFormat.PERCENT -> "0%";
|
||||
case DisplayFormat.PERCENT_POINT1 -> "0.0%";
|
||||
case DisplayFormat.PERCENT_POINT2 -> "0.00%";
|
||||
default -> null;
|
||||
};
|
||||
{
|
||||
case DisplayFormat.DEFAULT -> null;
|
||||
case DisplayFormat.COMMAS -> "#,##0";
|
||||
case DisplayFormat.DECIMAL1 -> "0.0";
|
||||
case DisplayFormat.DECIMAL2 -> "0.00";
|
||||
case DisplayFormat.DECIMAL3 -> "0.000";
|
||||
case DisplayFormat.DECIMAL1_COMMAS -> "#,##0.0";
|
||||
case DisplayFormat.DECIMAL2_COMMAS -> "#,##0.00";
|
||||
case DisplayFormat.DECIMAL3_COMMAS -> "#,##0.000";
|
||||
case DisplayFormat.CURRENCY -> "$#,##0.00";
|
||||
case DisplayFormat.PERCENT -> "0%";
|
||||
case DisplayFormat.PERCENT_POINT1 -> "0.0%";
|
||||
case DisplayFormat.PERCENT_POINT2 -> "0.00%";
|
||||
default -> null;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -44,14 +44,13 @@ public enum JoinType
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
public JoinType flip()
|
||||
{
|
||||
return switch(this)
|
||||
{
|
||||
case ONE_TO_MANY -> MANY_TO_ONE;
|
||||
case MANY_TO_ONE -> ONE_TO_MANY;
|
||||
case MANY_TO_MANY, ONE_TO_ONE -> this;
|
||||
};
|
||||
{
|
||||
case ONE_TO_MANY -> MANY_TO_ONE;
|
||||
case MANY_TO_ONE -> ONE_TO_MANY;
|
||||
case MANY_TO_MANY, ONE_TO_ONE -> this;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -39,18 +39,21 @@ import com.kingsrook.qqq.backend.core.model.metadata.processes.QStepMetaData;
|
||||
*******************************************************************************/
|
||||
public class QStepMetaDataDeserializer extends JsonDeserializer<QStepMetaData>
|
||||
{
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
@Override
|
||||
@SuppressWarnings("checkstyle:Indentation")
|
||||
public QStepMetaData deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JacksonException
|
||||
{
|
||||
TreeNode treeNode = jsonParser.readValueAsTree();
|
||||
String stepType = DeserializerUtils.readTextValue(treeNode, "stepType");
|
||||
Class<? extends QStepMetaData> targetClass = switch(stepType)
|
||||
{
|
||||
case "backend" -> QBackendStepMetaData.class;
|
||||
case "frontend" -> QFrontendStepMetaData.class;
|
||||
default -> throw new IllegalArgumentException("Unsupported StepType " + stepType + " for deserialization");
|
||||
};
|
||||
{
|
||||
case "backend" -> QBackendStepMetaData.class;
|
||||
case "frontend" -> QFrontendStepMetaData.class;
|
||||
default -> throw new IllegalArgumentException("Unsupported StepType " + stepType + " for deserialization");
|
||||
};
|
||||
return (DeserializerUtils.reflectivelyDeserialize(targetClass, treeNode));
|
||||
}
|
||||
|
||||
|
@ -769,7 +769,6 @@ public class MemoryRecordStore
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
private static Serializable computeAggregate(List<QRecord> records, Aggregate aggregate, QTableMetaData table)
|
||||
{
|
||||
String fieldName = aggregate.getFieldName();
|
||||
|
@ -38,7 +38,6 @@ public class MockCountAction implements CountInterface
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:MagicNumber")
|
||||
public CountOutput execute(CountInput countInput) throws QException
|
||||
{
|
||||
try
|
||||
|
@ -95,10 +95,8 @@ public class MockQueryAction implements QueryInterface
|
||||
** Get a mock value to use, based on its type.
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:MagicNumber")
|
||||
public static Serializable getMockValue(QTableMetaData table, String field)
|
||||
{
|
||||
// @formatter:off // IJ can't do new-style switch correctly yet...
|
||||
return switch(table.getField(field).getType())
|
||||
{
|
||||
case STRING -> UUID.randomUUID().toString();
|
||||
@ -112,7 +110,6 @@ public class MockQueryAction implements QueryInterface
|
||||
case PASSWORD -> "abc***234";
|
||||
default -> throw new IllegalStateException("Unexpected value: " + table.getField(field).getType());
|
||||
};
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -134,7 +134,6 @@ public class BackendQueryFilterUtils
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
public static boolean doesCriteriaMatch(QFilterCriteria criterion, String fieldName, Serializable value)
|
||||
{
|
||||
ListIterator<Serializable> valueListIterator = criterion.getValues().listIterator();
|
||||
|
@ -58,7 +58,6 @@ public class StreamedETLExecuteStep extends BaseStreamedETLStep implements Backe
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||
{
|
||||
Optional<QBackendTransaction> transaction = Optional.empty();
|
||||
|
@ -793,7 +793,6 @@ public class ValueUtils
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:indentation")
|
||||
public static Serializable getValueAsFieldType(QFieldType type, Object value)
|
||||
{
|
||||
return switch(type)
|
||||
|
Reference in New Issue
Block a user