Project

General

Profile

« Previous | Next » 

Revision 9168

Added by Jing Tao over 9 years ago

Fixed a bug that put the detail code in a wrong position.

View differences:

src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
1588 1588
	private void checkModifiedImmutableFields(SystemMetadata orgMeta, SystemMetadata newMeta) throws InvalidRequest, InvalidSystemMetadata{
1589 1589
	    if(orgMeta != null && newMeta != null) {
1590 1590
	        if(newMeta.getIdentifier() == null) {
1591
	            throw new InvalidSystemMetadata("The new version of the system metadata is invalid since the identifier is null","4956");
1591
	            throw new InvalidSystemMetadata("4956", "The new version of the system metadata is invalid since the identifier is null");
1592 1592
	        }
1593 1593
	        if(!orgMeta.getIdentifier().equals(newMeta.getIdentifier())) {
1594
	            throw new InvalidRequest("The request is trying to modify an immutable field in the SystemMeta: the new system meta's identifier "+newMeta.getIdentifier().getValue()+" is "+
1595
	                  "different to the orginal one "+orgMeta.getIdentifier().getValue(), "4869");
1594
	            throw new InvalidRequest("4869","The request is trying to modify an immutable field in the SystemMeta: the new system meta's identifier "+newMeta.getIdentifier().getValue()+" is "+
1595
	                  "different to the orginal one "+orgMeta.getIdentifier().getValue());
1596 1596
	        }
1597 1597
	        if(newMeta.getSize() == null) {
1598
	            throw new InvalidSystemMetadata("The new version of the system metadata is invalid since the size is null","4956");
1598
	            throw new InvalidSystemMetadata("4956", "The new version of the system metadata is invalid since the size is null");
1599 1599
	        }
1600 1600
	        if(!orgMeta.getSize().equals(newMeta.getSize())) {
1601
	            throw new InvalidRequest("The request is trying to modify an immutable field in the SystemMeta: the new system meta's size "+newMeta.getSize().longValue()+" is "+
1602
	                      "different to the orginal one "+orgMeta.getSize().longValue(), "4869");
1601
	            throw new InvalidRequest("4869", "The request is trying to modify an immutable field in the SystemMeta: the new system meta's size "+newMeta.getSize().longValue()+" is "+
1602
	                      "different to the orginal one "+orgMeta.getSize().longValue());
1603 1603
	        }
1604 1604
	        if(newMeta.getChecksum()!= null && orgMeta.getChecksum() != null && !orgMeta.getChecksum().getValue().equals(newMeta.getChecksum().getValue())) {
1605 1605
	            logMetacat.error("The request is trying to modify an immutable field in the SystemMeta: the new system meta's checksum "+newMeta.getChecksum().getValue()+" is "+
1606 1606
                        "different to the orginal one "+orgMeta.getChecksum().getValue());
1607
	            throw new InvalidRequest("The request is trying to modify an immutable field in the SystemMeta: the new system meta's checksum "+newMeta.getChecksum().getValue()+" is "+
1608
                        "different to the orginal one "+orgMeta.getChecksum().getValue(), "4869");
1607
	            throw new InvalidRequest("4869", "The request is trying to modify an immutable field in the SystemMeta: the new system meta's checksum "+newMeta.getChecksum().getValue()+" is "+
1608
                        "different to the orginal one "+orgMeta.getChecksum().getValue());
1609 1609
	        }
1610 1610
	        if(orgMeta.getSubmitter() != null && newMeta.getSubmitter() != null && !orgMeta.getSubmitter().equals(newMeta.getSubmitter())) {
1611
	            throw new InvalidRequest("The request is trying to modify an immutable field in the SystemMeta: the new system meta's submitter "+newMeta.getSubmitter().getValue()+" is "+
1612
                        "different to the orginal one "+orgMeta.getSubmitter().getValue(), "4869");
1611
	            throw new InvalidRequest("4869", "The request is trying to modify an immutable field in the SystemMeta: the new system meta's submitter "+newMeta.getSubmitter().getValue()+" is "+
1612
                        "different to the orginal one "+orgMeta.getSubmitter().getValue());
1613 1613
	        }
1614 1614
	        
1615 1615
	        if(orgMeta.getDateUploaded() != null && newMeta.getDateUploaded() != null && !orgMeta.getDateUploaded().equals(newMeta.getDateUploaded())) {
1616
	            throw new InvalidRequest("The request is trying to modify an immutable field in the SystemMeta: the new system meta's date of uploaded "+newMeta.getDateUploaded()+" is "+
1617
                        "different to the orginal one "+orgMeta.getDateUploaded(), "4869");
1616
	            throw new InvalidRequest("4869", "The request is trying to modify an immutable field in the SystemMeta: the new system meta's date of uploaded "+newMeta.getDateUploaded()+" is "+
1617
                        "different to the orginal one "+orgMeta.getDateUploaded());
1618 1618
	        }
1619 1619
	        
1620 1620
	        if(orgMeta.getOriginMemberNode() != null && newMeta.getOriginMemberNode() != null && !orgMeta.getOriginMemberNode().equals(newMeta.getOriginMemberNode())) {
1621
	            throw new InvalidRequest("The request is trying to modify an immutable field in the SystemMeta: the new system meta's orginal member node  "+newMeta.getOriginMemberNode().getValue()+" is "+
1622
                        "different to the orginal one "+orgMeta.getOriginMemberNode().getValue(), "4869");
1621
	            throw new InvalidRequest("4869", "The request is trying to modify an immutable field in the SystemMeta: the new system meta's orginal member node  "+newMeta.getOriginMemberNode().getValue()+" is "+
1622
                        "different to the orginal one "+orgMeta.getOriginMemberNode().getValue());
1623 1623
	        }
1624 1624
	        
1625 1625
	        if(orgMeta.getSeriesId() != null && newMeta.getSeriesId() != null && !orgMeta.getSeriesId().equals(newMeta.getSeriesId())) {
1626
                throw new InvalidRequest("The request is trying to modify an immutable field in the SystemMeta: the new system meta's series id  "+newMeta.getSeriesId().getValue()+" is "+
1627
                        "different to the orginal one "+orgMeta.getSeriesId().getValue(), "4869");
1626
                throw new InvalidRequest("4869", "The request is trying to modify an immutable field in the SystemMeta: the new system meta's series id  "+newMeta.getSeriesId().getValue()+" is "+
1627
                        "different to the orginal one "+orgMeta.getSeriesId().getValue());
1628 1628
            }
1629 1629
	        
1630 1630
	    }

Also available in: Unified diff