Examples of ODMGXAWrapper


Examples of org.photovault.dbhelper.ODMGXAWrapper

        log.debug( "Fetching ColorProfileDesc with ID " + id );
        String oql = "select colorProfiles from " + ColorProfileDesc.class.getName() + " where id=" + id;
        List profiles = null;
       
        // Get transaction context
        ODMGXAWrapper txw = new ODMGXAWrapper();
        Implementation odmg = ODMG.getODMGImplementation();
       
        try {
            OQLQuery query = odmg.newOQLQuery();
            query.create( oql );
            profiles = (List) query.execute();
            txw.commit();
        } catch (Exception e ) {
            log.warn( "Error fetching record: " + e.getMessage() );
            txw.abort();
            return null;
        }
        if ( profiles.size() == 0 ) {
            return null;
        }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

        String oql = "select colorProfiles from " + ColorProfileDesc.class.getName() +
                " where id > 0";
        List profiles = null;
       
        // Get transaction context
        ODMGXAWrapper txw = new ODMGXAWrapper();
        Implementation odmg = ODMG.getODMGImplementation();
       
        try {
            OQLQuery query = odmg.newOQLQuery();
            query.create( oql );
            txw.flush();
            profiles = (List) query.execute();
            txw.commit();
        } catch (Exception e ) {
            log.warn( "Error fetching records: " + e.getMessage() );
            e.printStackTrace();
            txw.abort();
            return null;
        }
        return profiles;
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

         * Creates the profile
         * @return The created profile
         */
        public ColorProfileDesc execute() {
            log.debug( "CreateProfile#execute: " + name );
            ODMGXAWrapper txw = new ODMGXAWrapper();
            ColorProfileDesc p = new ColorProfileDesc();
            txw.lock( p, Transaction.WRITE );
            p.setName( name );
            p.setDescription( description );
           
            // Copy the file to the default volume
            VolumeBase defvol = VolumeBase.getDefaultVolume();
            File f = defvol.getFilingFname( profileFile );
            log.debug( "Copying to default volume: " + f.getAbsolutePath() );
            try {
                FileUtils.copyFile( profileFile, f );
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            byte[] hash = FileUtils.calcHash( f );
            p.setHash( hash );
            txw.flush();
           
            ColorProfileInstance i = new ColorProfileInstance();
            i.fname = defvol.mapFileToVolumeRelativeName( f );
            i.volumeId = defvol.getName();
            i.profileId = p.id;
           
           
            p.addInstance( i );
            txw.lock( i, Transaction.WRITE );
            txw.commit();
            return p;
        }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

       
        /**
         * Do the changes to profile.
         */
        public void execute() {
            ODMGXAWrapper txw = new ODMGXAWrapper();
            txw.lock( p, Transaction.WRITE );
            if ( newName != null ) {
                p.setName( newName );
            }
            if ( newDesc != null ) {
                p.setDescription( newDesc );
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

     * query has been modified and results are needed.
     */
    protected void query() {
  log.debug( "Entry: PhotoQuery.query" );
  photos.clear();
  ODMGXAWrapper txw = new ODMGXAWrapper();
  Implementation odmg = ODMG.getODMGImplementation();

  Transaction tx = odmg.currentTransaction();

  try {
      PersistenceBroker broker = ((HasBroker) tx).getBroker();
     
      Criteria crit = new Criteria();
      // Go through all the fields and create the criteria
      for ( int n = 0; n < criterias.length; n++ ) {
    if ( criterias[n] != null ) {
        criterias[n].setupQuery( crit );
    }
      }

      if ( limitFolder != null ) {
     Collection folderIds = getSubfolderIds( limitFolder );
//     crit.addEqualTo( "folders.folderId", new Integer( limitFolder.getFolderId() ) );
     crit.addIn( "folders.folderId", folderIds );
      }
     
      QueryByCriteria q = new QueryByCriteria( PhotoInfo.class, crit );
      Collection result = broker.getCollectionByQuery( q );
      photos.addAll( result );
      txw.commit();
  } catch ( Exception e ) {
      log.warn( "Error executing query: " + e.getMessage() );
      e.printStackTrace( System.out );
      txw.abort();
  }
     
  queryModified = false;
  log.debug( "Exit: PhotoQuery.query" );

View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

        }
        while ( v >= 360.0 ) {
            v -= 360.0;
        }
       
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        if ( v != prefRotation ) {
            // Rotation changes, invalidate the thumbnail
            invalidateThumbnail();
            purgeInvalidInstances();
        }
        this.prefRotation = v;
        modified();
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

   
    /**
     Get the preferred crop bounds of the original image
     */
    public Rectangle2D getCropBounds() {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        checkCropBounds();
        txw.lock( this, Transaction.READ );
        txw.commit();
        return new Rectangle2D.Double( cropMinX, cropMinY,
                cropMaxX-cropMinX, cropMaxY-cropMinY );
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     Set the preferred cropping operation
     @param cropBounds New crop bounds
     */
    public void setCropBounds( Rectangle2D cropBounds ) {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        if ( !cropBounds.equals( getCropBounds() ) ) {
            // Rotation changes, invalidate the thumbnail
            invalidateThumbnail();
            purgeInvalidInstances();           
        }
        cropMinX = cropBounds.getMinX();
        cropMinY = cropBounds.getMinY();
        cropMaxX = cropBounds.getMaxX();
        cropMaxY = cropBounds.getMaxY();
        checkCropBounds();
        modified();
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     Set the preferred color channel mapping
     @param cm the new color channel mapping
     */
    public void setColorChannelMapping( ChannelMapOperation cm ) {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.WRITE );
        if ( cm != null ) {
            if ( !cm.equals( channelMap ) ) {
                // Rotation changes, invalidate the thumbnail
                invalidateThumbnail();
                purgeInvalidInstances();
            }
        }
        channelMap = cm;
        modified();
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     Get currently preferred color channe?l mapping.
     @return The current color channel mapping
     */
    public ChannelMapOperation getColorChannelMapping() {
        ODMGXAWrapper txw = new ODMGXAWrapper();
        txw.lock( this, Transaction.READ );
        txw.commit();
        return channelMap;
    }
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.