source: trunk/fmgVen/src/com/fmguler/ven/VenException.java @ 37

Last change on this file since 37 was 26, checked in by fmguler, 14 years ago

Refs #3 - Ven.save() is transferred to the new package. Save use case is completed. Convert.toDB() converts camel case object names to database names with underscores. Unchecked VenException is thrown by Ven methods. Liquibase changelog (test-db-changelog.xml) is changed to include only a simple object to test save operation. It creates a sample database table and inserts a sample row. On rollback it removes sample data. Using liquibase, Sample.java builds database, tests save operation and rolls back.

QueryGenerator generates insert and update queries for save and generates sequence query to assign ids to new objects. Ven calls query generator and runs the query using spring jdbc template.

Old codebase updated to run at Java 1.4

File size: 2.4 KB
Line 
1/*
2 *  fmgVen - A Convention over Configuration Java ORM Tool
3 *  Copyright 2010 Fatih Mehmet Güler
4 *
5 *  Licensed under the Apache License, Version 2.0 (the "License");
6 *  you may not use this file except in compliance with the License.
7 *  You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 *  under the License.
17 */
18package com.fmguler.ven;
19
20/**
21 * All kinds of exceptions in Ven operations.
22 * @author Fatih Mehmet Güler
23 */
24public class VenException extends RuntimeException {
25    private String errorCode;
26    private String errorParam;
27    //Error codes
28    //"Invalid object, \"id\" property must be of integer type"
29    public static final String EC_GENERATOR_OBJECT_ID_TYPE_INVALID = "ec-generator-object-id-type-invalid";
30
31    /**
32     * Init VenException with an error code
33     * @param errorCode the error code
34     */
35    public VenException(String errorCode) {
36        this.errorCode = errorCode;
37    }
38
39    /**
40     * Init VenException with an error code and an error parameter
41     * @param errorCode the error code
42     * @param errorParam the error param
43     */
44    public VenException(String errorCode, String errorParam) {
45        this.errorCode = errorCode;
46        this.errorParam = errorParam;
47    }
48
49    /**
50     * Init VenException with an error code, error parameter and the cause of the exception
51     * @param errorCode the error code
52     * @param errorParam the error parameter
53     * @param cause the cause of the exception
54     */
55    public VenException(String errorCode, String errorParam, Throwable cause) {
56        super(cause);
57        this.errorCode = errorCode;
58        this.errorParam = errorParam;
59    }
60
61    /**
62     * @return the error code of the exception
63     */
64    public String getErrorCode() {
65        return errorCode;
66    }
67
68    /**
69     * @return the error parameter of the exception, which can contain details about the error
70     */
71    public String getErrorParam() {
72        return errorParam;
73    }
74}
Note: See TracBrowser for help on using the repository browser.