Skip to content

Commit

Permalink
LPD-42641 Keep the naming consistent between the service and the finder
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchandotcom committed Dec 10, 2024
1 parent 2ce39d2 commit 0dc308a
Showing 1 changed file with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ public int filterCountF_A_ByG_F_DDMSI(

@Override
public int filterCountF_A_ByG_F_DDMSI_NotS(
long groupId, long folderId, long ddmStructureId, int[] statuses,
QueryDefinition<?> queryDefinition) {
long groupId, long folderId, long ddmStructureId,
int[] excludedStatuses, QueryDefinition<?> queryDefinition) {

return doCountF_A_ByG_F_DDMSI_NotS(
groupId, folderId, ddmStructureId, statuses, queryDefinition, true);
groupId, folderId, ddmStructureId, excludedStatuses, queryDefinition, true);
}

@Override
Expand All @@ -114,10 +114,10 @@ public List<Object> filterFindF_A_ByG_F_DDMSI_L(

public List<Object> filterFindF_A_ByG_F_DDMSI_L_NotS(
long groupId, long folderId, long ddmStructureId, Locale locale,
int[] statuses, QueryDefinition<?> queryDefinition) {
int[] excludedStatuses, QueryDefinition<?> queryDefinition) {

return doFindF_A_ByG_F_DDMSI_L_NotS(
groupId, folderId, ddmStructureId, locale, statuses,
groupId, folderId, ddmStructureId, locale, excludedStatuses,
queryDefinition, true);
}

Expand Down Expand Up @@ -159,7 +159,7 @@ public List<JournalFolder> findF_ByNoAssets() {
}

protected int doCountF_A_ByG_F_DDMSI_NotS(
long groupId, long folderId, long ddmStructureId, int[] statuses,
long groupId, long folderId, long ddmStructureId, int[] excludedStatuses,
QueryDefinition<?> queryDefinition, boolean inlineSQLHelper) {

Session session = null;
Expand All @@ -178,7 +178,7 @@ protected int doCountF_A_ByG_F_DDMSI_NotS(
COUNT_A_BY_G_U_F_DDMSI_NOT_S, groupId, queryDefinition,
inlineSQLHelper),
StringPool.CLOSE_PARENTHESIS),
folderId, ddmStructureId, statuses);
folderId, ddmStructureId, excludedStatuses);

SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);

Expand Down Expand Up @@ -331,7 +331,7 @@ sqlQuery, getDialect(), queryDefinition.getStart(),

protected List<Object> doFindF_A_ByG_F_DDMSI_L_NotS(
long groupId, long folderId, long ddmStructureId, Locale locale,
int[] statuses, QueryDefinition<?> queryDefinition,
int[] excludedStatuses, QueryDefinition<?> queryDefinition,
boolean inlineSQLHelper) {

Session session = null;
Expand All @@ -350,7 +350,7 @@ protected List<Object> doFindF_A_ByG_F_DDMSI_L_NotS(
FIND_A_BY_G_U_F_DDMSI_L_NOT_S, groupId, queryDefinition,
inlineSQLHelper),
StringPool.CLOSE_PARENTHESIS),
folderId, ddmStructureId, statuses);
folderId, ddmStructureId, excludedStatuses);

sql = _customSQL.replaceOrderBy(
sql, queryDefinition.getOrderByComparator());
Expand Down Expand Up @@ -498,8 +498,10 @@ protected String getFoldersSQL(
return sql;
}

protected String getExcludedStatuses(int[] statuses, String tableName) {
if (ArrayUtil.isEmpty(statuses)) {
protected String getExcludedStatuses(
int[] excludedStatuses, String tableName) {

if (ArrayUtil.isEmpty(excludedStatuses)) {
return StringPool.BLANK;
}

Expand All @@ -509,10 +511,10 @@ protected String getExcludedStatuses(int[] statuses, String tableName) {
sb.append(tableName);
sb.append(".status not in (");

for (int i = 0; i < statuses.length; i++) {
sb.append(statuses[i]);
for (int i = 0; i < excludedStatuses.length; i++) {
sb.append(excludedStatuses[i]);

if (i != (statuses.length - 1)) {
if (i != (excludedStatuses.length - 1)) {
sb.append(", ");
}
}
Expand All @@ -523,7 +525,7 @@ protected String getExcludedStatuses(int[] statuses, String tableName) {
}

protected String updateSQL(
String sql, long folderId, long ddmStructureId, int[] statuses) {
String sql, long folderId, long ddmStructureId, int[] excludedStatuses) {

return StringUtil.replace(
sql,
Expand All @@ -534,7 +536,8 @@ protected String updateSQL(
new String[] {
getFolderId(folderId, JournalArticleImpl.TABLE_NAME),
getDDMStructureId(ddmStructureId),
getExcludedStatuses(statuses, JournalArticleImpl.TABLE_NAME),
getExcludedStatuses(
excludedStatuses, JournalArticleImpl.TABLE_NAME),
getFolderId(folderId, JournalFolderImpl.TABLE_NAME)
});
}
Expand Down

0 comments on commit 0dc308a

Please sign in to comment.