Project

General

Profile

« Previous | Next » 

Revision 8840

When indexing annotations from RDFs, use the doc id to access the system metadata, not the model name since they are not always the same.

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/annotation/RdfXmlSubprocessor.java
130 130
		
131 131
    	// read the annotation
132 132
		InputStream source = toInputStream(rdfXmlDocument);
133
    	String name = indexDocument.getIdentifier();
134
    	
133
    	String indexDocId = indexDocument.getIdentifier();
134
    	String name = indexDocId;
135
    			
135 136
    	//Check if the identifier is a valid URI and if not, make it one by prepending "http://"
136
    	URI nameURI = new URI(name);
137
    	URI nameURI = new URI(indexDocId);
137 138
    	String scheme = nameURI.getScheme();
138 139
    	if((scheme == null) || (scheme.isEmpty())){
139
    		name = "http://" + name;
140
    		name = "http://" + indexDocId;
140 141
    	}
141 142
    	
142 143
    	boolean loaded = dataset.containsNamedModel(name);
......
170 171
						// check if anyone with permissions on the annotation document has write permission on the document we are annotating
171 172
						boolean statementAuthorized = false;
172 173
						try {
173
							HashMap<Subject, Set<Permission>> annotationPermissionMap = AccessUtil.getPermissionMap(DistributedMapsFactory.getSystemMetadata(name).getAccessPolicy());
174
							annotationPermissionMap.put(DistributedMapsFactory.getSystemMetadata(name).getRightsHolder(), new HashSet<Permission>(Arrays.asList(Permission.CHANGE_PERMISSION)));
174
							HashMap<Subject, Set<Permission>> annotationPermissionMap = AccessUtil.getPermissionMap(DistributedMapsFactory.getSystemMetadata(indexDocId).getAccessPolicy());
175
							annotationPermissionMap.put(DistributedMapsFactory.getSystemMetadata(indexDocId).getRightsHolder(), new HashSet<Permission>(Arrays.asList(Permission.CHANGE_PERMISSION)));
175 176
							statementAuthorized = AuthUtils.isAuthorized(annotationPermissionMap.keySet(), Permission.WRITE, DistributedMapsFactory.getSystemMetadata(id));
176 177
						} catch (Exception e) {
177 178
							log.warn("Could not check for assertion permission on original pid: " + id, e);
metacat-index/src/main/resources/index-processor-context.xml
27 27
    <import resource="application-context-resource-map.xml" />
28 28
    <import resource="application-context-systemmeta100.xml" />
29 29
    
30
    <!--  
30
     
31 31
    <import resource="application-context-oa.xml" />
32
    -->
33 32
    
33
    
34 34
    <!-- <import resource="application-context-ao.xml" /> -->
35 35
    
36 36

  
......
100 100
       <ref bean="fgdcEsri80Subprocessor" />
101 101
       <ref bean="dryad30Subprocessor" />
102 102
       <ref bean="dryad31Subprocessor" />
103
       <!--  
104 103
       <ref bean="rdfXmlSubprocessor" />
105
       -->
106 104
      </list>
107 105
     </property>
108 106
    </bean>

Also available in: Unified diff