1 package org.enhydra.shark.swingclient.workflowadmin.definition.actions; 2 3 4 5 import org.enhydra.shark.api.client.wfservice.*; 6 import java.awt.event.*; 7 import javax.swing.*; 8 import java.util.*; 9 10 import org.enhydra.jawe.JaWE; 11 import org.enhydra.shark.swingclient.*; 12 import org.enhydra.shark.swingclient.workflowadmin.*; 13 import org.enhydra.shark.swingclient.workflowadmin.definition.*; 14 15 21 public class LoadPackage extends ActionBase { 22 23 public LoadPackage(PackageManagement pdm) { 24 super(pdm); 25 } 26 27 public void actionPerformed(ActionEvent e) { 28 PackageManagement pdm=(PackageManagement)actionPanel; 29 SharkAdmin workflowAdmin=pdm.getWorkflowAdmin(); 30 31 Collection existingIds=JaWE.getInstance().getXMLInterface().getAllPackageIds(); 34 java.util.List allPackages=new ArrayList(); 35 try { 36 Map allPkgs=SharkAdmin.getRepositoryManager().getPackagePathToIdMapping(); 37 38 if (allPkgs!=null) { 39 for (Iterator i=allPkgs.entrySet().iterator(); i.hasNext();) { 40 Map.Entry me=(Map.Entry)i.next(); 41 if (!existingIds.contains(me.getValue().toString())) { 42 allPackages.add(new NameValueStringMap(me.getKey().toString(),me.getValue().toString())); 43 } 44 } 45 } 46 } catch (Exception ex) {} 47 48 SelectPackage spd=new SelectPackage (this,pdm.getWindow(),allPackages); 49 spd.showDialog(); 50 } 51 52 public void loadPackage (String packageName) { 53 PackageManagement pdm=(PackageManagement)actionPanel; 54 SplashScreen ss=pdm.getWorkflowAdmin().getSplashScreen(); 55 ss.show("WaitImage", 56 pdm.getWorkflowAdmin().getFullUserName(), 57 ResourceManager.getLanguageDependentString("MessagePleaseWait")); 58 String errMsg=null; 59 String xpdlReport=null; 60 try { 61 62 SharkAdmin.getPackageAmin().openPackage(packageName); 63 pdm.getWorkflowAdmin().refresh(true); 64 } catch (PackageInvalid ipe) { 65 errMsg=ResourceManager.getLanguageDependentString("ErrorThePackageIsInvalid"); 66 xpdlReport=ipe.getXPDLValidationErrors(); 67 } catch (ExternalPackageInvalid iepe) { 68 errMsg=ResourceManager.getLanguageDependentString("ErrorTheOneOfTheExternalPackagesIsInvalid"); 69 } catch (Exception ex) { 70 errMsg=ResourceManager.getLanguageDependentString("ErrorThePackageCannotBeLoadedAtTheMoment"); 71 } 73 ss.hide(); 74 if (errMsg!=null) { 75 JOptionPane.showMessageDialog(pdm.getWindow(),errMsg, 76 SharkAdmin.getAppTitle(),JOptionPane.ERROR_MESSAGE); 77 pdm.getWorkflowAdmin().showXPDLErrorsReport(xpdlReport); 78 } 79 80 } 81 82 } 83 | Popular Tags |