com.infomaximum.platform.querypool.RemovableResourceImpl 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 RemovableResourceImpl extends EditableResourceImpl implements RemovableResource {
RemovableResourceImpl(Class tClass) {
super(tClass);
}
@Override
public void remove(T obj, QueryTransaction transaction) throws PlatformException {
try {
transaction.getDBTransaction().remove(obj);
} catch (DatabaseException e) {
throw GeneralExceptionBuilder.buildDatabaseException(e);
}
}
@Override
public void clear(QueryTransaction transaction) throws PlatformException {
try {
transaction.getDBTransaction().removeAll(getDomainClass());
} catch (DatabaseException e) {
throw GeneralExceptionBuilder.buildDatabaseException(e);
}
}
}