use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class ForeignKey method doExtractFixedConditionEmbeddedCommentClassificationGroupCode.
protected String doExtractFixedConditionEmbeddedCommentClassificationGroupCode(DfClassificationTop classificationTop, String elementName) {
String code = null;
final List<DfClassificationGroup> groupList = classificationTop.getGroupList();
for (DfClassificationGroup group : groupList) {
final String groupName = group.getGroupName();
if (elementName.equals(groupName)) {
final List<DfClassificationElement> groupElementList = group.getElementList();
StringBuilder sb = new StringBuilder();
for (DfClassificationElement groupelement : groupElementList) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(quoteClassifiationElementIfNeeds(classificationTop, groupelement.getCode()));
}
sb.insert(0, "(").append(")");
code = sb.toString();
break;
}
}
return code;
}
use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class DfAppClsTableLoader method handleRefCls.
protected void handleRefCls(DfClassificationTop classificationTop, DfRefClsElement refClsElement) {
refClsElement.checkFormalRefType(classificationTop);
classificationTop.addRefClsElement(refClsElement);
if (refClsElement.isRefTypeIncluded()) {
final DfClassificationTop dbClsTop = refClsElement.getDBClsTop();
final String groupName = refClsElement.getGroupName();
if (groupName != null) {
final DfClassificationGroup group = dbClsTop.getGroupList().stream().filter(gr -> {
return gr.getGroupName().equals(groupName);
}).findFirst().orElseThrow(() -> {
String msg = "Not found the group name: " + refClsElement.getClassificationName() + "." + groupName;
return new DfIllegalPropertySettingException(msg);
});
classificationTop.addClassificationElementAll(group.getElementList());
} else {
final List<DfClassificationElement> dbElementList = dbClsTop.getClassificationElementList();
classificationTop.addClassificationElementAll(dbElementList);
classificationTop.acceptGroupList(dbClsTop.getGroupList());
}
}
}
use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class DfWebClsTableLoader method handleRefCls.
protected void handleRefCls(DfClassificationTop classificationTop, DfRefClsElement refClsElement) {
refClsElement.checkFormalRefType(classificationTop);
classificationTop.addRefClsElement(refClsElement);
if (refClsElement.isRefTypeIncluded()) {
final DfClassificationTop dbClsTop = refClsElement.getDBClsTop();
final String groupName = refClsElement.getGroupName();
if (groupName != null) {
final DfClassificationGroup group = dbClsTop.getGroupList().stream().filter(gr -> {
return gr.getGroupName().equals(groupName);
}).findFirst().orElseThrow(() -> {
String msg = "Not found the group name: " + refClsElement.getClassificationName() + "." + groupName;
return new DfIllegalPropertySettingException(msg);
});
classificationTop.addClassificationElementAll(group.getElementList());
} else {
final List<DfClassificationElement> dbElementList = dbClsTop.getClassificationElementList();
classificationTop.addClassificationElementAll(dbElementList);
classificationTop.acceptGroupList(dbClsTop.getGroupList());
}
}
}
use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class DfClsTopGroupListArranger method throwClassificationGroupingMapReferenceNotFoundException.
protected void throwClassificationGroupingMapReferenceNotFoundException(List<DfClassificationGroup> groupList, DfClassificationGroup group, String refName) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Not found the refenrece in the grouping map.");
br.addItem("Classification Name");
br.addElement(group.getClassificationName());
br.addItem("Group Name");
br.addElement(group.getGroupName());
br.addItem("NotFound Name");
br.addElement(refName);
br.addItem("Defined Group");
for (DfClassificationGroup defined : groupList) {
br.addElement(defined);
}
final String msg = br.buildExceptionMessage();
throw new DfIllegalPropertySettingException(msg);
}
use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class DfClsTopGroupListArranger method resolveGroupVariable.
// -----------------------------------------------------
// Group Variable
// --------------
protected void resolveGroupVariable(List<DfClassificationGroup> groupList) {
final Map<String, DfClassificationGroup> groupMap = new LinkedHashMap<String, DfClassificationGroup>();
for (DfClassificationGroup group : groupList) {
groupMap.put(group.getGroupName(), group);
}
// e.g.
// ; servicePlus = map:{
// ; elementList = list:{ $$ref$$.serviceAvailable ; Withdrawal }
// }
final String refPrefix = "$$ref$$.";
for (DfClassificationGroup group : groupList) {
final List<String> elementNameList = group.getElementNameList();
final Set<String> resolvedNameSet = new LinkedHashSet<String>();
for (String elementName : elementNameList) {
if (Srl.startsWith(elementName, refPrefix)) {
final String refName = Srl.substringFirstRear(elementName, refPrefix).trim();
final DfClassificationGroup refGroup = groupMap.get(refName);
if (refGroup == null) {
throwClassificationGroupingMapReferenceNotFoundException(groupList, group, refName);
}
resolvedNameSet.addAll(refGroup.getElementNameList());
} else {
resolvedNameSet.add(elementName);
}
}
if (elementNameList.size() < resolvedNameSet.size()) {
group.setElementNameList(new ArrayList<String>(resolvedNameSet));
}
}
}
Aggregations