/** * @param dataAttributeId The ID of the Data Attribute belonging to this instance. * @param dataObjectInstanceId The ID of the Data Object Instance belonging to this instance. * @param dataObjectInstance The Data Object Instance belonging to this instance. */ public DataAttributeInstance( int dataAttributeId, int dataObjectInstanceId, DataObjectInstance dataObjectInstance) { this.dataAttributeId = dataAttributeId; this.dataObjectInstanceId = dataObjectInstanceId; this.dataObjectInstance = dataObjectInstance; this.type = dbDataAttributeInstance.getType(dataAttributeId); if (dbDataAttributeInstance.existDataAttributeInstance(dataAttributeId, dataObjectInstanceId)) { // creates an existing Attribute Instance using the database information this.dataAttributeInstanceId = dbDataAttributeInstance.getDataAttributeInstanceID(dataAttributeId, dataObjectInstanceId); } else { // creates a new Attribute Instance also in database this.dataAttributeInstanceId = dbDataAttributeInstance.createNewDataAttributeInstance( dataAttributeId, dataObjectInstanceId); } this.value = dbDataAttributeInstance.getValue(dataAttributeInstanceId); this.name = dbDataAttributeInstance.getName(dataAttributeId); }
/** * Sets the value of the data attribute instance. It get also written in the database. * * @param value to set. */ public void setValue(Object value) { this.value = value; dbDataAttributeInstance.setValue(dataAttributeInstanceId, value); }