use of com.kyj.fx.voeditor.core.model.meta.FieldMeta in project Gargoyle by callakrsos.
the class FieldMetaFunction method apply.
@Override
public List<FieldMeta> apply(List<TableModelDVO> models) {
List<FieldMeta> fileMetaList = new ArrayList<>(models.size());
for (TableModelDVO tableModel : models) {
try {
String fieldName = tableModel.getName();
String type = tableModel.getType();
FieldMeta fieldMeta = ClassTypeResourceLoader.getInstance().get(type);
fieldMeta.setName(fieldName);
fieldMeta.setModifier(Modifier.PRIVATE);
if ("Y".equals(tableModel.getPk())) {
fieldMeta.setPrimarykey(true);
}
fileMetaList.add(fieldMeta);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
return fileMetaList;
}
use of com.kyj.fx.voeditor.core.model.meta.FieldMeta in project Gargoyle by callakrsos.
the class SimpleTest method test.
@Test
public void test() throws Exception {
FieldMeta fieldMeta = new FieldMeta((Modifier.PRIVATE), "sample", String.class);
fieldMeta.setPrimarykey(true);
fieldMeta.setAlias("키속성");
FieldMeta fieldMeta2 = new FieldMeta((Modifier.PRIVATE), "sample2", String.class);
FieldMeta fieldMeta3 = new FieldMeta((Modifier.PRIVATE), "check", boolean.class);
FieldMeta fieldMeta4 = new FieldMeta((Modifier.PRIVATE), "count", int.class);
FieldMeta fieldMeta5 = new FieldMeta((Modifier.PRIVATE), "name", StringProperty.class, SimpleStringProperty.class);
FieldMeta fieldMeta6 = new FieldMeta((Modifier.PRIVATE), "name2", StringProperty.class, SimpleStringProperty.class);
/*
* , FxVo.class, new Class<?>[] { IExtractClass .class, IExtractField
* .class }
*/
ClassMeta classMeta = new ClassMeta("com.sample", "Simple");
VoEditor voEditor = new VoEditor(classMeta, fieldMeta, fieldMeta2, fieldMeta3, fieldMeta4, fieldMeta5, fieldMeta6);
voEditor.build();
String text = voEditor.toText();
LOGGER.debug(text);
}
use of com.kyj.fx.voeditor.core.model.meta.FieldMeta in project Gargoyle by callakrsos.
the class BaseFxExtractConstructor method work.
@Override
public void work(FxVo vo, ClassMeta classMeta, FieldMeta... fieldMetas) {
StringBuffer constructPart = vo.getConstructPart();
constructPart.append("\tpublic ").append(classMeta.getName()).append("( ) \n");
constructPart.append("\t{ \n");
for (FieldMeta meta : fieldMetas) {
try {
this.extract(vo, meta);
} catch (Exception e) {
e.printStackTrace();
}
}
constructPart.append("\t} \n");
}
use of com.kyj.fx.voeditor.core.model.meta.FieldMeta in project Gargoyle by callakrsos.
the class DaoWizardViewController method btnGenerateOnMouseClick.
/**
* DAO Wizard 생성 버튼 이벤트
*
* @작성자 : KYJ
* @작성일 : 2015. 10. 28.
*/
@FXML
public void btnGenerateOnMouseClick(MouseEvent event) {
try {
int checkValidation = checkValidation();
String className = txtClassName.getText();
String location = txtDaoLocation.getText();
String packageName = txtPackageName.getText();
String desc = txtAreaDaoDesc.getText();
// 저장처리전 검증 및 위자드로 한번 확인
String extendsBaseClass = ConfigResourceLoader.getInstance().get(ConfigResourceLoader.DAO_WIZARD_DEFAULT_EXTENDS_CLASS);
ClassMeta classMeta = EditorUtil.extractedClassMeta(className, packageName, extendsBaseClass);
classMeta.setDesc(desc);
// TbmSysDaoDVO tbmSysDaoDVO = tbmSysDaoDVOProperty.get();
// tbmSysDaoDVO.setClassName(className);
// tbmSysDaoDVO.setLocation(location);
// tbmSysDaoDVO.setPackageName(packageName);
// tbmSysDaoDVO.setDesc(desc);
// tbmSysDaoDVO.setExtendClassNameStr(extendsBaseClass);
DaoWizardConverter converter = new DaoWizardConverter(classMeta, tbmSysDaoDVOProperty.get());
converter.createWizard(Wizardtype.meerkatbase);
DaoWizard<ClassMeta, TbpSysDaoMethodsDVO, FieldMeta> daowizard = converter.convert();
if (location != null && !location.isEmpty()) {
Optional<Pair<String, String>> showYesOrNoDialog = DialogUtil.showYesOrNoDialog("파일생성여부", "파일도 만드시겠습니까? ");
showYesOrNoDialog.ifPresent(string -> {
if ("Y".equals(string.getValue())) {
try {
daowizard.toFile(ValueUtil.appendBaseDir(location));
} catch (Exception e) {
DialogUtil.showExceptionDailog(e);
}
}
});
}
// 위의 검증작업에서 이상없을시 데이터베이스 저장작업
if (checkValidation == MESSAGE_CODES.indexOf(MSG_NOMAL)) {
JavaTextView simpleTextView = new JavaTextView(daowizard.toText());
simpleTextView.show();
Optional<Pair<String, String>> showYesOrNoDialog = DialogUtil.showYesOrNoDialog(MESSAGE_CODES.get(checkValidation), "Code : [" + checkValidation + "]\n" + MESSAGE_CODES.get(checkValidation) + "\nDo you want save. ?");
showYesOrNoDialog.ifPresent(option -> {
if ("Y".equals(option.getValue())) {
TbmSysDaoDVO saveTbmSysDaoDVO = this.tbmSysDaoDVOProperty.get();
saveTbmSysDaoDVO.setClassName(className);
saveTbmSysDaoDVO.setLocation(location);
saveTbmSysDaoDVO.setPackageName(packageName);
saveTbmSysDaoDVO.setClassDesc(desc);
saveTbmSysDaoDVO.setExtendsClassName(extendsBaseClass);
save(saveTbmSysDaoDVO);
}
});
} else {
DialogUtil.showMessageDialog("Error Code[" + checkValidation + "]\n" + MESSAGE_CODES.get(checkValidation));
}
// if (checkValidation == MESSAGE_CODES.indexOf(MSG_NOMAL)) {
//
// } else {
// DialogUtil.showMessageDialog(MESSAGE_CODES.get(checkValidation));
// }
} catch (Exception e) {
DialogUtil.showExceptionDailog(e, e.getMessage());
}
}
use of com.kyj.fx.voeditor.core.model.meta.FieldMeta in project Gargoyle by callakrsos.
the class ClassTypeResourceLoader method get.
public FieldMeta get(String key) throws ClassNotFoundException {
String property = properties.getProperty(key);
FieldMeta fieldMeta = null;
if (property == null) {
// return null;
throw new IllegalArgumentException("Key Value not found!");
}
if (property.indexOf('!') < 0) {
Class<?> instanceClass = Class.forName(property);
fieldMeta = new FieldMeta(instanceClass);
if (fieldMeta == null) {
String msg = String.format("Could not create meta instance... type : %s instance %s", instanceClass);
throw new IllegalStateException(msg);
}
} else {
String[] split = property.split("!");
String _typeClass = split[0];
String _instanceClass = split[1];
Class<?> typeClass = Class.forName(_typeClass);
Class<?> instanceClass = Class.forName(_instanceClass);
fieldMeta = new FieldMeta(typeClass, instanceClass);
if (fieldMeta == null) {
String msg = String.format("Could not create meta instance... type : %s instance %s", _typeClass, _instanceClass);
throw new IllegalStateException(msg);
}
}
return fieldMeta;
}
Aggregations