当前位置: 首页>>代码示例>>Java>>正文


Java BlobKey.equals方法代码示例

本文整理汇总了Java中com.google.appengine.api.blobstore.BlobKey.equals方法的典型用法代码示例。如果您正苦于以下问题:Java BlobKey.equals方法的具体用法?Java BlobKey.equals怎么用?Java BlobKey.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.appengine.api.blobstore.BlobKey的用法示例。


在下文中一共展示了BlobKey.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteImage

import com.google.appengine.api.blobstore.BlobKey; //导入方法依赖的package包/类
/**
 * Deletes the uploaded image.
 */
protected void deleteImage(BlobKey blobKey) {
    if (blobKey.equals(new BlobKey(""))) {
        return;
    }

    try {
        deleteUploadedFile(blobKey);
    } catch (BlobstoreFailureException bfe) {
        statusToAdmin = Const.ACTION_RESULT_FAILURE
                + " : Unable to delete picture (possible unused picture with key: "
                + blobKey.getKeyString()
                + " || Error Message: "
                + bfe.getMessage() + Const.EOL;
    }
}
 
开发者ID:TEAMMATES,项目名称:teammates,代码行数:19,代码来源:ImageUploadAction.java

示例2: deletePicture

import com.google.appengine.api.blobstore.BlobKey; //导入方法依赖的package包/类
private void deletePicture(BlobKey blobKey) {
    if (blobKey.equals(new BlobKey(""))) {
        return;
    }
    try {
        logic.deletePicture(blobKey);
    } catch (BlobstoreFailureException bfe) {
        statusToAdmin = Const.ACTION_RESULT_FAILURE
                      + " : Unable to delete profile picture (possible unused picture with key: "
                      + blobKey.getKeyString() + " || Error Message: "
                      + bfe.getMessage() + Const.EOL;
    }
}
 
开发者ID:TEAMMATES,项目名称:teammates,代码行数:14,代码来源:StudentProfilePictureUploadAction.java

示例3: deleteGroupReceiverListFile

import com.google.appengine.api.blobstore.BlobKey; //导入方法依赖的package包/类
private void deleteGroupReceiverListFile(BlobKey blobKey) {
    if (blobKey.equals(new BlobKey(""))) {
        return;
    }

    try {
        logic.deleteAdminEmailUploadedFile(blobKey);
    } catch (BlobstoreFailureException bfe) {
        statusToAdmin = Const.ACTION_RESULT_FAILURE
                + " : Unable to delete group receiver list file (possible unused file with key: "
                + blobKey.getKeyString()
                + " || Error Message: "
                + bfe.getMessage() + Const.EOL;
    }
}
 
开发者ID:TEAMMATES,项目名称:teammates,代码行数:16,代码来源:AdminEmailGroupReceiverListUploadAction.java

示例4: updateStationImageAttributes

import com.google.appengine.api.blobstore.BlobKey; //导入方法依赖的package包/类
/**
   * Update StationImage attributes.
   * Update's the given StationImage's attributes in the datastore.
   * @param key
   * 			: the key of the StationImage whose attributes will be updated
   * @param stationImageName
   * 			: stationImage name
   * @param stationImageMultimediaContent
   * 			: stationImage multimedia content
   * @param stationImageFormat
   * 			: stationImage format
* @throws MissingRequiredFieldsException 
 * @throws ObjectExistsInDatastoreException 
   */
public static void updateStationImageAttributes(
		Key key,
		String stationImageName, 
   		BlobKey stationImageMultimediaContent,
   		String stationImageFormat) 
                      throws MissingRequiredFieldsException, 
                      ObjectExistsInDatastoreException {	
	
	PersistenceManager pm = PMF.get().getPersistenceManager();

	Station station = pm.getObjectById(Station.class, key.getParent());
	
	Transaction tx = pm.currentTransaction();
	try {
		StationImage stationImage = pm.getObjectById(StationImage.class, key);
		
		// Check if station image already exists in datastore
		if (stationImageExists(key.getParent(), stationImageName) &&
				!stationImage.getStationImageName().equals(stationImageName)) {
			throw new ObjectExistsInDatastoreException(stationImage, "A station image " +
					"with this title has already been added.");
		}
		
		BlobKey oldStationImageMultimediaContent = 
				stationImage.getStationImageMultimediaContent();
		
		tx.begin();
		stationImage.setStationImageName(stationImageName);
		stationImage.setStationImageMultimediaContent(stationImageMultimediaContent);
		stationImage.setStationImageFormat(stationImageFormat);
		station.updateStationImageVersion();
		if (!oldStationImageMultimediaContent.equals(stationImageMultimediaContent) &&
				oldStationImageMultimediaContent != null) {
			blobstoreService.delete(oldStationImageMultimediaContent);
		}
		tx.commit();
		

		
		log.info("StationImage \"" + stationImage.getStationImageName() + 
                    "\"'s attributes updated in datastore.");
	}
	finally {
		if (tx.isActive()) {
			tx.rollback();
		}
		pm.close();
	}
}
 
开发者ID:gfigueroa,项目名称:internet-radio-gae,代码行数:64,代码来源:StationImageManager.java

示例5: updateStationAudioAttributes

import com.google.appengine.api.blobstore.BlobKey; //导入方法依赖的package包/类
/**
   * Update StationAudio attributes.
   * Update's the given StationAudio's attributes in the datastore.
   * @param key
   * 			: the key of the StationAudio whose attributes will be updated
   * @param stationAudioName
   * 			: stationAudio name
   * @param stationAudioMultimediaContent
   * 			: stationAudio multimedia content
   * @param stationAudioDuration
   * 			: stationAudio duration
   * @param stationAudioFormat
   * 			: stationAudio format
* @throws MissingRequiredFieldsException 
 * @throws ObjectExistsInDatastoreException 
   */
public static void updateStationAudioAttributes(
		Key key,
		StationAudio.StationAudioType stationAudioType,
		String stationAudioName, 
   		BlobKey stationAudioMultimediaContent,
   		Double stationAudioDuration,
   		String stationAudioFormat) 
                      throws MissingRequiredFieldsException, 
                      ObjectExistsInDatastoreException {	
	
	PersistenceManager pm = PMF.get().getPersistenceManager();

	Station station = pm.getObjectById(Station.class, key.getParent());
	
	Transaction tx = pm.currentTransaction();
	try {
		StationAudio stationAudio = pm.getObjectById(StationAudio.class, key);
		
		// Check if station audio already exists in datastore
		if (stationAudioExists(key.getParent(), stationAudioName) && 
				!stationAudio.getStationAudioName().equals(stationAudioName)) {
			throw new ObjectExistsInDatastoreException(stationAudio, "A station audio " +
					"with this title has already been added.");
		}
		
		BlobKey oldStationAudioMultimediaContent = 
				stationAudio.getStationAudioMultimediaContent();
		
		tx.begin();
		stationAudio.setStationAudioType(stationAudioType);
		stationAudio.setStationAudioName(stationAudioName);
		stationAudio.setStationAudioMultimediaContent(stationAudioMultimediaContent);
		stationAudio.setStationAudioDuration(stationAudioDuration);
		stationAudio.setStationAudioFormat(stationAudioFormat);
		station.updateStationAudioVersion();
		tx.commit();
		
		if (!oldStationAudioMultimediaContent.equals(stationAudioMultimediaContent) &&
				oldStationAudioMultimediaContent != null) {
			blobstoreService.delete(oldStationAudioMultimediaContent);
		}
		
		log.info("StationAudio \"" + stationAudio.getStationAudioName() + 
                    "\"'s attributes updated in datastore.");
	}
	finally {
		if (tx.isActive()) {
			tx.rollback();
		}
		pm.close();
	}
}
 
开发者ID:gfigueroa,项目名称:internet-radio-gae,代码行数:69,代码来源:StationAudioManager.java

示例6: updateStationAttributes

import com.google.appengine.api.blobstore.BlobKey; //导入方法依赖的package包/类
/**
   * Update Station attributes.
   * Update's the given Station's attributes in the datastore.
   * @param email
   * 			: the email of the Station whose attributes will be updated
   * @param stationType
   * 			: the new station type's key to give to the Station
   * @param stationPrivilegeLevel
   * 			: the new privilege level of the station
   * @param stationName
   * 			: the new name to give to the Station
   * @param stationNumber
   * 			: the new number to give to the Station
   * @param stationDescription
   * 			: the new description to give to the Station
   * @param region
   * 			: the new region of the Station
   * @param stationAddress
   * 			: the new address of the Station
   * @param stationWebsite
   * 			: Station website
   * @param stationLogo
   * 			: Station logo blob key
   * @param stationComments
   * 			: the new comments to give to the Station
* @throws MissingRequiredFieldsException 
   */
public static void updateStationAttributes(
		Email email,
		Long stationType,
		Integer stationPrivilegeLevel,
           String stationName,
           String stationNumber,
           String stationDescription,
           Long region,
           PostalAddress stationAddress,
           Link stationWebsite, 
           BlobKey stationLogo, 
           String stationComments) 
           		throws MissingRequiredFieldsException {	
	
	PersistenceManager pm = PMF.get().getPersistenceManager();
	
	Transaction tx = pm.currentTransaction();
	try {
		Key key = KeyFactory.createKey(Station.class.getSimpleName(), 
				email.getEmail());
		Station station = pm.getObjectById(Station.class, key);
		
		BlobKey oldStationLogo = station.getStationLogo();
		
		tx.begin();
		station.setStationType(stationType);
		station.setPrivilegeLevel(stationPrivilegeLevel);
		station.setStationName(stationName);
		station.setStationNumber(stationNumber);
		station.setStationDescription(stationDescription);
		station.setRegion(region);
		station.setStationAddress(stationAddress);
		station.setStationWebsite(stationWebsite);
		station.setStationLogo(stationLogo);
		station.setStationComments(stationComments);
		tx.commit();
		
		if (!oldStationLogo.equals(stationLogo) &&
				oldStationLogo != null) {
			blobstoreService.delete(oldStationLogo);
		}
		
		log.info("Station \"" + email.getEmail() + 
				"\"'s attributes updated in datastore.");
	}
	finally {
		if (tx.isActive()) {
			tx.rollback();
		}
		pm.close();
	}
}
 
开发者ID:gfigueroa,项目名称:internet-radio-gae,代码行数:80,代码来源:StationManager.java


注:本文中的com.google.appengine.api.blobstore.BlobKey.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。