summaryrefslogblamecommitdiffstats
path: root/src/main/java/org/openslx/satellitedaemon/db/DbImage.java
blob: 9298a540f191128a387947e6b0e6a0c00ac76b26 (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                       







                                                               












                                                                         







                                                                              
                                                           
         





                                                                                                                                 


         
package org.openslx.satellitedaemon.db;

import java.util.List;

/**
 * Represents an image in the satellite's database (mostly from
 * m_VLData_imageInfo)
 */
public class DbImage
{
	
	public final String guid;
	public final int rid;
	public final String path;
	public final String creator;
	
	public DbImage(String guid, int rid, String path, String creator)
	{
		this.guid = guid;
		this.rid = rid;
		this.path = path;
		this.creator = creator;
	}

	/**
	 * Returns a list of all images on this satellite that should be
	 * uploaded to the central server.
	 * 
	 * @return list of images that are marked for upload, where the upload
	 *         was either not started yet, or is incomplete
	 */
	public static List<DbImage> getAllMarkedForUpload()
	{
		return MySQL.findAll( DbImage.class, "SELECT image.GUID_imageID, image.imageVersion, image.image_path," +
				" Concat(user.loginName, '@', institution.name, '.de') AS userID" + // HACK: .de required for now
				" FROM m_VLData_imageInfo image" +
				" INNER JOIN m_user user ON (image.image_owner = user.userID)" +
				" INNER JOIN m_institution institution ON (institution.institutionID = user.institution)" +
				" WHERE status_isReady <> 0" );
	}

}