Codota Logo
ObjectifyService.ofy
Code IndexAdd Codota to your IDE (free)

How to use
ofy
method
in
com.googlecode.objectify.ObjectifyService

Best Java code snippets using com.googlecode.objectify.ObjectifyService.ofy (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: objectify/objectify

/**
 * Create a Ref based on the key
 */
public LiveRef(Key<T> key) {
  this(key, ObjectifyService.ofy());
}
origin: TEAMMATES/teammates

protected Objectify ofy() {
  return ObjectifyService.ofy();
}
origin: objectify/objectify

/**
 * Get the current objectify instance associated with this ref
 */
private Objectify ofy() {
  // If we have an expired transaction context, we need a new context
  if (ofy == null || (ofy.getTransaction() != null && !ofy.getTransaction().isActive()))
    ofy = ObjectifyService.ofy();
  return ofy;
}
origin: TEAMMATES/teammates

  @Override
  public String load(String courseId) {
    List<Instructor> instructors =
        ofy().load().type(Instructor.class).filter("courseId =", courseId).list();
    for (Instructor instructor : instructors) {
      if (StringHelper.isEmpty(instructor.getGoogleId())) {
        continue;
      }
      Account account = ofy().load().key(Key.create(Account.class, instructor.getGoogleId())).now();
      if (account != null && !StringHelper.isEmpty(account.getInstitute())) {
        return account.getInstitute();
      }
    }
    return UNKNOWN_INSTITUTE;
  }
});
origin: com.googlecode.luceneappengine/luceneappengine

  @Override
  public Void run() {
    deleteSegment(ofy(), name);
    return null;
  }
});
origin: instacount/appengine-counter

@VisibleForTesting
protected boolean isParentTransactionActive()
{
  return ObjectifyService.ofy().getTransaction() == null ? false
    : ObjectifyService.ofy().getTransaction().isActive();
}
origin: com.googlecode.luceneappengine/luceneappengine

/**
 * Returns every available indexes created into your GAE application.
 * With {@link LuceneIndex} you can build {@link GaeDirectory} 
 * using constructor {@link GaeDirectory#GaeDirectory(LuceneIndex)}.
 * @return A list of available indexes
 */
public static List<LuceneIndex> getAvailableIndexes() {
  return ofy().load().type(LuceneIndex.class).list();
}
/**
origin: com.googlecode.luceneappengine/luceneappengine

public void flush() throws IOException {
  segment.lastModified = System.currentTimeMillis();
  writer.flush();
  hunk.bytes = writer.getBytes();
  ofy().save().entity(segment);
  save(hunk);
  ofy().flush();
  PendingFutures.completeAllPendingFutures();
  /* nothing to do */
}
/*
origin: com.threewks.thundr/thundr-gae

@Override
public JobStatus getJobStatus(UUID jobStatus) {
  return ofy().load().type(JobStatus.class).id(jobStatus.toString()).now();
}
origin: com.googlecode.luceneappengine/luceneappengine

  @Override
  public T run() {
    T t = ofy().load().key(key).now();
    if(t == null) {
      t = builder.newInstance(key);
      ofy().save().entity(t).now();
    }
    return t;
  }
});
origin: com.googlecode.luceneappengine/luceneappengine

@Override
public long fileLength(String name) throws IOException {
  final Segment bigTableIndexFile = ofy().load().key(newSegmentKey(name)).now();
  return bigTableIndexFile.length;
}
/*
origin: com.googlecode.luceneappengine/luceneappengine

@Override
public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException {
  final String tempName = prefix + "_" + UUID.randomUUID().toString() + "_" + suffix;
  ensureOpen();
  final Objectify begin = ofy();
  Segment segment = begin.load().key(newSegmentKey(tempName)).now();
  if(segment == null) {
    segment = newSegment(tempName);
  }
  return new SegmentIndexOutput(segment);
}
origin: com.threewks.thundr/thundr-gae

protected List<E> loadInternal(Iterable<Key<E>> keys) {
  if (Expressive.isEmpty(keys)) {
    return Collections.<E> emptyList();
  }
  Map<Key<E>, E> results = ofy().load().keys(keys);
  return Expressive.Transformers.transformAllUsing(Expressive.Transformers.usingLookup(results)).from(keys);
}
origin: com.googlecode.luceneappengine/luceneappengine

@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);
  }
}
/*
origin: instacount/appengine-counter

  @Override
  public void vrun()
  {
    // Do something else as part of the TX.
    final Key<CounterShardData> counterShardDataKey = CounterShardData.key(
      CounterData.key(UUID.randomUUID().toString()), 0);
    ObjectifyService.ofy().save().entity(counterShardDataKey);
    // The actual test.
    singleShardShardedCounterService.increment(counterName, 10L);
    throw new RuntimeException("Abort the Transaction!");
  }
});
origin: instacount/appengine-counter

  @Override
  public void vrun()
  {
    // Do something else as part of the TX.
    final Key<CounterShardData> counterShardDataKey = CounterShardData.key(
      CounterData.key(UUID.randomUUID().toString()), 0);
    ObjectifyService.ofy().save().entity(counterShardDataKey);
    // The actual test.
    singleShardShardedCounterService.increment(counterName, 10L);
    throw new RuntimeException("Abort the Transaction!");
  }
});
origin: com.googlecode.luceneappengine/luceneappengine

  @Override
  public Void run() {
    Objectify objectify = ofy();
    for(String name : listAll())
      deleteSegment(objectify, name);
    objectify.delete().key(indexKey);
    objectify.delete().entities(((GaeLockFactory)lockFactory).getLocks(GaeDirectory.this));
    return null;
  }
});
origin: com.googlecode.luceneappengine/luceneappengine

@Override
public IndexOutput createOutput(String name, IOContext context) throws IOException {
  ensureOpen();
  final Objectify begin = ofy();
  Segment segment = begin.load().key(newSegmentKey(name)).now();
  if(segment == null) {
    segment = newSegment(name);
  }
  return new SegmentIndexOutput(segment);
}
origin: com.googlecode.luceneappengine/luceneappengine

@Override
public void deleteFile(String name) {
  final Objectify objectify = ofy();
  final Segment segment = objectify.load().key(newSegmentKey(name)).now();
  
  final long hunkCount = segment.hunkCount;
  for (int i = 1; i <= hunkCount; i++) {
    objectify.delete().key(newSegmentHunkKey(name, i));
  }
  objectify.delete().key(newSegmentKey(name));
}
@Override
origin: instacount/appengine-counter

@Test(expected = RuntimeException.class)
public void testDecrement_CounterIsBeingDeleted() throws InterruptedException
{
  // Store this in the Datastore to trigger the exception below...
  CounterData counterData = new CounterData(TEST_COUNTER1, 1);
  counterData.setCounterStatus(CounterStatus.DELETING);
  ObjectifyService.ofy().save().entity(counterData).now();
  shardedCounterService.decrement(TEST_COUNTER1, 1);
}
com.googlecode.objectifyObjectifyServiceofy

Javadoc

The method to call at any time to get the current Objectify, which may change depending on txn context

Popular methods of ObjectifyService

  • begin
  • factory
    Call this to get the instance
  • run
    Runs one unit of work, making the root Objectify context available. This does not start a transactio
  • register
  • init
  • reset

Popular in Java

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • getApplicationContext (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Collectors (java.util.stream)
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now