diff --git a/src/main/java/org/caosdb/server/database/BackendTransaction.java b/src/main/java/org/caosdb/server/database/BackendTransaction.java index 20ec5b71a7ae6f4dd908dc38145df1c41f035e8e..5bf978343d72272309d4f4ab0f039770419c87b8 100644 --- a/src/main/java/org/caosdb/server/database/BackendTransaction.java +++ b/src/main/java/org/caosdb/server/database/BackendTransaction.java @@ -59,7 +59,6 @@ import org.caosdb.server.database.backend.implementation.MySQL.MySQLRetrieveProp import org.caosdb.server.database.backend.implementation.MySQL.MySQLRetrieveQueryTemplateDefinition; import org.caosdb.server.database.backend.implementation.MySQL.MySQLRetrieveRole; import org.caosdb.server.database.backend.implementation.MySQL.MySQLRetrieveSparseEntity; -import org.caosdb.server.database.backend.implementation.MySQL.MySQLRetrieveTransactionHistory; import org.caosdb.server.database.backend.implementation.MySQL.MySQLRetrieveUser; import org.caosdb.server.database.backend.implementation.MySQL.MySQLRetrieveVersionHistory; import org.caosdb.server.database.backend.implementation.MySQL.MySQLRuleLoader; @@ -116,7 +115,6 @@ import org.caosdb.server.database.backend.interfaces.RetrievePropertiesImpl; import org.caosdb.server.database.backend.interfaces.RetrieveQueryTemplateDefinitionImpl; import org.caosdb.server.database.backend.interfaces.RetrieveRoleImpl; import org.caosdb.server.database.backend.interfaces.RetrieveSparseEntityImpl; -import org.caosdb.server.database.backend.interfaces.RetrieveTransactionHistoryImpl; import org.caosdb.server.database.backend.interfaces.RetrieveUserImpl; import org.caosdb.server.database.backend.interfaces.RetrieveVersionHistoryImpl; import org.caosdb.server.database.backend.interfaces.RuleLoaderImpl; @@ -177,7 +175,6 @@ public abstract class BackendTransaction implements Undoable { setImpl(RetrieveAllImpl.class, MySQLRetrieveAll.class); setImpl(RegisterSubDomainImpl.class, MySQLRegisterSubDomain.class); setImpl(RetrieveDatatypesImpl.class, MySQLRetrieveDatatypes.class); - setImpl(RetrieveTransactionHistoryImpl.class, MySQLRetrieveTransactionHistory.class); setImpl(RetrieveUserImpl.class, MySQLRetrieveUser.class); setImpl(RetrieveParentsImpl.class, MySQLRetrieveParents.class); setImpl(GetFileRecordByPathImpl.class, MySQLGetFileRecordByPath.class); diff --git a/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveTransactionHistory.java b/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveTransactionHistory.java deleted file mode 100644 index 3273f49aa85776c4fd323ed4c027f4d1fcd3fbb0..0000000000000000000000000000000000000000 --- a/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveTransactionHistory.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * ** header v3.0 - * This file is a part of the CaosDB Project. - * - * Copyright (C) 2018 Research Group Biomedical Physics, - * Max-Planck-Institute for Dynamics and Self-Organization Göttingen - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - * ** end header - */ -package org.caosdb.server.database.backend.implementation.MySQL; - -import static org.caosdb.server.database.DatabaseUtils.bytes2UTF8; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import org.caosdb.server.database.access.Access; -import org.caosdb.server.database.backend.interfaces.RetrieveTransactionHistoryImpl; -import org.caosdb.server.database.exceptions.TransactionException; -import org.caosdb.server.database.proto.ProtoTransactionLogMessage; - -public class MySQLRetrieveTransactionHistory extends MySQLTransaction - implements RetrieveTransactionHistoryImpl { - - public MySQLRetrieveTransactionHistory(final Access access) { - super(access); - } - - public static final String STMT_RETRIEVE_HISTORY = - "SELECT transaction, realm, username, seconds, nanos FROM transaction_log WHERE entity_id=? "; - - @Override - public ArrayList<ProtoTransactionLogMessage> execute(final Integer id) - throws TransactionException { - try { - final PreparedStatement stmt = prepareStatement(STMT_RETRIEVE_HISTORY); - - final ArrayList<ProtoTransactionLogMessage> ret = new ArrayList<ProtoTransactionLogMessage>(); - stmt.setInt(1, id); - final ResultSet rs = stmt.executeQuery(); - try { - while (rs.next()) { - final String transaction = bytes2UTF8(rs.getBytes("transaction")); - final String realm = bytes2UTF8(rs.getBytes("realm")); - final String username = bytes2UTF8(rs.getBytes("username")); - final Integer seconds = rs.getInt("seconds"); - final Integer nanos = rs.getInt("nanos"); - - ret.add(new ProtoTransactionLogMessage(transaction, realm, username, seconds, nanos)); - } - return ret; - } finally { - rs.close(); - } - } catch (final SQLException e) { - throw new TransactionException(e); - } catch (final ConnectionException e) { - throw new TransactionException(e); - } - } -} diff --git a/src/main/java/org/caosdb/server/database/backend/interfaces/RetrieveTransactionHistoryImpl.java b/src/main/java/org/caosdb/server/database/backend/interfaces/RetrieveTransactionHistoryImpl.java deleted file mode 100644 index b02e4d9347e572941ab31e3a1a371470e1d8ee5c..0000000000000000000000000000000000000000 --- a/src/main/java/org/caosdb/server/database/backend/interfaces/RetrieveTransactionHistoryImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * ** header v3.0 - * This file is a part of the CaosDB Project. - * - * Copyright (C) 2018 Research Group Biomedical Physics, - * Max-Planck-Institute for Dynamics and Self-Organization Göttingen - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - * ** end header - */ -package org.caosdb.server.database.backend.interfaces; - -import java.util.ArrayList; -import org.caosdb.server.database.exceptions.TransactionException; -import org.caosdb.server.database.proto.ProtoTransactionLogMessage; - -public interface RetrieveTransactionHistoryImpl extends BackendTransactionImpl { - - public ArrayList<ProtoTransactionLogMessage> execute(Integer id) throws TransactionException; -} diff --git a/src/main/java/org/caosdb/server/database/backend/transaction/RetrieveVersionHistory.java b/src/main/java/org/caosdb/server/database/backend/transaction/RetrieveVersionHistory.java index 3d1cf0a9adc58e5db5721047192e2fb7fb147924..a5079c4e033882c4b1068615551b5132e4ee0cba 100644 --- a/src/main/java/org/caosdb/server/database/backend/transaction/RetrieveVersionHistory.java +++ b/src/main/java/org/caosdb/server/database/backend/transaction/RetrieveVersionHistory.java @@ -1,19 +1,22 @@ /* - * ** header v3.0 This file is a part of the CaosDB Project. + * ** header v3.0 + * This file is a part of the CaosDB Project. * * Copyright (C) 2020 IndiScale GmbH <info@indiscale.com> * Copyright (C) 2020 Timm Fitschen <t.fitschen@indiscale.com> * - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Affero General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License along with this program. - * If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. * * ** end header */ diff --git a/src/main/java/org/caosdb/server/database/proto/ProtoTransactionLogMessage.java b/src/main/java/org/caosdb/server/database/proto/ProtoTransactionLogMessage.java deleted file mode 100644 index dd5cdbebcda7dd2c5c7f9ca93be69972ecef0e2c..0000000000000000000000000000000000000000 --- a/src/main/java/org/caosdb/server/database/proto/ProtoTransactionLogMessage.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ** header v3.0 - * This file is a part of the CaosDB Project. - * - * Copyright (C) 2018 Research Group Biomedical Physics, - * Max-Planck-Institute for Dynamics and Self-Organization Göttingen - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - * ** end header - */ -package org.caosdb.server.database.proto; - -import java.io.Serializable; - -public class ProtoTransactionLogMessage implements Serializable { - - public ProtoTransactionLogMessage( - final String transaction, - final String realm, - final String username, - final long seconds, - final int nanos) { - this.transaction = transaction; - this.realm = realm; - this.username = username; - this.seconds = seconds; - this.nanos = nanos; - } - - public ProtoTransactionLogMessage() {} - - private static final long serialVersionUID = -5856887517281480754L; - public String transaction = null; - public String realm; - public String username = null; - public Long seconds = null; - public Integer nanos = null; -} diff --git a/src/main/java/org/caosdb/server/jobs/core/History.java b/src/main/java/org/caosdb/server/jobs/core/History.java index e9d81ad40adeef1e3fa6d1498dabfe3a58c6fa29..5594b5afdb841436dbdd63f96b8e2c44faef51c6 100644 --- a/src/main/java/org/caosdb/server/jobs/core/History.java +++ b/src/main/java/org/caosdb/server/jobs/core/History.java @@ -33,9 +33,8 @@ import org.caosdb.server.utils.EntityStatus; import org.caosdb.server.utils.ServerMessages; /** - * Retrieves the complete version history of each entity and appends it to the - * entity. - * + * Retrieves the complete version history of each entity and appends it to the entity. + * * @author Timm Fitschen (t.fitschen@indiscale.com) */ @JobAnnotation(time = JobExecutionTime.POST_TRANSACTION, flag = "H")