use of org.dbflute.properties.assistant.classification.DfClassificationElement in project dbflute-core by dbflute.
the class DfClsTopSubItemHandler method arrangeRegularSubItemList.
// ===================================================================================
// Regular SubItem
// ===============
// Regular SubItem means existing in all elements
public List<DfClsTopRegularSubItem> arrangeRegularSubItemList() {
final List<DfClassificationElement> elementList = _classificationTop.getClassificationElementList();
final Map<String, List<Object>> subItemListMap = new LinkedHashMap<String, List<Object>>();
for (DfClassificationElement element : elementList) {
final Map<String, Object> subItemMap = element.getSubItemMap();
if (subItemMap == null || subItemMap.isEmpty()) {
continue;
}
for (Entry<String, Object> entry : subItemMap.entrySet()) {
final String subItemKey = entry.getKey();
final Object subItemValue = entry.getValue();
List<Object> subItemList = subItemListMap.get(subItemKey);
if (subItemList == null) {
subItemList = new ArrayList<Object>();
subItemListMap.put(subItemKey, subItemList);
}
subItemList.add(subItemValue);
}
}
final String typeObject = DfClsTopRegularSubItem.TYPE_OBJECT;
final String typeString = DfClsTopRegularSubItem.TYPE_STRING;
final List<DfClsTopRegularSubItem> regularSubItemList = new ArrayList<DfClsTopRegularSubItem>();
final int elementSize = elementList.size();
for (Entry<String, List<Object>> entry : subItemListMap.entrySet()) {
final String subItemKey = entry.getKey();
final List<Object> subItemList = entry.getValue();
if (subItemList != null && subItemList.size() == elementSize) {
String subItemType = null;
for (Object value : subItemList) {
if (value == null) {
continue;
}
if (!(value instanceof String)) {
subItemType = typeObject;
break;
} else if (Srl.startsWith((String) value, "map:", "list:")) {
subItemType = typeObject;
break;
}
}
if (subItemType == null) {
subItemType = typeString;
}
regularSubItemList.add(new DfClsTopRegularSubItem(subItemKey, subItemType));
}
}
return regularSubItemList;
}
use of org.dbflute.properties.assistant.classification.DfClassificationElement in project dbflute-core by dbflute.
the class DfClsTableClassificationArranger method createBasicElement.
protected DfClassificationElement createBasicElement(DfClassificationTop classificationTop, Map<String, Object> elementMap, String table) {
final DfClassificationElement metaElement = new DfClassificationElement();
metaElement.setClassificationName(classificationTop.getClassificationName());
metaElement.setTable(table);
metaElement.acceptBasicItemMap(elementMap);
return metaElement;
}
use of org.dbflute.properties.assistant.classification.DfClassificationElement in project dbflute-core by dbflute.
the class DfFixedConditionDynamicAnalyzer method throwFixedConditionEmbeddedCommentClassificationElementNotFoundException.
protected void throwFixedConditionEmbeddedCommentClassificationElementNotFoundException(DfClassificationTop classificationTop, String elementName) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Not found the classification element in fixed condition.");
br.addItem("Foreign Key");
br.addElement(_foreignKey.getName());
br.addItem("Classification Name");
br.addElement(classificationTop.getClassificationName());
br.addItem("NotFound Element");
br.addElement(elementName);
br.addItem("Defined Element");
final List<DfClassificationElement> elementList = classificationTop.getClassificationElementList();
for (DfClassificationElement element : elementList) {
br.addElement(element);
}
final String msg = br.buildExceptionMessage();
throw new DfFixedConditionInvalidClassificationEmbeddedCommentException(msg);
}
use of org.dbflute.properties.assistant.classification.DfClassificationElement 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.DfClassificationElement in project dbflute-core by dbflute.
the class DfClsTopGroupElementHandling method throwClassificationGroupingMapElementNotFoundException.
protected void throwClassificationGroupingMapElementNotFoundException(String elementName) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Not found the classification element in the grouping map.");
br.addItem("Classification Name");
br.addElement(_classificationTop.getClassificationName());
br.addItem("Group Name");
br.addElement(_groupName);
br.addItem("NotFound Name");
br.addElement(elementName);
br.addItem("Defined Element");
final List<DfClassificationElement> elementList = _classificationTop.getClassificationElementList();
for (DfClassificationElement element : elementList) {
br.addElement(element);
}
final String msg = br.buildExceptionMessage();
throw new DfIllegalPropertySettingException(msg);
}
Aggregations