Package com.scooterframework.common.exception

Examples of com.scooterframework.common.exception.InvalidOperationException


        if (Relation.BELONGS_TO_TYPE.equals(relationType)) {
            //Note: In this case, owner is child and target is parent.
           
            if (newTarget == null) {
                if (owner.isPKDependentOf(classB)) {
                    throw new InvalidOperationException("Cannot nullify a primary key field.");
                }
               
                //decrement counter of old parent if there is one when the reverse relation is has-many.
                if (!owner.isNewRecord() && Relation.HAS_MANY_TYPE.equals(reverseRelationType) && !isEmpty()) {
                    owner.decrementCounterInParent((BelongsToRelation)recordRelation.getRelation());
View Full Code Here


     *
     * @param columnNames   a string of column names separated by comma or blank
     * @param messageKey    key to a message in message resource files or a message
     */
    public void validatesUniqenessOf(String columnNames, String messageKey) {
        throw new InvalidOperationException("This method must be implemented by a subclass of Validators class.");
    }
View Full Code Here

    /**
     * Sets primary key columns for the record
     */
    public void setPrimaryKey(Set<String> primaryKeyNames) {
        if (isFreezed()) throw new InvalidOperationException(this, "setPrimaryKey", "freezed");

        rowInfo.setPrimaryKeyColumns(primaryKeyNames);
    }
View Full Code Here

     *
     * <p>Sometimes columns like "entry_user, entry_dt, update_user, update_dt or xxx_count"
     * are readonly. They will be updated by other database mechanisms.</p>
     */
    public void setReadOnlyColumn(String readOnlyColumnName) {
        if (isFreezed()) throw new InvalidOperationException(this, "setReadOnlyColumn", "freezed");
       
        rowInfo.setReadOnlyColumn(readOnlyColumnName);
    }
View Full Code Here

     *
     * <p>Sometimes columns like "entry_user, entry_dt, update_user, update_dt"
     * are readonly. They will be updated by other database mechanisms.</p>
     */
    public void setReadOnlyColumns(Set<String> readOnlyColumnNames) {
        if (isFreezed()) throw new InvalidOperationException(this, "setReadOnlyColumns", "freezed");
       
        rowInfo.setReadOnlyColumns(readOnlyColumnNames);
    }
View Full Code Here

     *
     * <p>If there is no primary key defined for the model, data from all
     * columns will be used as retrieving conditions.</p>
     */
    private void find() {
        if (isFreezed()) throw new InvalidOperationException(this, "find", "freezed");

        if (rowData == null) return;

        //populate a Map with primary key values
        String[] pkNames = rowInfo.getPrimaryKeyColumnNames();
View Full Code Here

     *
     * @param field a field name
     * @param value value of the field
     */
    public void updateField(String field, Object value) {
        if (isFreezed()) throw new InvalidOperationException(this, "updateField", "freezed");

        Map<String, Object> m = new HashMap<String, Object>();
        m.put(field, value);
        updateFields(m);
    }
View Full Code Here

     * Updates all the fields contained in the map for a record (row) in database
     *
     * @param fieldData a map of field and its data pairs
     */
    public void updateFields(Map<String, ?> fieldData) {
        if (isFreezed()) throw new InvalidOperationException(this, "updateFields", "freezed");

        setData(fieldData);
        update(true);
    }
View Full Code Here

   * @param changedOnly
   *            true if only changed fields are included in SQL query
   * @return number of records updated
   */
    public int update(boolean changedOnly) {
        if (isFreezed()) throw new InvalidOperationException(this, "update", "freezed");

        ImplicitTransactionManager tm = TransactionManagerUtil.getImplicitTransactionManager();
        int updateCount = -1;

        try {
View Full Code Here

    /**
     * Reloads the current record based on its primary key values.
     */
    public void reload() {
        if (isFreezed()) throw new InvalidOperationException(this, "reload", "freezed");

        beforeFind();

        find();

View Full Code Here

TOP

Related Classes of com.scooterframework.common.exception.InvalidOperationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.