2012-06-17 20:34:50 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2012 IT Just working.
|
|
|
|
* 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:
|
|
|
|
* IT Just working - initial API and implementation
|
|
|
|
*******************************************************************************/
|
2015-01-03 16:34:32 +01:00
|
|
|
package com.minres.scviewer.database.text
|
2012-06-17 19:53:05 +02:00
|
|
|
|
2015-01-03 16:34:32 +01:00
|
|
|
import com.minres.scviewer.database.AssociationType;
|
|
|
|
import com.minres.scviewer.database.DataType;
|
2015-01-06 17:14:16 +01:00
|
|
|
import com.minres.scviewer.database.ITxAttributeType;
|
|
|
|
import com.minres.scviewer.database.ITxAttribute
|
2012-06-17 19:53:05 +02:00
|
|
|
|
2015-01-06 17:14:16 +01:00
|
|
|
class TxAttribute implements ITxAttribute{
|
2012-06-17 19:53:05 +02:00
|
|
|
|
2015-01-06 17:14:16 +01:00
|
|
|
TxAttributeType attributeType
|
2015-01-01 23:17:32 +01:00
|
|
|
|
2012-06-17 19:53:05 +02:00
|
|
|
def value
|
|
|
|
|
2015-01-06 17:14:16 +01:00
|
|
|
TxAttribute(String name, DataType dataType, AssociationType type, value){
|
|
|
|
attributeType = TxAttributeTypeFactory.instance.getAttrType(name, dataType, type)
|
2015-01-01 23:17:32 +01:00
|
|
|
switch(dataType){
|
2015-01-03 16:34:32 +01:00
|
|
|
case DataType.STRING:
|
|
|
|
case DataType.ENUMERATION:
|
2012-06-17 19:53:05 +02:00
|
|
|
this.value=value[1..-2]
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
this.value=value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-06 17:14:16 +01:00
|
|
|
TxAttribute(TxAttributeType other){
|
2012-06-17 19:53:05 +02:00
|
|
|
attributeType=other
|
|
|
|
}
|
|
|
|
|
2015-01-06 17:14:16 +01:00
|
|
|
TxAttribute(TxAttributeType other, value){
|
2015-01-01 23:17:32 +01:00
|
|
|
this(other.name, other.dataType, other.type, value)
|
2012-06-17 19:53:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getName() {
|
|
|
|
return attributeType.getName();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-01-03 16:34:32 +01:00
|
|
|
public AssociationType getType() {
|
|
|
|
attributeType.type;
|
2012-06-17 19:53:05 +02:00
|
|
|
}
|
|
|
|
|
2015-01-03 16:34:32 +01:00
|
|
|
@Override
|
|
|
|
public DataType getDataType() {
|
|
|
|
attributeType.dataType;
|
2015-01-01 23:17:32 +01:00
|
|
|
}
|
|
|
|
|
2012-06-17 19:53:05 +02:00
|
|
|
}
|