com.infomaximum.platform.querypool.EditableResourceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform Show documentation
Show all versions of platform Show documentation
Library for creating a light platform
package com.infomaximum.platform.querypool;
import com.infomaximum.database.domainobject.DomainObject;
import com.infomaximum.database.domainobject.DomainObjectEditable;
import com.infomaximum.database.exception.DatabaseException;
import com.infomaximum.platform.exception.PlatformException;
import com.infomaximum.platform.sdk.exception.GeneralExceptionBuilder;
class EditableResourceImpl extends ReadableResourceImpl implements EditableResource {
EditableResourceImpl(Class tClass) {
super(tClass);
}
@Override
public T create(QueryTransaction transaction) throws PlatformException {
try {
return transaction.getDBTransaction().create(tClass);
} catch (DatabaseException e) {
throw GeneralExceptionBuilder.buildDatabaseException(e);
}
}
@Override
public void save(T newObj, QueryTransaction transaction) throws PlatformException {
try {
transaction.getDBTransaction().save(newObj);
} catch (DatabaseException e) {
throw GeneralExceptionBuilder.buildDatabaseException(e);
}
}
}