Search in sources :

Example 6 with TbpSysDaoMethodsDVO

use of kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO in project Gargoyle by callakrsos.

the class DaoWizardViewController method addDefDaoMethod.

/**
	 * 디폴트 메소드를 추가함.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 22.
	 * @param methodName
	 * @return
	 */
private TbpSysDaoMethodsDVO addDefDaoMethod(String methodName, boolean select) {
    TbmSysDaoDVO tbmSysDaoDVO = tbmSysDaoDVOProperty.get();
    TbpSysDaoMethodsDVO e = new TbpSysDaoMethodsDVO(tbmSysDaoDVO);
    e.setMethodName(methodName);
    // UI에 데이터를 보여줌
    tbMethods.getItems().add(e);
    if (select) {
        tbMethods.getSelectionModel().select(e);
    }
    /* 메모리에 데이터 적재 */
    List<TbpSysDaoMethodsDVO> tbpSysDaoMethodsDVOList = tbmSysDaoDVO.getTbpSysDaoMethodsDVOList();
    tbpSysDaoMethodsDVOList.add(e);
    return e;
}
Also used : TbpSysDaoMethodsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO) TbmSysDaoDVO(kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO)

Example 7 with TbpSysDaoMethodsDVO

use of kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO 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());
    }
}
Also used : TbpSysDaoMethodsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO) TbmSysDaoDVO(kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO) DaoWizardConverter(com.kyj.fx.voeditor.visual.util.DaoWizardConverter) JavaTextView(com.kyj.fx.voeditor.visual.component.popup.JavaTextView) ClassMeta(com.kyj.fx.voeditor.core.model.meta.ClassMeta) FieldMeta(com.kyj.fx.voeditor.core.model.meta.FieldMeta) IOException(java.io.IOException) Pair(javafx.util.Pair) FXML(javafx.fxml.FXML)

Example 8 with TbpSysDaoMethodsDVO

use of kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO in project Gargoyle by callakrsos.

the class DaoWizardViewController method tbMethodsOnMouseClick.

/**
	 * 메소드 테이블 로우 더블클릭 이벤트처리.
	 *
	 * 저장되어있는 SQL을 UI에 보여주는 기능을한다.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 21.
	 * @param e
	 */
@FXML
public void tbMethodsOnMouseClick(MouseEvent e) {
    if (e.getClickCount() == 2) {
        // tbParams.getItems().clear();
        List<TbpSysDaoFieldsDVO> selectedFieldItems = getSelectedFieldItems();
        TbpSysDaoMethodsDVO selectedMethodItem = getSelectedMethodItem();
        if (selectedMethodItem != null) {
            String sqlBody = selectedMethodItem.getSqlBody();
            txtSql.setContent(sqlBody);
            List<TbpSysDaoColumnsDVO> tbpSysDaoColumnsDVOList = selectedMethodItem.getTbpSysDaoColumnsDVOList();
            tbMappings.setItems(FXCollections.observableArrayList(tbpSysDaoColumnsDVOList));
        }
        if (selectedFieldItems != null)
            tbParams.setItems(FXCollections.observableList(selectedFieldItems));
    }
}
Also used : TbpSysDaoMethodsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO) TbpSysDaoColumnsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoColumnsDVO) TbpSysDaoFieldsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoFieldsDVO) FXML(javafx.fxml.FXML)

Example 9 with TbpSysDaoMethodsDVO

use of kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO in project Gargoyle by callakrsos.

the class DaoWizardTest method test.

/********************************
	 * 작성일 : 2016. 4. 16. 작성자 : KYJ
	 *
	 *
	 * DAO Wizard Test Case
	 *
	 * @throws Exception
	 ********************************/
@Test
public void test() throws Exception {
    // *******클래스 정보
    ClassMeta classMeta = new ClassMeta("Hello");
    // ******메소드 정보
    TbpSysDaoMethodsDVO methodMeta = new TbpSysDaoMethodsDVO(classMeta);
    // 메소드명
    methodMeta.setMethodName("simple");
    // SQL문
    methodMeta.setSqlBody("select 1 as ss from dual where name = :name");
    // 데이터베이스 타입에 대한정보
    TbpSysDaoColumnsDVO tbpSysDaoColumnsDVO = new TbpSysDaoColumnsDVO();
    tbpSysDaoColumnsDVO.setColumnName("name");
    tbpSysDaoColumnsDVO.setColumnType("VARCHAR");
    methodMeta.setTbpSysDaoColumnsDVOList(Arrays.asList(tbpSysDaoColumnsDVO));
    // 테스트 필드에 대한정보.. (이부분은 크게 중요치는않음.)
    TbpSysDaoFieldsDVO tbpSysDaoFieldsDVO = new TbpSysDaoFieldsDVO();
    tbpSysDaoFieldsDVO.setFieldName("name");
    tbpSysDaoFieldsDVO.setTestValue("kyj");
    tbpSysDaoFieldsDVO.setType("java.lang.String");
    methodMeta.setTbpSysDaoFieldsDVOList(Arrays.asList(tbpSysDaoFieldsDVO));
    // 리턴타입에 대한정보
    methodMeta.setResultVoClass("com.sample.Hello");
    // DAO생성을 위한준비
    DaoWizard<ClassMeta, TbpSysDaoMethodsDVO, FieldMeta> wizard = new DaoWizard(classMeta, Arrays.asList(methodMeta));
    // 반드시호출.
    wizard.build();
    // 확인
    System.out.println(wizard.toText());
    Assert.assertNotNull(wizard.toText());
}
Also used : TbpSysDaoMethodsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO) DaoWizard(kyj.Fx.dao.wizard.DaoWizard) ClassMeta(com.kyj.fx.voeditor.core.model.meta.ClassMeta) FieldMeta(com.kyj.fx.voeditor.core.model.meta.FieldMeta) TbpSysDaoColumnsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoColumnsDVO) TbpSysDaoFieldsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoFieldsDVO) Test(org.junit.Test)

Example 10 with TbpSysDaoMethodsDVO

use of kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO in project Gargoyle by callakrsos.

the class DaoWizardViewController method defaultDaoMethodByTable.

/**
	 * 데이터베이스 처리에의한 디폴트값(TbpSysDaoMethodsDVO) 생성
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 21.
	 * @param items
	 * @param size
	 */
private void defaultDaoMethodByTable(ObservableList<TbpSysDaoMethodsDVO> items) {
    String appendName = DateUtil.getCurrentDateString(DateUtil.SYSTEM_DATEFORMAT_YYYYMMDDHHMMSSS);
    TbpSysDaoMethodsDVO e = addDefDaoMethod("dList" + appendName, true);
    String tableName = txtTableName.getText();
    List<String> columns = getTableColumns(tableName);
    String sqlBody = QuerygenUtil.queryjen(tableName, columns);
    e.setSqlBody(sqlBody);
}
Also used : TbpSysDaoMethodsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO)

Aggregations

TbpSysDaoMethodsDVO (kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO)12 TbmSysDaoDVO (kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO)4 TbpSysDaoFieldsDVO (kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoFieldsDVO)4 SQLException (java.sql.SQLException)3 FXML (javafx.fxml.FXML)3 TbpSysDaoColumnsDVO (kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoColumnsDVO)3 ClassMeta (com.kyj.fx.voeditor.core.model.meta.ClassMeta)2 FieldMeta (com.kyj.fx.voeditor.core.model.meta.FieldMeta)2 IOException (java.io.IOException)2 BaseOpenClassResourceView (com.kyj.fx.voeditor.visual.component.popup.BaseOpenClassResourceView)1 JavaTextView (com.kyj.fx.voeditor.visual.component.popup.JavaTextView)1 MeerketAbstractVoOpenClassResourceView (com.kyj.fx.voeditor.visual.component.popup.MeerketAbstractVoOpenClassResourceView)1 CommonContextMenuEvent (com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent)1 DaoWizardConverter (com.kyj.fx.voeditor.visual.util.DaoWizardConverter)1 ResultSet (java.sql.ResultSet)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 ReadOnlyObjectWrapper (javafx.beans.property.ReadOnlyObjectWrapper)1