Search in sources :

Example 1 with ProgramSpecSVO

use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO in project Gargoyle by callakrsos.

the class SpecTabPane method createDocument.

/********************************
	 * 작성일 : 2016. 8. 21. 작성자 : KYJ
	 *
	 * 사양서 생성 작업처리
	 * 
	 * @param location
	 * @return 성공하면 File값이 존재. 실패하면 null
	 ********************************/
public final File createDocument(File location) {
    ProgramSpecSVO svo = new ProgramSpecSVO();
    ObservableList<Tab> tabs = getTabs();
    for (Tab t : tabs) {
        if (t instanceof AbstractSpecTab) {
            AbstractSpecTab abtab = (AbstractSpecTab) t;
            abtab.createDocumentAction(svo);
        }
    }
    if (ProgramSpecUtil.createDefault(svo, location)) {
        return location;
    }
    return null;
}
Also used : Tab(javafx.scene.control.Tab) ProgramSpecSVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO)

Example 2 with ProgramSpecSVO

use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO in project Gargoyle by callakrsos.

the class ProgramSpecUtil method doJavaFile.

public static ProgramSpecSVO doJavaFile(String projectName, String fileName, AbstractJavaProgramSpecFile newInstance) {
    ProgramSpecSVO svo = new ProgramSpecSVO();
    String packageNames = newInstance.getPackage();
    newInstance.setPackage(packageNames);
    newInstance.setProjectName(projectName);
    svo.setFile(newInstance);
    // svo.getUserSourceMetaDVO().setProjectName(projectName);
    // svo.getUserSourceMetaDVO().setPackages(packageNames);
    String userName = System.getProperty("user.name");
    List<SourceAnalysisDVO> listStatement = newInstance.listStatement();
    UserSourceMetaDVO userSourceMetaDVO = new UserSourceMetaDVO();
    userSourceMetaDVO.setProjectName(projectName);
    userSourceMetaDVO.setSimpleFileName(fileName);
    userSourceMetaDVO.setRealFilePath(newInstance.getFullFileName());
    userSourceMetaDVO.setUserPcName(userName);
    userSourceMetaDVO.setPackages(packageNames);
    svo.setUserSourceMetaDVO(userSourceMetaDVO);
    /* 시작 import문 처리 */
    List<String> imports = newInstance.getImports();
    ImportsDVO importsDVO = new ImportsDVO();
    importsDVO.setImports(imports);
    svo.setImportsDVO(importsDVO);
    /* 끝 import문 처리 */
    // 테이블 데이터 바인드
    List<MethodDVO> methodDVOList = new ArrayList<MethodDVO>();
    for (SourceAnalysisDVO dvo : listStatement) {
        try {
            // 소스내에 존재하는 메소드명.. 접근지 정자 + static + void 등의 잡다한 정보가 담겨있다.
            String methodName = dvo.getMethodName();
            String methodDescription = newInstance.getMethodDescription(methodName);
            MethodDVO methodDVO = null;
            methodDVO = AbstractJavaProgramSpecFile.toMethodDVO(methodName);
            methodDVO.setDescription(methodDescription);
            methodDVOList.add(methodDVO);
        } catch (ProgramSpecSourceException e) {
            e.printStackTrace();
        }
    }
    svo.setMethodDVOList(methodDVOList);
    return svo;
}
Also used : ImportsDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ImportsDVO) UserSourceMetaDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.UserSourceMetaDVO) ArrayList(java.util.ArrayList) ProgramSpecSVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO) ProgramSpecSourceException(com.kyj.fx.voeditor.visual.exceptions.ProgramSpecSourceException) MethodDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.MethodDVO) SourceAnalysisDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.SourceAnalysisDVO)

Example 3 with ProgramSpecSVO

use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO in project Gargoyle by callakrsos.

the class ProgramSpecUtil method doJsFile.

public static ProgramSpecSVO doJsFile(String projectName, String fileName, AbstractXframeProgramSpecFile newInstance) {
    ProgramSpecSVO svo = new ProgramSpecSVO();
    newInstance.setProjectName(projectName);
    svo.setFile(newInstance);
    String userName = System.getProperty("user.name");
    List<SourceAnalysisDVO> listStatement = newInstance.listStatement();
    UserSourceMetaDVO userSourceMetaDVO = new UserSourceMetaDVO();
    userSourceMetaDVO.setProjectName(projectName);
    userSourceMetaDVO.setSimpleFileName(fileName);
    userSourceMetaDVO.setRealFilePath(newInstance.getFullFileName());
    userSourceMetaDVO.setUserPcName(userName);
    userSourceMetaDVO.setPackages("");
    svo.setUserSourceMetaDVO(userSourceMetaDVO);
    /* 시작 import문 처리 */
    svo.setImportsDVO(new ImportsDVO());
    /* 끝 import문 처리 */
    // 테이블 데이터 바인드
    List<MethodDVO> methodDVOList = new ArrayList<MethodDVO>();
    for (SourceAnalysisDVO dvo : listStatement) {
        try {
            // 소스내에 존재하는 메소드명.. 접근지 정자 + static + void 등의 잡다한 정보가 담겨있다.
            String methodName = dvo.getMethodName();
            String methodDescription = newInstance.getMethodDescription(methodName);
            MethodDVO methodDVO = null;
            methodDVO = AbstractXframeProgramSpecFile.toMethodDVO(methodName);
            methodDVO.setDescription(methodDescription);
            methodDVOList.add(methodDVO);
        } catch (ProgramSpecSourceException e) {
            e.printStackTrace();
        }
    }
    svo.setMethodDVOList(methodDVOList);
    return svo;
}
Also used : ImportsDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ImportsDVO) UserSourceMetaDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.UserSourceMetaDVO) ArrayList(java.util.ArrayList) ProgramSpecSVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO) ProgramSpecSourceException(com.kyj.fx.voeditor.visual.exceptions.ProgramSpecSourceException) MethodDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.MethodDVO) SourceAnalysisDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.SourceAnalysisDVO)

Example 4 with ProgramSpecSVO

use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO in project Gargoyle by callakrsos.

the class ProgramSpecUtil method createDefault.

public static boolean createDefault(File sourceFile, File targetFile) {
    boolean result = false;
    try {
        IProgramSpecFile newInstance = ProgramSpecFileUtil.newInstance(sourceFile);
        ProgramSpecSVO svo = new ProgramSpecSVO();
        if (newInstance instanceof AbstractJavaProgramSpecFile) {
            svo = doJavaFile("sampleJavaProject", sourceFile.getName(), (AbstractJavaProgramSpecFile) newInstance);
        } else if (newInstance instanceof AbstractXframeProgramSpecFile) {
            svo = doJsFile("sampleXframeProject", sourceFile.getName(), (AbstractXframeProgramSpecFile) newInstance);
        }
        IProgramSpecFile abPFile = svo.getFile();
        // 확장자까지 포함된 파일명
        String simpleFileName = svo.getUserSourceMetaDVO().getSimpleFileName();
        // 확장자를 제거하고 워드문서가 생성될 파일명 작성
        String fileName = "(" + abPFile.getSourceFileType().toString() + ")(사양서)" + simpleFileName.substring(0, simpleFileName.indexOf('.')) + ".docx";
        // 풀 경로 설정.( 유저의 데스크탑에 저장됨.)
        String docFile = "";
        if (targetFile == null)
            docFile = System.getProperty("user.home") + File.separator + "Desktop" + File.separator + fileName;
        else
            docFile = targetFile.getAbsolutePath();
        ProgramSpecWordTemplate word = new ProgramSpecWordTemplate(docFile, svo);
        word.write();
        word.close();
        LOGGER.debug("사양서 생성 완료.[ " + sourceFile + " ]");
        result = true;
    } catch (Exception e1) {
        e1.printStackTrace();
    }
    return result;
}
Also used : AbstractXframeProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractXframeProgramSpecFile) ProgramSpecWordTemplate(com.kyj.fx.voeditor.visual.words.spec.auto.msword.template.ProgramSpecWordTemplate) ProgramSpecSVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO) IProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.IProgramSpecFile) AbstractJavaProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractJavaProgramSpecFile) ProgramSpecSourceException(com.kyj.fx.voeditor.visual.exceptions.ProgramSpecSourceException)

Example 5 with ProgramSpecSVO

use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO in project Gargoyle by callakrsos.

the class ProgramSpecFileUtilTest method simpleWrite.

/**
	 * 프로그램 사양서 정의대로 비즈니스에 맞게 변환
	 *
	 * @param file
	 * @return
	 * @throws Exception
	 */
@Test
public void simpleWrite() throws Exception {
    String filePath = "ProgramSpecFileUtilTest.java";
    File file = new File(filePath);
    IProgramSpecFile newInstance = ProgramSpecFileUtil.newInstance(file);
    ProgramSpecSVO svo = new ProgramSpecSVO();
    if (newInstance instanceof AbstractJavaProgramSpecFile) {
        svo = ProgramSpecUtil.doJavaFile("sampleJavaProject", file.getName(), (AbstractJavaProgramSpecFile) newInstance);
    } else if (newInstance instanceof AbstractXframeProgramSpecFile) {
        svo = ProgramSpecUtil.doJsFile("sampleXframeProject", file.getName(), (AbstractXframeProgramSpecFile) newInstance);
    }
    //		InspectorSourceMeta meta = newInstance.getInspectorSourceMeta();
    //		List<SourceAnalysisDVO> methodList = InspectorBiz.getInstance().methodList(meta);
    //		methodList.forEach(method -> {
    //			String methodName = method.getMethodName();
    //			System.out.println(methodName);
    //			System.out.println(method.getStartLine());
    //			System.out.println(method.getEndLine());
    //		});
    //		System.out.println(meta.listBlock());
    // System.out.println(meta.getSourceCodeList());
    //		svo.getMethodDVOList().forEach(method -> {
    //
    //			MethodMetaDVO methodMetaDVO = method.getMethodMetaDVO();
    //			System.out.println(method.getMethodName());
    //
    //			System.out.println(method.getDescription());
    //
    //			System.out.println(method.getMainFunction());
    //		});
    IProgramSpecFile abPFile = svo.getFile();
    // 확장자까지 포함된 파일명
    String simpleFileName = svo.getUserSourceMetaDVO().getSimpleFileName();
    // 확장자를 제거하고 워드문서가 생성될 파일명 작성
    String fileName = "(" + abPFile.getSourceFileType().toString() + ")(사양서)" + simpleFileName.substring(0, simpleFileName.indexOf('.')) + ".docx";
    // 풀 경로 설정.( 유저의 데스크탑에 저장됨.)
    String docFile = System.getProperty("user.home") + File.separator + "Desktop" + File.separator + fileName;
    try {
        ProgramSpecWordTemplate word = new ProgramSpecWordTemplate(docFile, svo);
        word.write();
        word.close();
        System.out.println("사양서 생성 완료.[ " + file + " ]");
    } catch (IOException e1) {
        throw e1;
    }
}
Also used : AbstractXframeProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractXframeProgramSpecFile) ProgramSpecWordTemplate(com.kyj.fx.voeditor.visual.words.spec.auto.msword.template.ProgramSpecWordTemplate) ProgramSpecSVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO) IOException(java.io.IOException) IProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.IProgramSpecFile) AbstractJavaProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractJavaProgramSpecFile) AbstractJavaProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractJavaProgramSpecFile) File(java.io.File) IProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.IProgramSpecFile) AbstractXframeProgramSpecFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractXframeProgramSpecFile) Test(org.junit.Test)

Aggregations

ProgramSpecSVO (com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO)5 ProgramSpecSourceException (com.kyj.fx.voeditor.visual.exceptions.ProgramSpecSourceException)3 AbstractJavaProgramSpecFile (com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractJavaProgramSpecFile)2 AbstractXframeProgramSpecFile (com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractXframeProgramSpecFile)2 IProgramSpecFile (com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.IProgramSpecFile)2 ProgramSpecWordTemplate (com.kyj.fx.voeditor.visual.words.spec.auto.msword.template.ProgramSpecWordTemplate)2 ImportsDVO (com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ImportsDVO)2 MethodDVO (com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.MethodDVO)2 SourceAnalysisDVO (com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.SourceAnalysisDVO)2 UserSourceMetaDVO (com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.UserSourceMetaDVO)2 ArrayList (java.util.ArrayList)2 File (java.io.File)1 IOException (java.io.IOException)1 Tab (javafx.scene.control.Tab)1 Test (org.junit.Test)1