Project

General

Profile

« Previous | Next » 

Revision 8200

only attempt to generate OREs for objects that we know not to have them already. https://projects.ecoinformatics.org/ecoinfo/issues/6061

View differences:

GenerateORE.java
87 87
            List<String> idList = null;
88 88
            
89 89
            idList = DBUtil.getAllDocidsByType(DocumentImpl.EML2_0_0NAMESPACE, true, serverLocation);
90
            filterOutExisting(idList);
90 91
            Collections.sort(idList);
91 92
            SystemMetadataFactory.generateSystemMetadata(idList, includeOre, downloadData);
92 93
            
93 94
            idList = DBUtil.getAllDocidsByType(DocumentImpl.EML2_0_1NAMESPACE, true, serverLocation);
95
            filterOutExisting(idList);
94 96
            Collections.sort(idList);
95 97
            SystemMetadataFactory.generateSystemMetadata(idList, includeOre, downloadData);
96 98
            
97 99
            idList = DBUtil.getAllDocidsByType(DocumentImpl.EML2_1_0NAMESPACE, true, serverLocation);
100
            filterOutExisting(idList);
98 101
            Collections.sort(idList);
99 102
            SystemMetadataFactory.generateSystemMetadata(idList, includeOre, downloadData);
100 103
            
101 104
            idList = DBUtil.getAllDocidsByType(DocumentImpl.EML2_1_1NAMESPACE, true, serverLocation);
105
            filterOutExisting(idList);
102 106
            Collections.sort(idList);
103 107
            SystemMetadataFactory.generateSystemMetadata(idList, includeOre, downloadData);
104 108
            
......
111 115
    	return success;
112 116
    }
113 117
    
118
    private List<String> filterOutExisting(List<String> idList) {
119
    	List<String> toRemove = new ArrayList<String>();
120
    	for (String id: idList) {
121
    		Identifier identifier = new Identifier();
122
    		identifier.setValue(id);
123
			boolean exists = SystemMetadataFactory.oreExistsFor(identifier);
124
			if (exists) {
125
				toRemove.add(id);
126
			}
127
    	}
128
    	for (String id: toRemove) {
129
    		idList.remove(id);
130
    	}
131
    	return idList;
132
    }
133
    
114 134
    public int getServerLocation() {
115 135
		return serverLocation;
116 136
	}

Also available in: Unified diff