1 19 package org.openharmonise.him.editors; 20 21 import org.openharmonise.him.harmonise.*; 22 import org.openharmonise.vfs.*; 23 import org.openharmonise.vfs.metadata.*; 24 import org.openharmonise.vfs.status.*; 25 import org.openharmonise.workfloweditor.model.*; 26 import org.openharmonise.workfloweditor.vfs.*; 27 28 29 36 public class WorkflowEditor implements Editor { 37 38 private boolean m_bResourceCreated = false; 39 40 43 public WorkflowEditor() { 44 super(); 45 } 46 47 50 public PathStatusWrapper open(String sPath, AbstractVirtualFileSystem vfs) { 51 52 if(sPath.startsWith(HarmonisePaths.PATH_WORKFLOW_STAGES) == false) { 53 VirtualFile vfFile = vfs.getVirtualFile(sPath).getResource(); 54 String sTitle = vfs.getVirtualFileSystemView().getDisplayName(vfFile); 55 Property prop = PropertyCache.getInstance().getPropertyByPath(sPath); 56 57 org.openharmonise.workfloweditor.WorkflowEditor editor = new org.openharmonise.workfloweditor.WorkflowEditor(); 58 WorkflowModel model = new VFSWorkflowModel(sTitle, prop); 59 editor.setModel(model); 60 } 61 62 return new PathStatusWrapper(null, new VFSStatus()); 63 } 64 65 68 public PathStatusWrapper createNew(String sPath, AbstractVirtualFileSystem vfs) { 69 ResourceStatusWrapper statusWrapper = new ResourceStatusWrapper(null, new VFSStatus()); 70 71 try { 72 VirtualFile vfFile = new VirtualFile(sPath); 73 vfFile.setContent(null); 74 75 statusWrapper = vfs.addVirtualFile(sPath, vfFile); 76 77 if(statusWrapper.getStatus().isOK()) { 78 this.m_bResourceCreated = true; 79 } 80 } catch(Exception e) { 81 e.printStackTrace(); 82 } 83 return new PathStatusWrapper(null, statusWrapper.getStatus()); 84 } 85 86 89 public PathStatusWrapper createNew( 90 String sPath, 91 byte[] content, 92 AbstractVirtualFileSystem vfs) { 93 ResourceStatusWrapper statusWrapper = new ResourceStatusWrapper(null, new VFSStatus()); 94 95 try { 96 VirtualFile vfFile = new VirtualFile(sPath); 97 vfFile.setContent(content); 98 99 statusWrapper = vfs.addVirtualFile(sPath, vfFile); 100 101 if(statusWrapper.getStatus().isOK()) { 102 this.m_bResourceCreated = true; 103 } 104 } catch(Exception e) { 105 e.printStackTrace(); 106 } 107 108 return new PathStatusWrapper(null, statusWrapper.getStatus()); 109 } 110 111 114 public StatusData discardChanges(String sPath, AbstractVirtualFileSystem vfs) { 115 return new VFSStatus(); 116 } 117 118 121 public StatusData export(String sPath, AbstractVirtualFileSystem vfs) { 122 return new VFSStatus(); 123 } 124 125 128 public boolean hasResourceBeenCreated() { 129 return this.m_bResourceCreated; 130 } 131 132 135 public PathStatusWrapper preview(String sPath, AbstractVirtualFileSystem vfs) { 136 return new PathStatusWrapper(null, new VFSStatus()); 137 } 138 139 142 public PathStatusWrapper upload(String path, AbstractVirtualFileSystem vfs) { 143 return new PathStatusWrapper(null, new VFSStatus()); 144 } 145 146 } 147 | Popular Tags |