Search in sources :

Example 1 with AbstractXframeProgramSpecFile

use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractXframeProgramSpecFile 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 2 with AbstractXframeProgramSpecFile

use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.AbstractXframeProgramSpecFile 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

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 ProgramSpecSVO (com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.ProgramSpecSVO)2 ProgramSpecSourceException (com.kyj.fx.voeditor.visual.exceptions.ProgramSpecSourceException)1 File (java.io.File)1 IOException (java.io.IOException)1 Test (org.junit.Test)1