Project

General

Profile

« Previous | Next » 

Revision 742

Added by bojilova almost 23 years ago

fix in the return of the last revisionid on UPDATE instead of the previous one

View differences:

DocumentImpl.java
824 824
                              boolean validate)
825 825
                throws Exception
826 826
  {
827
    String rev = "1";
827
    int rev = 1;
828 828
    String docid = null;
829 829
    MetaCatUtil util = new MetaCatUtil();
830 830
    String sep = util.getOption("accNumSeparator");
......
836 836
      // but show the whole accnum to the client.
837 837
      DocumentIdentifier id = new DocumentIdentifier(accnum);
838 838
      docid = id.getIdentifier();
839
      rev = id.getRev();
839
      rev = (new Integer(id.getRev())).intValue();
840 840
      sep = id.getSeparator();
841 841
    }
842 842
    
843 843
    // Determine if the docid,rev are OK for INSERT or UPDATE
844 844
    // Generate new docid on INSERT, if one is not provided.
845 845
    AccessionNumber ac = new AccessionNumber(conn);
846
    docid = ac.generate(docid, rev, action); 
846
    docid = ac.generate(docid, java.lang.String.valueOf(rev), action); 
847 847
    
848 848
    MetaCatUtil.debugMessage("action: " + action + " servercode: " + 
849 849
                             serverCode + " override: " + override);
......
859 859
      // NOT NEEDED
860 860
      //DocumentImpl newdoc = new DocumentImpl(conn, docid);
861 861
      //updaterev = newdoc.getRev();
862
      String updaterev = rev;
862
      //String updaterev = rev;
863 863
      String server = MetacatReplication.getServer(serverCode);
864 864
      MetacatReplication.replLog("attempting to lock " + accnum);
865 865
      URL u = new URL("http://" + server + "?action=getlock&updaterev=" + 
866
                      updaterev + "&docid=" + docid);
866
                      rev + "&docid=" + docid);
867 867
      System.out.println("sending message: " + u.toString());
868 868
      String serverResStr = MetacatReplication.getURLContent(u);
869 869
      String openingtag = serverResStr.substring(0, serverResStr.indexOf(">")+1);
......
892 892
        //to come get a copy from here.
893 893
        ForceReplicationHandler frh = new ForceReplicationHandler(docid);
894 894
        
895
        rev++;
895 896
        return (docid + sep + rev);
896 897
      }
897 898

  
......
926 927
        throw new Exception("User " + user + 
927 928
              " does not have permission to update XML Document #" + accnum);
928 929
      }          
930
      rev++;
929 931
    }
930 932

  
931 933
    try 

Also available in: Unified diff