Project

General

Profile

« Previous | Next » 

Revision 8579

sync pids of <distribution><online> data objects with CN when their access rules change in EML 2.0.* <additionalMetadata>

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
3604 3604
            if (ruleBase != null && ruleBase.equals(EML200)) {
3605 3605
                logMetacat.info("DocumentImpl.initalizeParser - Using eml 2.0.0 parser");
3606 3606
                chandler = new Eml200SAXHandler(dbconn, action, docid, rev,
3607
                        user, groups, pub, serverCode, createDate, updateDate, writeAccessRules);
3607
                        user, groups, pub, serverCode, createDate, updateDate, writeAccessRules, guidsToSync);
3608 3608
                chandler.setIsRevisionDoc(isRevision);
3609 3609
                chandler.setEncoding(encoding);
3610 3610
                parser.setContentHandler((ContentHandler) chandler);
src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java
136 136
    // we find an 'access' element inside an 'additionalMetadata' element.  Set back
137 137
    // to false in endElement
138 138
    private boolean processOtherAccess = false;
139
    
140
    private Vector<String> guidsToSync;
139 141

  
140 142
    // if we are inside an 'access' element, we use this object to hold the 
141 143
    // current access info
......
331 333
     */
332 334
    public Eml200SAXHandler(DBConnection conn, String action, String docid,
333 335
            String revision, String user, String[] groups, String pub,
334
            int serverCode, Date createDate, Date updateDate, boolean writeAccessRules) throws SAXException
336
            int serverCode, Date createDate, Date updateDate, boolean writeAccessRules, Vector<String> guidsToSync) throws SAXException
335 337
    {
336 338
        super(conn, action, docid, revision, user, groups, pub, 
337 339
                serverCode, createDate, updateDate, writeAccessRules);
340
		this.guidsToSync = guidsToSync;
338 341
        // Get the unchangable subtrees (user doesn't have write permission)
339 342
        try
340 343
        {
......
1940 1943
   }
1941 1944

  
1942 1945

  
1943
  /* The method to write top level access rule into db. The old rules will be
1946
  /* The method to write additional access rule into db. The old rules will be
1944 1947
   * deleted
1945 1948
   * If no describedId in the access object, this access rules will be ingorned
1946 1949
   */
......
1997 2000
                                   "xml_access table for"+ inlineFileName);
1998 2001
             writeGivenAccessRuleIntoDB(permOrder, accessRule,
1999 2002
                                        inlineFileName, subreeid);
2003
             // Save guid of data object for syncing of access policy with CN after parsing
2004
             // is successful (see DocumentImpl.write)
2005
             guidsToSync.add(inlineFileName);
2000 2006
           }
2001 2007
           else if (onlineURLDistributionIdList.containsKey(subreeid))
2002 2008
           {
......
2017 2023
                                          dataFileName, null);
2018 2024
               logMetacat.info("Write online data access into " +
2019 2025
                                   "xml_access table for " + dataFileName);
2026
               // Save guid of data object for syncing of access policy with CN after parsing
2027
               // is successful (see DocumentImpl.write)
2028
               guidsToSync.add(dataFileName);
2020 2029
               // put the id into a hashtalbe. So when we run wirtetop level
2021 2030
               // access, those id will be ignored because they already has
2022 2031
               // additional access rules

Also available in: Unified diff