Examples of ODMGXAWrapper


Examples of org.photovault.dbhelper.ODMGXAWrapper

     @param s The new raw conversion settings to use. The method makes a clone of
     the object.    
     */
    public void setRawSettings( RawConversionSettings s ) {
        log.debug( "entry: setRawSettings()" );
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        RawConversionSettings settings = null;
        if ( s != null ) {
            if ( !s.equals( rawSettings ) ) {
                invalidateThumbnail();
                purgeInvalidInstances();
            }
            settings =  s.clone();
            Database db = ODMG.getODMGDatabase();
            db.makePersistent( settings );
            RawConversionSettings oldSettings = rawSettings;
            txw.lock( settings, Transaction.WRITE );
            if ( oldSettings != null ) {
                txw.lock( oldSettings, Transaction.WRITE );
                db.deletePersistent( oldSettings );
            }
        } else {
            // s is null so this should not be raw image
            if ( rawSettings != null ) {
                log.error( "Setting raw conversion settings of an raw image to null!!!" );
                invalidateThumbnail();
                purgeInvalidInstances();               
            }
        }
        rawSettings = settings;
        modified();
        txw.commit();
        log.debug( "exit: setRawSettings()" );
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     Get the current raw conversion settings.
     @return Current settings or <code>null</code> if this is not a raw image.    
     */
    public RawConversionSettings getRawSettings() {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.READ );
        txw.commit();
        return rawSettings;
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     * Get the value of description.
     * @return value of description.
     */
    public String getDescription() {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.READ );
        txw.commit();
        return description;
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     * Set the value of description.
     * @param v  Value to assign to description.
     */
    public void setDescription(String  v) {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        this.description = v;
        modified();
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

     is canceled.
     @throws PhotoNotFoundException if the original image cound not be located
     */
    public void save() throws PhotoNotFoundException, PhotovaultException {
        // Get a transaction context (whole saving operation should be done in a single transaction)
        ODMGXAWrapper txw = new ODMGXAWrapper();
        try {
            // Check if we already have a PhotoInfo object to control
            if ( isCreatingNew ) {
                photos = new PhotoInfo[1];
                if ( originalFile != null ) {
                    photos[0] = PhotoInfo.addToDB( originalFile );
                } else {
                    photos[0] = PhotoInfo.create();
                }
               
                // Set the model to all fields but preserve field state so that it is changed to the photoInfo
                // object
                changeModelInFields( true );
                isCreatingNew = false;
            }
           
            // Inform all fields that the modifications should be saved to model
            Iterator fieldIter = modelFields.values().iterator();
            while ( fieldIter.hasNext() ) {
                FieldController fieldCtrl = (FieldController) fieldIter.next();
                fieldCtrl.save();
            }
           
            // Update the raw settings if any field affecting them has been changed
            if ( isRawSettingsChanged ) {
                Iterator rawIter = rawFactories.entrySet().iterator();
                while ( rawIter.hasNext() ) {
                    Map.Entry e = (Map.Entry) rawIter.next();
                    PhotoInfo p = (PhotoInfo) e.getKey();
                    RawSettingsFactory f = (RawSettingsFactory) e.getValue();
                    RawConversionSettings r = null;
                    try {
                        r = f.create();
                    } catch (PhotovaultException ex) {
                        ex.printStackTrace();
                    }
                    p.setRawSettings( r );
                }
            }

            // Update the color mapping if any field affecting them has been changed
            if ( isColorMappingChanged ) {
                Iterator colorIter = colorMappingFactories.entrySet().iterator();
                while ( colorIter.hasNext() ) {
                    Map.Entry e = (Map.Entry) colorIter.next();
                    PhotoInfo p = (PhotoInfo) e.getKey();
                    ChannelMapOperationFactory f = (ChannelMapOperationFactory) e.getValue();
                    ChannelMapOperation o = null;
                    o = f.create();
                    p.setColorChannelMapping( o );
                }
            }
        } catch ( LockNotGrantedException e ) {
            txw.abort();
            throw new PhotovaultException( "Photo locked for other use", e );
        }
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    
     *
     * @param newQuality The new Quality value.
     */
    public final void setQuality(final int newQuality) {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        this.quality = newQuality;
        modified();
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    public final java.util.Date getLastModified() {
        return lastModified != null ? (java.util.Date) lastModified.clone() : null;
    }
   
    public  void setLastModified(final java.util.Date newDate) {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        this.lastModified = (newDate != null) ? (java.util.Date) newDate.clone()  : null;
        modified();
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

     * Set the <code>TechNotes</code> value.
     *
     * @param newTechNotes The new TechNotes value.
     */
    public final void setTechNotes(final String newTechNotes) {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        this.techNotes = newTechNotes;
        modified();
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

     @throws IllegalArgumentException if the given file name is longer than
     {@link #ORIG_FNAME_LENGTH}
     */
    public final void setOrigFname(final String newFname) {
        checkStringProperty( "OrigFname", newFname, ORIG_FNAME_LENGTH );
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        this.origFname = newFname;
        modified();
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    public boolean equals( Object obj ) {
        if ( obj == null || obj.getClass() != this.getClass() ) {
            return false;
        }
        PhotoInfo p = (PhotoInfo)obj;
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.READ );
        txw.lock( p, Transaction.READ );
        txw.commit();
       
        return ( isEqual( p.photographer, this.photographer )
        && isEqual( p.shootingPlace, this.shootingPlace )
        && isEqual( p.shootTime, this.shootTime )
        && isEqual(p.description, this.description )
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.