SCViewer/plugins/com.minres.scviewer.databas.../src/com/minres/scviewer/database/sqlite/TxAttribute.java

60 lines
1.6 KiB
Java
Raw Normal View History

/*******************************************************************************
2021-01-09 14:26:49 +01:00
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* 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:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.sqlite;
import com.minres.scviewer.database.AssociationType;
import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
2020-11-28 14:47:43 +01:00
import com.minres.scviewer.database.tx.ITxAttribute;
2015-01-06 17:14:16 +01:00
public class TxAttribute implements ITxAttribute{
2015-01-06 17:14:16 +01:00
Tx trTransaction;
ScvTxAttribute scvAttribute;
2015-01-06 17:14:16 +01:00
public TxAttribute(Tx trTransaction, ScvTxAttribute scvAttribute) {
this.trTransaction=trTransaction;
this.scvAttribute=scvAttribute;
}
@Override
public String getName() {
return scvAttribute.getName();
}
@Override
public DataType getDataType() {
2023-02-24 07:59:17 +01:00
int dt = scvAttribute.getData_type();
switch(dt) {
case 12:
return DataType.STRING;
case 10:
return DataType.POINTER;
default:
if(dt<9)
return DataType.values()[dt];
else
return DataType.NONE;
}
}
@Override
public AssociationType getType() {
return AssociationType.values()[scvAttribute.getType()];
}
@Override
public Object getValue() {
return scvAttribute.getData_value();
}
}