use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class DfClsTopGroupListArranger method arrangeGroupList.
// ===================================================================================
// Group List
// ==========
public List<DfClassificationGroup> arrangeGroupList() {
final List<DfClassificationGroup> groupList = new ArrayList<DfClassificationGroup>();
for (Entry<String, Map<String, Object>> entry : _groupingMap.entrySet()) {
final String groupName = entry.getKey();
final Map<String, Object> attrMap = entry.getValue();
// #for_now jflute not required for a long time but required better? (2021/07/05)
final String groupComment = (String) attrMap.get(KEY_GROUP_COMMENT);
@SuppressWarnings("unchecked") final List<String> elementList = (List<String>) attrMap.get(KEY_ELEMENT_LIST);
if (elementList == null) {
String msg = "The elementList in grouping map is required: " + _classificationTop.getClassificationName();
throw new DfClassificationRequiredAttributeNotFoundException(msg);
}
final String docOnly = (String) attrMap.get(KEY_USE_DOCUMENT_ONLY);
final DfClassificationGroup group = new DfClassificationGroup(_classificationTop, groupName);
group.setGroupComment(groupComment);
group.setElementNameList(elementList);
group.setUseDocumentOnly(docOnly != null && docOnly.trim().equalsIgnoreCase("true"));
groupList.add(group);
}
resolveGroupVariable(groupList);
return filterTaskMatchingList(groupList);
}
use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class DfClsTopGroupListArranger method filterTaskMatchingList.
// -----------------------------------------------------
// Task-Matching List
// ------------------
protected List<DfClassificationGroup> filterTaskMatchingList(List<DfClassificationGroup> groupList) {
final List<DfClassificationGroup> realList = new ArrayList<DfClassificationGroup>();
final boolean docOnly = isDocOnlyTaskNow();
for (DfClassificationGroup group : groupList) {
if (!docOnly && group.isUseDocumentOnly()) {
continue;
}
realList.add(group);
}
return realList;
}
use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class DfFixedConditionDynamicAnalyzer method doExtractEmbeddedCommentClassificationGroupCode.
protected String doExtractEmbeddedCommentClassificationGroupCode(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 DfRefClsLoadingHandler method createRefClsElement.
public DfRefClsElement createRefClsElement(String classificationName, Map<String, Object> elementMap, DfFreeGenResource resource) {
// e.g. map:{ refCls=maihamadb@MemberStatus ; refType=included }
final String refAttr = (String) elementMap.get(DfRefClsElement.KEY_REFCLS);
// of e.g. DB or "appcls" or namedcls's name
final String refClsTheme;
// classification name
final String refClsName;
final String refGroupName;
if (refAttr.contains("@")) {
// #hope other schema's reference
refClsTheme = Srl.substringFirstFront(refAttr, "@");
final String rearName = Srl.substringFirstRear(refAttr, "@");
if (rearName.contains(".")) {
refClsName = Srl.substringFirstFront(rearName, ".");
refGroupName = Srl.substringFirstRear(rearName, ".");
} else {
refClsName = rearName;
refGroupName = null;
}
} else {
// current DB as default
refClsTheme = getBasicProperties().getProjectName();
if (refAttr.contains(".")) {
refClsName = Srl.substringFirstFront(refAttr, ".");
refGroupName = Srl.substringFirstRear(refAttr, ".");
} else {
refClsName = refAttr;
refGroupName = null;
}
}
final String refType = extractRefType(classificationName, elementMap);
final DfClassificationTop referredClsTop = findReferredClsTop(classificationName, refAttr, refClsTheme, refClsName, resource);
final DfRefClsReferredCDef referredCDef = findReferredCDef(classificationName, refAttr, refClsTheme, refClsName, resource);
final DfClassificationGroup referredGroup = findReferredGroup(classificationName, refAttr, refClsTheme, refClsName, refGroupName, referredClsTop, resource);
final String resourceFile = resource.getResourceFile();
return new DfRefClsElement(refClsTheme, refClsName, refGroupName, refType, referredClsTop, referredCDef, referredGroup, resourceFile);
}
use of org.dbflute.properties.assistant.classification.DfClassificationGroup in project dbflute-core by dbflute.
the class DfClsTopGroupInheritanceArranger method inheritRefClsGroup.
// ===================================================================================
// Inherit Group
// =============
public void inheritRefClsGroup(Map<String, Map<String, Object>> groupingMap) {
// for e.g. appcls
if (_classificationTop.isAlreadyGroupArranged()) {
// basically no way
throw new IllegalStateException("Group objects are already arranged so too late: " + _classificationTop);
}
final List<DfClassificationGroup> referredGroupList = _referredClsTop.getGroupList();
for (DfClassificationGroup referredGroup : referredGroupList) {
if (groupingMap.containsKey(referredGroup.getGroupName())) {
throwClassificationReferredGroupingMapConflictException(referredGroup);
}
final List<String> translatedElementNameList = translateElementNameList(referredGroup);
if (translatedElementNameList.isEmpty()) {
// when completely not related to the group elements
continue;
}
final Map<String, Object> contentMap = new LinkedHashMap<>();
contentMap.put(DfClsTopGroupListArranger.KEY_GROUP_COMMENT, referredGroup.getGroupComment());
contentMap.put(DfClsTopGroupListArranger.KEY_ELEMENT_LIST, translatedElementNameList);
contentMap.put(DfClsTopGroupListArranger.KEY_USE_DOCUMENT_ONLY, String.valueOf(referredGroup.isUseDocumentOnly()));
groupingMap.put(referredGroup.getGroupName(), contentMap);
}
}
Aggregations