Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: A Class that implements utility methods for a metadata catalog
4
 *  Copyright: 2009 Regents of the University of California and the
5
 *             National Center for Ecological Analysis and Synthesis
6
 *    Authors: Michael Daigle
7
 *
8
 *   '$Author: daigle $'
9
 *     '$Date: 2009-08-04 14:32:58 -0700 (Tue, 04 Aug 2009) $'
10
 * '$Revision: 5015 $'
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
 */
26

    
27
package edu.ucsb.nceas.metacat.util;
28

    
29
/**
30
 * A suite of utility classes for the system metadata replication functions
31
 * @deprecated
32
 */
33
public class ReplicationUtil {
34
	  
35
    public static String startTag = "<systemMetadata>";
36
    public static String endTag = "</systemMetadata>";
37
    
38
    /**
39
     * return the contents between start and end tag
40
     */
41
    public static String getSystemMetadataContent(String docInfoStr) {
42
    	// get the system metadata portion
43
        String systemMetadataXML = null;
44
        if (docInfoStr.indexOf(startTag) > -1) {
45
      	  systemMetadataXML = docInfoStr.substring(docInfoStr.indexOf(startTag) + startTag.length(), docInfoStr.lastIndexOf(endTag));
46
        }
47
        return systemMetadataXML;
48
    }
49
    
50
    /**
51
     * return the string WITHOUT the contents between start and end tag
52
     */
53
    public static String getContentWithoutSystemMetadata(String docInfoStr) {
54
    	// strip out the system metadata portion
55
        if (docInfoStr.indexOf(startTag) > -1) {      	  
56
      	  docInfoStr = docInfoStr.substring(0, docInfoStr.indexOf(startTag)) + docInfoStr.substring(docInfoStr.indexOf(endTag) + endTag.length());
57
        }
58
        return docInfoStr;
59
    }
60

    
61

    
62
}
(11-11/16)