pi.closeTransaction(false);
pi.closeTransactionDontReset();
  private static final void publishOplan(      final MyPSPState myState,       final PrintStream out,      final String filename) {    // get direct delegate to PlanServer's Plugin    PluginDelegate pi = myState.sps.getDirectDelegate();    // parse the oplan file    Oplan oplan;    List oplanComponents;    try {      OplanFileReader ofr =        new OplanFileReader(            filename,            pi.getFactory(),            pi.getCluster());      oplan = ofr.readOplan();      if (oplan == null) {        throw new IllegalArgumentException(            "No such file \""+filename+"\" or incorrect XML format");      }      oplanComponents = new ArrayList();      oplanComponents.addAll(ofr.getForcePackages(oplan));      oplanComponents.addAll(ofr.getOrgActivities(oplan));      oplanComponents.addAll(ofr.getOrgRelations(oplan));      oplanComponents.addAll(ofr.getPolicies(oplan));      if (oplan.getEndDay() == null) {        oplan.inferEndDay(oplanComponents);      }    } catch (Exception e) {      out.print(          "<html><head><title>Unable to add Oplan</title></head>\n"+          "<body bgcolor=\"#F0F0F0\">\n"+          "<h3><font color=red>Unable to parse Oplan \"");      out.print(filename);      out.print("\"</font>"+          "</h3>\n<p>"+          "Either the file is unreachable or is in the incorrect XML format"+          "<p><b>Exception:</b><pre>\n");      e.printStackTrace(out);      out.print("</pre></body></html>");      out.flush();      return;    }    try {      pi.openTransaction();      // publish the Oplan      pi.publishAdd(oplan);      // publish the components      int nComp = oplanComponents.size();      for (int i = 0; i < nComp; i++) {        pi.publishAdd(oplanComponents.get(i));      }      // publish the Oplan coupon      OplanCoupon ow =         new OplanCoupon(            oplan.getUID(),             pi.getClusterIdentifier());      pi.getCluster().getUIDServer().registerUniqueObject(ow);      pi.publishAdd(ow);    } catch (Exception e) {      out.print(          "<html><head><title>Unable to add Oplan</title></head>\n"+          "<body  bgcolor=\"#F0F0F0\">\n"+          "<h1><font color=red>Unable to publish Oplan \"");      out.print(filename);      out.print("\"</font>"+          "</h1>\n<p><pre>");      e.printStackTrace(out);      out.print("</pre></body></html>");      out.flush();      return;    } finally {      pi.closeTransaction(false);    }    // success    out.print("<html><head><title>Oplan Added to \"");    out.print(myState.clusterID);    out.print(        "\"</title></head>\n"+        "<body  bgcolor=\"#F0F0F0\">\n"+        "<h3>Oplan \"");    out.print(filename);    out.print("\" <font color=darkgreen>Successfully</font> Published to \"");    out.print(myState.clusterID);    out.print("\"</h3>\n</body></html>");    out.flush();  }