Skip to main content
summaryrefslogtreecommitdiffstats
blob: 58549b750ccf3be17926c89dc5ee7a37075cc212 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*******************************************************************************
 * Copyright (c) 2009 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.orcs.db.internal.exchange.transform;

import java.util.Map;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.jdk.core.util.io.xml.AbstractSaxHandler;
import org.xml.sax.Attributes;

/**
 * @author Roberto E. Escobar
 */
public class V0_9_2TxDetailsHandler extends AbstractSaxHandler {
   private final Map<Integer, Integer> branchToBaseTx;

   public V0_9_2TxDetailsHandler(Map<Integer, Integer> branchToBaseTx) {
      this.branchToBaseTx = branchToBaseTx;
   }

   @Override
   public void endElementFound(String uri, String localName, String qName) {
      //
   }

   @Override
   public void startElementFound(String uri, String localName, String qName, Attributes attributes) {
      if (localName.equals("entry")) {
         int txType = Integer.parseInt(attributes.getValue("tx_type"));
         TransactionDetailsType detailsType = TransactionDetailsType.toEnum(txType);
         if (detailsType.isBaseline()) {
            Integer branchId = Integer.parseInt(attributes.getValue("branch_id"));
            Integer baseTransaction = Integer.parseInt(attributes.getValue("transaction_id"));
            branchToBaseTx.put(branchId, baseTransaction);
         }
      }
   }
}

Back to the top