com.eywa.impl.app.mongo.entities.items.session.files.ItemSessionDataFile.java Source code

Java tutorial

Introduction

Here is the source code for com.eywa.impl.app.mongo.entities.items.session.files.ItemSessionDataFile.java

Source

/*
 * EYWA.COM (Eywa Commerce)
 * This program is an integrated platform with E-Commerce and Configurator system.
 * Support: Please, contact the Author on http://www.smartfeeling.org.
 * Copyright (C) 2014  Gian Angelo Geminiani
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.eywa.impl.app.mongo.entities.items.session.files;

import com.eywa.impl.app.IAppConstants;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import org.ly.packages.mongo.impl.util.MongoUtils;

/**
 *
 */
public class ItemSessionDataFile extends BasicDBObject {

    public static final String PAGE_NUMBER = IAppConstants.PAGE_NUMBER;
    public static final String INDEX = IAppConstants.INDEX;
    public static final String FILE_TEMP_PATH = IAppConstants.FILE_TEMP_PATH;
    public static final String WIDTH = IAppConstants.WIDTH;
    public static final String HEIGHT = IAppConstants.HEIGHT;
    public static final String LENGTH = IAppConstants.LENGTH;
    public static final String BASE64 = IAppConstants.BASE64;

    public ItemSessionDataFile(final DBObject raw) {
        this.init(raw);
    }

    public ItemSessionDataFile() {
        this.init(null);
    }

    // ------------------------------------------------------------------------
    //                      p u b l i c
    // ------------------------------------------------------------------------

    public int getIndex() {
        return getIndex(this);
    }

    public void setIndex(final int value) {
        setIndex(this, value);
    }

    public int getPageNumber() {
        return getPageNumber(this);
    }

    public void setPageNumber(final int value) {
        setPageNumber(this, value);
    }

    public String getFileTempPath() {
        return getFileTempPath(this);
    }

    public void setFileTempPath(final String value) {
        setFileTempPath(this, value);
    }

    public int getWidth() {
        return getWidth(this);
    }

    public void setWidth(final int value) {
        setWidth(this, value);
    }

    public int getHeight() {
        return getHeight(this);
    }

    public void setHeight(final int value) {
        setHeight(this, value);
    }

    public long getLength() {
        return getLength(this);
    }

    public void setLength(final long value) {
        setLength(this, value);
    }

    public String getBase64() {
        return getBase64(this);
    }

    public void setBase64(final String value) {
        setBase64(this, value);
    }

    // ------------------------------------------------------------------------
    //                      p r i v a t e
    // ------------------------------------------------------------------------

    private void init(final DBObject raw) {
        if (null != raw) {
            this.put(INDEX, getIndex(raw));
            this.put(PAGE_NUMBER, getPageNumber(raw));
            this.put(FILE_TEMP_PATH, getFileTempPath(raw));
            this.put(WIDTH, getWidth(raw));
            this.put(HEIGHT, getHeight(raw));
            this.put(LENGTH, getLength(raw));
            this.put(BASE64, getBase64(raw));
        }
    }

    // ------------------------------------------------------------------------
    //                      S T A T I C
    // ------------------------------------------------------------------------

    public static int getIndex(final DBObject item) {
        return MongoUtils.getInt(item, INDEX);
    }

    public static void setIndex(final DBObject item, final int value) {
        MongoUtils.put(item, INDEX, value);
    }

    public static int getPageNumber(final DBObject item) {
        return MongoUtils.getInt(item, PAGE_NUMBER);
    }

    public static void setPageNumber(final DBObject item, final int value) {
        MongoUtils.put(item, PAGE_NUMBER, value);
    }

    public static String getFileTempPath(final DBObject item) {
        return MongoUtils.getString(item, FILE_TEMP_PATH);
    }

    public static void setFileTempPath(final DBObject item, final String value) {
        MongoUtils.put(item, FILE_TEMP_PATH, value);
    }

    public static int getWidth(final DBObject item) {
        return MongoUtils.getInt(item, WIDTH);
    }

    public static void setWidth(final DBObject item, final long value) {
        MongoUtils.put(item, WIDTH, value);
    }

    public static int getHeight(final DBObject item) {
        return MongoUtils.getInt(item, HEIGHT);
    }

    public static void setHeight(final DBObject item, final long value) {
        MongoUtils.put(item, HEIGHT, value);
    }

    public static long getLength(final DBObject item) {
        return MongoUtils.getLong(item, LENGTH);
    }

    public static void setLength(final DBObject item, final long value) {
        MongoUtils.put(item, LENGTH, value);
    }

    public static String getBase64(final DBObject item) {
        return MongoUtils.getString(item, BASE64);
    }

    public static void setBase64(final DBObject item, final String value) {
        MongoUtils.put(item, BASE64, value);
    }
}