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


Java NotFoundException类代码示例

本文整理汇总了Java中com.googlecode.objectify.NotFoundException的典型用法代码示例。如果您正苦于以下问题:Java NotFoundException类的具体用法?Java NotFoundException怎么用?Java NotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: find

import com.googlecode.objectify.NotFoundException; //导入依赖的package包/类
/**
 * We don't use Objectify find method to let DataStore subclass
 * override get method
 */
@Override
public <T> T find(Key<? extends T> p_arg0)
{
  if( p_arg0 != null )
  {
    try
    {
      return get( p_arg0 );
    } catch( NotFoundException e )
    {
      logger.fine( e.getMessage() );
    }
  }
  return null;
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:20,代码来源:DataStore.java

示例2: get

import com.googlecode.objectify.NotFoundException; //导入依赖的package包/类
@Override
public <T> T get(Class<? extends T> p_arg0, long p_arg1) throws NotFoundException
{
  if( p_arg0 == Game.class )
  {
    return p_arg0.cast( getGame( p_arg1 ) );
  }
  else
  {
    return super.get( p_arg0, p_arg1 );
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:13,代码来源:FmgDataStore.java

示例3: getUser

import com.googlecode.objectify.NotFoundException; //导入依赖的package包/类
/**
 * Helper method to get the data object for a given User.
 *
 * @param user User to lookup
 * @return User's data object
 */
private UserData getUser(User user) throws UnauthorizedException {
    if (user == null) {
        throw new UnauthorizedException("Invalid credentials");
    }
    String uid = user.getId();

    try {
        return ofy().load().type(UserData.class).id(uid).safe();
    } catch (NotFoundException e) {
        UserData data = new UserData();
        data.userId = uid;
        return data;
    }
}
 
开发者ID:google,项目名称:iosched,代码行数:21,代码来源:UserdataEndpoint.java

示例4: unregister

import com.googlecode.objectify.NotFoundException; //导入依赖的package包/类
/**
 * Remove a registration of a user's device. When a user signs out of a client they should
 * unregister. This will prevent messages from being sent to the wrong user if multiple users
 * are using the same device.
 *
 * @param deviceId FCM token representing the device.
 * @return Result containing a message about the un-registration.
 * @throws BadRequestException Thrown when there is no device ID in the request.
 */
@ApiMethod(path = "unregister", httpMethod = HttpMethod.POST)
public void unregister(User user, @Named(PARAMETER_DEVICE_ID) String deviceId)
    throws BadRequestException, UnauthorizedException,
    com.google.api.server.spi.response.NotFoundException, ForbiddenException {

  // Check to see if deviceId.
  if (Strings.isNullOrEmpty(deviceId)) {
    // Drop request.
    throw new BadRequestException("Invalid request: Request must contain " +
        PARAMETER_DEVICE_ID);
  }

  // Check that user making requests is non null.
  if (user == null) {
    throw new UnauthorizedException("Invalid credentials");
  }

  try {
    Device device = ofy().load().type(Device.class).id(deviceId).safe();
    // Check that the user trying to unregister the token is the same one that registered it.
    if (!device.getUserId().equals(user.getId())) {
      throw new ForbiddenException("Not authorized to unregister token");
    }

    DeviceStore.unregister(deviceId);
  } catch (NotFoundException e) {
    throw new com.google.api.server.spi.response.NotFoundException("Device ID: " + deviceId +
        " not found");
  }
}
 
开发者ID:google,项目名称:iosched,代码行数:40,代码来源:FcmRegistrationEndpoint.java

示例5: openInput

import com.googlecode.objectify.NotFoundException; //导入依赖的package包/类
@Override
public IndexInput openInput(String name, IOContext context) throws IOException {
    ensureOpen();
	try {
		return new SegmentIndexInput(ofy().load().key(newSegmentKey(name)).safe());
	} catch (NotFoundException e) {
		throw new IOException(name, e);
	}
}
 
开发者ID:UltimaPhoenix,项目名称:luceneappengine,代码行数:10,代码来源:GaeDirectory.java

示例6: get

import com.googlecode.objectify.NotFoundException; //导入依赖的package包/类
@Override
public <T> T get(Key<? extends T> p_arg0) throws NotFoundException
{
  return m_dao.ofy().get( p_arg0 );
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:6,代码来源:DataStore.java


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