[basedb-devel] Batch scan importer

2009-03-11 Thread Pawel Sztromwasser

Hello BASE team,

We really enjoy the set of batch uploading plugins and were doing a 
little training for our users in Bergen. Everything seemed great except 
that they couldn't link freshly created scans with image files. I read 
in the example spreadsheet that it is not supported and was very 
surprised since similar 'file attaching' works very nice for raw 
bioassays. I sat down, did some copy pasting from RawBioAssayImporter 
and after little edits it worked (source attached).


I hope that you can make some use of it.

All the best,
Pawel
/**
	$Id: ScanImporter.java 4551 2008-09-29 07:47:24Z nicklas $

	Copyright (C) 2008 Nicklas Nordborg

	This file is part of BASE - BioArray Software Environment.
	Available at http://base.thep.lu.se/

	BASE 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.

	BASE 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 BASE. If not, see http://www.gnu.org/licenses/.
*/
package net.sf.basedb.plugins.batchimport;

import java.util.Collections;
import java.util.List;
import java.util.Set;

import net.sf.basedb.core.DbControl;
import net.sf.basedb.core.File;
import net.sf.basedb.core.Hardware;
import net.sf.basedb.core.Hybridization;
import net.sf.basedb.core.Image;
import net.sf.basedb.core.Item;
import net.sf.basedb.core.ItemQuery;
import net.sf.basedb.core.Path;
import net.sf.basedb.core.PathParameterType;
import net.sf.basedb.core.PluginParameter;
import net.sf.basedb.core.Protocol;
import net.sf.basedb.core.ProtocolType;
import net.sf.basedb.core.Scan;
import net.sf.basedb.core.SystemItems;
import net.sf.basedb.core.Version;
import net.sf.basedb.core.plugin.About;
import net.sf.basedb.core.plugin.AboutImpl;
import net.sf.basedb.core.plugin.GuiContext;
import net.sf.basedb.util.parser.FlatFileParser;
import net.sf.basedb.util.parser.Mapper;

/**
	Plug-in for importing scan items in a batch. The plug-in can create new 
	items and updated existing items.

	@author nicklas
	@version 2.8
	@base.modified $Date: 2008-09-29 09:47:24 +0200 (Mon, 29 Sep 2008) $
*/
public class ScanImporterNMC
	extends AbstractItemImporterScan
{

	private static final SetGuiContext guiContexts =  
		Collections.singleton(new GuiContext(Item.SCAN, GuiContext.Type.LIST));

	private static final About about =
		new AboutImpl
	(
			Scan importer with images,
			Imports and updates scans in a batch (linking with images).,
			Version.getMajor() + . + Version.getMinor() + . + Version.getMaintenance(),
			2008, Base 2 development team,
			null,
			null,
			http://base.thep.lu.se;
	);

	
	protected static final PluginParameterString hardwareColumnMapping = new PluginParameterString(
			hardwareColumnMapping,
			Scanner,
			Mapping that picks the name or ID of the array slide scanner from the data columns.  +
			The plug-in will first try to find a scanner with the given name. If none is found and  +
			the value is numeric it will try to load by internal ID.  +
			Example: \\Scanner\\,
			optionalColumnMapping
			);

	protected static final PluginParameterString hybridizationColumnMapping = new PluginParameterString(
			hybridizationColumnMapping,
			Hybridization,
			Mapping that picks the name or ID of the hybridization from the data columns.  +
			The plug-in will first try to find a hybridization with the given name. If none is found and  +
			the value is numeric it will try to load by internal ID.  +
			Example: \\Hybridization\\,
			optionalColumnMapping
			);
	
	// extra parameter needed for linking with image files
	protected static final PluginParameterString fileColumnMapping = new PluginParameterString(
			fileColumnMapping,
			File,
			Mapping that picks the path of a image file from the columns.  +
			The path can be an absolute path (starting with /) or relative  +
			to the 'Data directory' parameter. +
			Example: \\File\\,
			optionalColumnMapping
			);
	
	public ScanImporterNMC()
	{}

	/*
		From the Plugin interface
		
	*/
	@Override
	public About getAbout()
	{
		return about;
	}
	// 

	/*
		From the InteractivePlugin interface
		
	*/
	@Override
	public SetGuiContext getGuiContexts()
	{
		return guiContexts;
	}
	// 

	/*
		From the AbstractItemImporter class
		
	*/
	
	private Mapper nameMapper;
	private Mapper descriptionMapper;
	private Mapper protocolMapper;
	private Mapper hardwareMapper;
	private Mapper hybridizationMapper;
	//extra mappers for linking with image file
	private 

Re: [basedb-devel] Batch scan importer

2009-03-11 Thread Pawel Sztromwasser
I have just noticed that the filename I sent has different name then the 
class inside. I used ScanImporterNMC name to distinguish from the 
original plugin and then renamed the file before sending. Just rename it 
back and all will work.

Pawel

Pawel Sztromwasser wrote:
 Hello BASE team,
 
 We really enjoy the set of batch uploading plugins and were doing a 
 little training for our users in Bergen. Everything seemed great except 
 that they couldn't link freshly created scans with image files. I read 
 in the example spreadsheet that it is not supported and was very 
 surprised since similar 'file attaching' works very nice for raw 
 bioassays. I sat down, did some copy pasting from RawBioAssayImporter 
 and after little edits it worked (source attached).
 
 I hope that you can make some use of it.
 
 All the best,
 Pawel
 
 
 
 
 --
 Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
 powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
 easily build your RIAs with Flex Builder, the Eclipse(TM)based development
 software that enables intelligent coding and step-through debugging.
 Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
 
 
 
 
 ___
 basedb-devel mailing list
 basedb-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/basedb-devel


--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel