Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* DO NOT CHANGE THIS FILE. Changes will be overwritten.
* -----------------------------------------------------
* This file is generated by Redora (www.redora.net) a source code generator.
* Copyright to this file belongs to You: the person or organization who has
* used Redora to generate this file.
* Redora is released under the open source Apache License, but this generated code
* can be released under any license or stay unreleased, as wished by the copyright
* owner.
*
* Unless required by applicable law or agreed to in writing, this software
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
* , either express or implied.
*/
package redora.configuration.rdo.service.base;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import redora.api.Persistable;
import redora.api.fetch.*;
import redora.exceptions.*;
import redora.service.*;
import redora.configuration.rdo.model.*;
import redora.configuration.rdo.model.fields.*;
import redora.configuration.rdo.service.*;
import static redora.configuration.rdo.sql.RedoraTrashSQL.*;
import static redora.configuration.rdo.businessrules.RedoraTrashBusinessRules.check;
import static java.util.logging.Level.FINE;
import static java.util.logging.Level.SEVERE;
import static redora.db.SQLParameter.*;
/**
* You can work with the pojo's using this service. For example if you create command line J2SE functionality
* or server side logic.
* If you want to use your data in a web application, you also might want to look at {@link RedoraTrashServiceJSON}
* and {@link redora.configuration.rdo.service.http.RedoraTrashServlet}.
* Whenever business rule logic needs to be checked, it will go through here. For example a web user wants to persist
* some data. He will post this for example as JSON to {@link redora.configuration.rdo.service.http.RedoraTrashServlet}
* which in turn invokes {@link RedoraTrashServiceJSON} which will serialize the JSON stream into a pojo
* and then will invoke the persist method of this service.
* @author Redora (www.redora.net)
*/
public class RedoraTrashServiceBase extends ServiceBase {
static final transient Logger l = Logger.getLogger("redora.configuration.rdo.service.RedoraTrashService");
/**
* Don't use this directly but use the ServiceFactory instead:
*
* RedoraTrashService() myService = ServiceFactory.redoraTrash();
* ... do stuff
* ServiceFactory.close(myService);
*
* Initializes RedoraTrashService.
* @see redora.configuration.rdo.service.ServiceFactory
*/
protected RedoraTrashServiceBase() throws ConnectException {
super("default");
}
/**
* Chains this service object to another service object. The database connection
* and transaction is managed by the other service.
* @param chain (Mandatory) Service you want to make this service dependent on.
*/
protected RedoraTrashServiceBase(@NotNull ServiceBase chain) {
super(chain, "default");
inTransaction = true; //Let the calling service handle the transaction
}
/**
* Simple finder to get RedoraTrash by it's id.
* @param id (Mandatory) The primary key.
* @param scope (Mandatory) The allowed fetch scope: Scope.Table, Scope.Form, Scope.List.
* @return The desired RedoraTrash
* @throws ObjectNotFoundException When there is no object in the DB with this Id.
*/
@NotNull
public RedoraTrash findById(@NotNull Long id, @NotNull Scope scope)
throws QueryException, CopyException, ObjectNotFoundException {
RedoraTrash retVal = null;
String SQL;
switch (scope) {
case Table:
SQL = FIND_BY_ID_TABLE;
break;
case Form:
SQL = FIND_BY_ID_FORM;
break;
case List:
SQL = FIND_BY_ID_LIST;
break;
default:
throw new IllegalArgumentException("Illegal scope for this finder: " + scope);
}
SQL = prepare(SQL, id);
ResultSet rs = null;
try {
rs = sqlQuery(SQL);
if (rs.next()) {
retVal = new RedoraTrash(rs, 0, scope);
} else {
throw new ObjectNotFoundException("Could not find RedoraTrash " + id);
}
} catch(SQLException e) {
l.log(SEVERE, "Failed to run query " + SQL, e);
throw new QueryException("Failed to run query: " + SQL, e);
} finally {
close(rs);
}
return retVal;
}
/**
* Finds records by custom SQL. Custom queries should be defined in the queries section in the model.
* @param sql (Mandatory) The SQL statement you wish to use. See also RedoraTrashSQL.
* @param params (Optional) List of parameters. When omitted it is assumed there are no parameters.
* @param page (Mandatory) The Page strategy. Allowed scopes are: Scope.Table, Scope.Form, Scope.List, Scope.Lazy.
* @return Empty or filled list with RedoraTrash
*/
@NotNull
public List find(@NotNull String sql, @Nullable List