Project

General

Profile

« Previous | Next » 

Revision 6766

include 'archived' system metadata element in backing DB store

View differences:

src/upgrade-db-to-2.0.0-oracle.sql
11 11
   submitter VARCHAR2(256), -- the user who originally submitted the doc
12 12
   object_format VARCHAR2(256), --the format of the object
13 13
   size VARCHAR2(256), --the size of the object
14
   archived boolean,	 -- specifies whether this an archived object
14 15
   replication_allowed boolean,	 -- replication allowed
15 16
   number_replicas NUMBER(8), 	-- the number of replicas allowed
16 17
   obsoletes   VARCHAR2(2000),    -- the identifier of the record that this replaces
src/xmltables-oracle.sql
414 414
   submitter VARCHAR2(256), -- the user who originally submitted the doc
415 415
   object_format VARCHAR2(256), --the format of the object
416 416
   size VARCHAR2(256), --the size of the object
417
   	archived boolean,	 -- specifies whether this an archived object
417 418
   replication_allowed boolean,	 -- replication allowed
418 419
   number_replicas NUMBER(8), 	-- the number of replicas allowed
419 420
   obsoletes   VARCHAR2(2000),    -- the identifier of the record that this replaces
src/upgrade-db-to-2.0.0-postgres.sql
11 11
	submitter VARCHAR(256), -- the user who originally submitted the doc
12 12
	object_format VARCHAR(256), --the format of the object
13 13
	size VARCHAR(256), --the size of the object
14
	archived boolean,	 -- specifies whether this an archived object
14 15
	replication_allowed boolean,	 -- replication allowed
15 16
	number_replicas INT8, 	-- the number of replicas allowed
16 17
	obsoletes   text,       -- the identifier that this record obsoletes
src/xmltables-postgres.sql
306 306
	submitter VARCHAR(256), -- the user who originally submitted the doc
307 307
	object_format VARCHAR(256), --the format of the object
308 308
	size VARCHAR(256), --the size of the object
309
	archived boolean,	 -- specifies whether this an archived object
309 310
	replication_allowed boolean,	 -- replication allowed
310 311
	number_replicas INT8, 	-- the number of replicas allowed
311 312
	obsoletes   text,       -- the identifier that this record obsoletes
src/edu/ucsb/nceas/metacat/IdentifierManager.java
982 982
    private void updateSystemMetadataFields(long dateUploaded, String rightsHolder,
983 983
            String checksum, String checksumAlgorithm, String originMemberNode,
984 984
            String authoritativeMemberNode, long modifiedDate, String submitter, 
985
            String guid, String objectFormat, BigInteger size, boolean replicationAllowed,
985
            String guid, String objectFormat, BigInteger size, boolean archived, boolean replicationAllowed,
986 986
            int numberReplicas, String obsoletes, String obsoletedBy, BigInteger serialVersion)
987 987
    {
988 988
        DBConnection dbConn = null;
......
998 998
            String query = "update " + TYPE_SYSTEM_METADATA + 
999 999
                " set (date_uploaded, rights_holder, checksum, checksum_algorithm, " +
1000 1000
                "origin_member_node, authoritive_member_node, date_modified, " +
1001
                "submitter, object_format, size, replication_allowed, number_replicas, " +
1001
                "submitter, object_format, size, archived, replication_allowed, number_replicas, " +
1002 1002
                "obsoletes, obsoleted_by, serial_version) " +
1003
                "= (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) where guid = ?";
1003
                "= (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) where guid = ?";
1004 1004
            PreparedStatement stmt = dbConn.prepareStatement(query);
1005 1005
            
1006 1006
            //data values
......
1014 1014
            stmt.setString(8, submitter);
1015 1015
            stmt.setString(9, objectFormat);
1016 1016
            stmt.setString(10, size.toString());
1017
            stmt.setBoolean(11, replicationAllowed);
1018
            stmt.setInt(12, numberReplicas);
1019
            stmt.setString(13, obsoletes);
1020
            stmt.setString(14, obsoletedBy);
1021
            stmt.setString(15, serialVersion.toString());
1017
            stmt.setBoolean(11, archived);
1018
            stmt.setBoolean(12, replicationAllowed);
1019
            stmt.setInt(13, numberReplicas);
1020
            stmt.setString(14, obsoletes);
1021
            stmt.setString(15, obsoletedBy);
1022
            stmt.setString(16, serialVersion.toString());
1022 1023

  
1023 1024
            //where clause
1024
            stmt.setString(16, guid);
1025
            stmt.setString(17, guid);
1025 1026
            logMetacat.debug("stmt: " + stmt.toString());
1026 1027
            //execute
1027 1028
            int rows = stmt.executeUpdate();
......
1029 1030
            stmt.close();
1030 1031
        } catch (SQLException e) {
1031 1032
            e.printStackTrace();
1032
            logMetacat.error("insertAdditionalSystemMetadataFields: SQL error while creating a mapping to the system metadata identifier: " 
1033
            logMetacat.error("updateSystemMetadataFields: SQL error while updating system metadata: " 
1033 1034
                    + e.getMessage());
1034 1035
        } catch (NumberFormatException e) {
1035 1036
            e.printStackTrace();
1036
            logMetacat.error("insertAdditionalSystemMetadataFields: NumberFormat error while creating a mapping to the system metadata identifier: " 
1037
            logMetacat.error("updateSystemMetadataFields: NumberFormat error while updating system metadata: " 
1037 1038
                    + e.getMessage());
1038 1039
        } finally {
1039 1040
            // Return database connection to the pool
......
1162 1163
				sm.getAuthoritativeMemberNode() == null ? null: sm.getAuthoritativeMemberNode().getValue(), 
1163 1164
				sm.getDateSysMetadataModified() == null ? null: sm.getDateSysMetadataModified().getTime(),
1164 1165
				sm.getSubmitter() == null ? null: sm.getSubmitter().getValue(), 
1165
        sm.getIdentifier().getValue(),
1166
        sm.getFormatId() == null ? null: sm.getFormatId().getValue(),
1167
        sm.getSize(),
1168
        replicationAllowed, 
1169
        numberReplicas,
1170
        sm.getObsoletes() == null ? null:sm.getObsoletes().getValue(),
1171
        sm.getObsoletedBy() == null ? null: sm.getObsoletedBy().getValue(),
1172
        sm.getSerialVersion()
1166
		        sm.getIdentifier().getValue(),
1167
		        sm.getFormatId() == null ? null: sm.getFormatId().getValue(),
1168
		        sm.getSize(),
1169
		        sm.getArchived() == null ? false: sm.getArchived(),
1170
		        replicationAllowed, 
1171
		        numberReplicas,
1172
		        sm.getObsoletes() == null ? null:sm.getObsoletes().getValue(),
1173
		        sm.getObsoletedBy() == null ? null: sm.getObsoletedBy().getValue(),
1174
		        sm.getSerialVersion()
1173 1175
        );
1174 1176
        
1175 1177
        String guid = sm.getIdentifier().getValue();

Also available in: Unified diff