표준전문 조건 처리 기능 OR 처리 추가
This commit is contained in:
@@ -124,32 +124,29 @@ public class FlatReader implements StandardReader {
|
|||||||
if(refItemValue != null) refItemValue = refItemValue.trim();
|
if(refItemValue != null) refItemValue = refItemValue.trim();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 값의 경우의수 NR,ER,""(blank)
|
* 값의 경우의수 NM,EM,""(blank)
|
||||||
* ER이 아닐경우 표현하고 싶어서 ! 를 추가했음
|
* ! : NOT 조건 (예: !EM → EM이 아닌 경우)
|
||||||
* 원칙으로는 NR을 넣었을경우에는 NR 이 있을경우에만 해당됨
|
* | : OR 조건 (예: NM|EM → NM 또는 EM인 경우)
|
||||||
* !ER일경우에는 blank와 NR일 경우에 해당됨
|
* !와 | 조합 가능 (예: !NM|EM → NM도 아니고 EM도 아닌 경우)
|
||||||
*/
|
*/
|
||||||
String refValue = currentItem.getRefValue();
|
String refValue = currentItem.getRefValue();
|
||||||
if (refValue.startsWith("!")) { // 느낌표가 들어가면 다음에 나오는게 아닌경우
|
boolean isNot = refValue.startsWith("!");
|
||||||
|
if (isNot) {
|
||||||
refValue = refValue.substring(1);
|
refValue = refValue.substring(1);
|
||||||
if (refValue.equals(refItemValue)) {
|
}
|
||||||
|
|
||||||
|
boolean matched = matchRefValue(refValue, refItemValue);
|
||||||
|
if (isNot) {
|
||||||
|
matched = !matched;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!matched) {
|
||||||
logger.warn("@GROUP name={} SKIPPED.", currentItem.getName());
|
logger.warn("@GROUP name={} SKIPPED.", currentItem.getName());
|
||||||
currentItem.setHidden(true);
|
currentItem.setHidden(true);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
currentItem.setHidden(false);
|
currentItem.setHidden(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
if (!currentItem.getRefValue().equals(refItemValue)) {
|
|
||||||
logger.warn("@GROUP name={} SKIPPED.", currentItem.getName());
|
|
||||||
currentItem.setHidden(true);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
currentItem.setHidden(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
childList = currentItem.getChildsList();
|
childList = currentItem.getChildsList();
|
||||||
for(int i=0; i<childList.size(); i++) {
|
for(int i=0; i<childList.size(); i++) {
|
||||||
@@ -310,6 +307,21 @@ public class FlatReader implements StandardReader {
|
|||||||
}
|
}
|
||||||
return refItemValue;
|
return refItemValue;
|
||||||
}
|
}
|
||||||
// public static void main(String[] args) {
|
|
||||||
// }
|
/**
|
||||||
|
* refValue와 refItemValue를 비교하여 일치 여부를 반환
|
||||||
|
* | 구분자로 OR 조건 지원 (예: "NM|EM" → "NM" 또는 "EM"과 일치하면 true)
|
||||||
|
*/
|
||||||
|
private boolean matchRefValue(String refValue, String refItemValue) {
|
||||||
|
if (refValue.contains("|")) {
|
||||||
|
String[] values = refValue.split("\\|");
|
||||||
|
for (String val : values) {
|
||||||
|
if (val.equals(refItemValue)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return refValue.equals(refItemValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user