Project

General

Profile

Revision 1480

Added by Jing Tao almost 18 years ago

Add code handle if put inline data into xml document or not.

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
727 727
  /**
728 728
   * Print a string representation of the XML document
729 729
   */
730
  public String toString(String user, String[] groups)
730
  public String toString(String user, String[] groups, boolean withInlinedata)
731 731
  {
732 732
    StringWriter docwriter = new StringWriter();
733 733
    try 
734 734
    {
735
      this.toXml(docwriter, user, groups);
735
      this.toXml(docwriter, user, groups, withInlinedata);
736 736
    } 
737 737
    catch (McdbException mcdbe) 
738 738
    {
......
750 750
    StringWriter docwriter = new StringWriter();
751 751
    String userName = null;
752 752
    String[] groupNames = null;
753
    boolean withInlineData = false;
753 754
    try 
754 755
    {
755
      this.toXml(docwriter, userName, groupNames);
756
      this.toXml(docwriter, userName, groupNames, withInlineData);
756 757
    } 
757 758
    catch (McdbException mcdbe) 
758 759
    {
......
805 806
   *
806 807
   * @param pw the Writer to which we print the document
807 808
   */
808
  public void toXml(Writer pw, String user, String[] groups) 
809
  public void toXml(Writer pw, String user, String[] groups, boolean withInLineData) 
809 810
                                                          throws McdbException
810 811
  {
811 812
    // flag for process  eml2
......
958 959
        if (previousNodeWasElement) {
959 960
          out.print(">");
960 961
        }
961
        if (!prcocessInlineData)
962
        if (!prcocessInlineData || !withInLineData)
962 963
        {
963
          // if it is not inline data just out put data
964
          // if it is not inline data just out put data or it is line data
965
          // but user don't want it, just put local id in inlinedata
964 966
          out.print(currentNode.nodedata);
965 967
        }
966 968
        else
967 969
        {
968
          // if it is inline data pull out from file system and output it
970
          // if it is inline data and user want to see it, pull out from 
971
          // file system and output it
969 972
          // for inline data, the data base only store the file name, so we
970 973
          // can combine the file name and inline data file path, to get it
971 974
          String fileName = currentNode.nodedata;
......
2738 2741
          if (useOldReadAlgorithm) {
2739 2742
            System.out.println(xmldoc.readUsingSlowAlgorithm());
2740 2743
          } else {
2741
            xmldoc.toXml(new PrintWriter(System.out), null, null);
2744
            xmldoc.toXml(new PrintWriter(System.out), null, null, true);
2742 2745
          }
2743 2746
      } else if (action.equals("DELETE")) {
2744 2747
        DocumentImpl.delete(docid, null, null);

Also available in: Unified diff