Project

General

Profile

« Previous | Next » 

Revision 9050

Added by Jing Tao almost 10 years ago

Add the code to handle the sid in the delete and archive method.

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
242 242
        boolean allowed = false;
243 243
        allowed = isAdminAuthorized(session);
244 244
        
245
        String serviceFailureCode = "2902";
246
        Identifier sid = getPIDForSID(pid, serviceFailureCode);
247
        if(sid != null) {
248
            pid = sid;
249
        }
250
        
245 251
        //check if it is the authoritative member node
246 252
        if(!allowed) {
247 253
            allowed = isAuthoritativeMNodeAdmin(session, pid);
src/edu/ucsb/nceas/metacat/dataone/v1/MNodeService.java
130 130
	@Override
131 131
	public Identifier archive(Identifier pid) throws InvalidToken,
132 132
			ServiceFailure, NotAuthorized, NotFound, NotImplemented {
133
	    String serviceFailure = "2912";
134
        String notFound = "2911";
135
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
136
                "The object specified by "+pid.getValue()+" does not exist at this node.");
133 137
		return impl.archive(null, pid);
134 138
	}
135 139

  
......
138 142
	public Identifier archive(Session session, Identifier pid)
139 143
			throws InvalidToken, ServiceFailure, NotAuthorized, NotFound,
140 144
			NotImplemented {
145
	    String serviceFailure = "2912";
146
        String notFound = "2911";
147
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
148
                "The object specified by "+pid.getValue()+" does not exist at this node.");
141 149
		return impl.archive(session, pid);
142 150
	}
143 151

  
......
174 182
	@Override
175 183
	public Identifier delete(Identifier pid) throws InvalidToken,
176 184
			ServiceFailure, NotAuthorized, NotFound, NotImplemented {
185
	    String serviceFailure = "2902";
186
        String notFound = "2901";
187
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
188
                "The object specified by "+pid.getValue()+" does not exist at this node.");
177 189
		return impl.delete(null, pid);
178 190
	}
179 191

  
......
182 194
	public Identifier delete(Session session, Identifier pid)
183 195
			throws InvalidToken, ServiceFailure, NotAuthorized, NotFound,
184 196
			NotImplemented {
197
	    String serviceFailure = "2902";
198
        String notFound = "2901";
199
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
200
                "The object specified by "+pid.getValue()+" does not exist at this node.");
185 201
		return impl.delete(session, pid);
186 202
	}
187 203

  
src/edu/ucsb/nceas/metacat/dataone/v1/CNodeService.java
339 339
	@Override
340 340
	public Identifier archive(Identifier pid) throws InvalidToken,
341 341
			ServiceFailure, NotAuthorized, NotFound, NotImplemented {
342
	    String serviceFailure = "4972";
343
        String notFound = "4971";
344
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
345
                "The object specified by "+pid.getValue()+" does not exist at this node.");
342 346
		return impl.archive(null, pid);
343 347
	}
344 348

  
......
347 351
	public Identifier archive(Session session, Identifier pid)
348 352
			throws InvalidToken, ServiceFailure, InvalidRequest, NotAuthorized,
349 353
			NotFound, NotImplemented {
354
	    String serviceFailure = "4972";
355
        String notFound = "4971";
356
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
357
                "The object specified by "+pid.getValue()+" does not exist at this node.");
350 358
		return impl.archive(session, pid);
351 359
	}
352 360

  
......
384 392
	@Override
385 393
	public Identifier delete(Identifier pid) throws InvalidToken,
386 394
			ServiceFailure, NotAuthorized, NotFound, NotImplemented {
395
	    String serviceFailure = "4962";
396
        String notFound = "4961";
397
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
398
                "The object specified by "+pid.getValue()+" does not exist at this node.");
387 399
		return impl.delete(null, pid);
388 400
	}
389 401

  
......
392 404
	public Identifier delete(Session session, Identifier pid)
393 405
			throws InvalidToken, ServiceFailure, InvalidRequest, NotAuthorized,
394 406
			NotFound, NotImplemented {
407
	    String serviceFailure = "4962";
408
        String notFound = "4961";
409
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
410
                "The object specified by "+pid.getValue()+" does not exist at this node.");
395 411
		return impl.delete(session, pid);
396 412
	}
397 413

  
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
362 362
          throw new ServiceFailure("4960", "The provided identifier was invalid.");
363 363
          
364 364
      }
365
      
366
      String serviceFailureCode = "4962";
367
      Identifier sid = getPIDForSID(pid, serviceFailureCode);
368
      if(sid != null) {
369
          pid = sid;
370
      }
365 371

  
366 372
	  // check that it is CN/admin
367 373
	  boolean allowed = isAdminAuthorized(session);
......
524 530
	  // check that it is CN/admin
525 531
	  boolean allowed = isAdminAuthorized(session);
526 532
	  
533
	  String serviceFailureCode = "4972";
534
	  Identifier sid = getPIDForSID(pid, serviceFailureCode);
535
	  if(sid != null) {
536
	        pid = sid;
537
	  }
538
	  
527 539
	  //check if it is the authoritative member node
528 540
	  if(!allowed) {
529 541
	      allowed = isAuthoritativeMNodeAdmin(session, pid);
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
205 205
   */
206 206
  public Identifier delete(Session session, Identifier pid) 
207 207
      throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented {
208

  
208
      
209 209
      String localId = null;
210 210
      if (session == null) {
211 211
      	throw new InvalidToken("1330", "No session has been provided");
......
1651 1651
      if (pid == null || pid.getValue().trim().equals("")) {
1652 1652
          throw new ServiceFailure("1350", "The provided identifier was invalid.");
1653 1653
      }
1654
      
1655
      String serviceFailureCode = "1350";
1656
      Identifier sid = getPIDForSID(pid, serviceFailureCode);
1657
      if(sid != null) {
1658
          pid = sid;
1659
      }
1654 1660

  
1655 1661
      // check for the existing identifier
1656 1662
      try {

Also available in: Unified diff