List<ProjectFeature> modules = CollectionUtil.newArrayList();
String[] featureStrs = StringUtils.split(featuresStr, "\r\n");
for(String featureStr : featureStrs) {
int index = ArrayUtils.indexOf(featureStrs, featureStr);
if(StringUtils.isNotBlank(featureStr)) {
ProjectFeature module = new ProjectFeature();
featureStr = StringUtils.substringBetween(featureStr, "[", "]");
String[] strs = StringUtils.split(featureStr, ",");
for(String str : strs) {
String key = StringUtils.substringBefore(str, "=");
String value = StringUtils.substringAfter(str, "=");
if(StringUtils.equals("label", key)) {
module.setLabel(value);
} else if(StringUtils.equals("code", key)) {
module.setCode(value);
} else if(StringUtils.equals("show", key)) {
module.setShow(StringUtils.equals("true", value));
} else if(StringUtils.equals("role", key)) {
module.setRoleCode(value);
}
}
module.setLevel(index);
modules.add(module);
}
}
return modules;
}