@Override public void forEach(Visitor<E> visitor) { forEach(ids(), visitor); }
@Override public void forEach(Visitor<E> visitor) { forEach(ids(), visitor); }
@Override public void forEach(Visitor<E> visitor) { forEach(ids(), visitor); }
@Override public void print() { try { // READ LOCK locker.globalReadLock(); System.out.println("*** Table " + name() + " ***"); for (long id : ids()) { E entity = get_(id); System.out.println(entity.toString()); } } finally { // READ UNLOCK locker.globalReadUnlock(); } }
@Override public void print() { try { // READ LOCK locker.globalReadLock(); System.out.println("*** Table " + name() + " ***"); for (long id : ids()) { E entity = get_(id); System.out.println(entity.toString()); } } finally { // READ UNLOCK locker.globalReadUnlock(); } }
@Override public void print() { try { // READ LOCK locker.globalReadLock(); System.out.println("*** Table " + name() + " ***"); for (long id : ids()) { E entity = get_(id); System.out.println(entity.toString()); } } finally { // READ UNLOCK locker.globalReadUnlock(); } }
@Override public void clear() { try { // WRITE LOCK locker.globalWriteLock(); // RUN INSIDE TRANSACTION DatastoreTransaction tx = getTransaction(); long[] allIds = ids(); for (long id : allIds) { deleteInTx(tx, id); } // FINISH INSIDE TRANSACTION finishTransaction(tx); } finally { // WRITE UNLOCK locker.globalWriteUnlock(); } }
@Override public void clear() { try { // WRITE LOCK locker.globalWriteLock(); // RUN INSIDE TRANSACTION DatastoreTransaction tx = getTransaction(); long[] allIds = ids(); for (long id : allIds) { deleteInTx(tx, id); } // FINISH INSIDE TRANSACTION finishTransaction(tx); } finally { // WRITE UNLOCK locker.globalWriteUnlock(); } }
@Override public void clear() { try { // WRITE LOCK locker.globalWriteLock(); // RUN INSIDE TRANSACTION DatastoreTransaction tx = getTransaction(); long[] allIds = ids(); for (long id : allIds) { deleteInTx(tx, id); } // FINISH INSIDE TRANSACTION finishTransaction(tx); } finally { // WRITE UNLOCK locker.globalWriteUnlock(); } }
@SuppressWarnings("unchecked") private <T> IndexerImpl<E, T> complexIndex(Object[] columns, final Mapper<E, ?> mapper) { Index index = makeIndex(); ComplexIndex<E> complexIndex = new ComplexIndexImpl<E>((Mapper<E, Object>) mapper, index); for (Object col : columns) { String colName = jokerator.decode(col); prop(colName).addComplexIndex(complexIndex); } allComplexIndices = U.expand(allComplexIndices, complexIndex); E entity = newEntity(); for (long id : ids()) { get_(id, entity); complexIndex.add(entity, id); } return new IndexerImpl<E, T>(complexIndex, index); }
@SuppressWarnings("unchecked") private <T> IndexerImpl<E, T> complexIndex(Object[] columns, final Mapper<E, ?> mapper) { Index index = makeIndex(); ComplexIndex<E> complexIndex = new ComplexIndexImpl<E>((Mapper<E, Object>) mapper, index); for (Object col : columns) { String colName = jokerator.decode(col); prop(colName).addComplexIndex(complexIndex); } allComplexIndices = U.expand(allComplexIndices, complexIndex); E entity = newEntity(); for (long id : ids()) { get_(id, entity); complexIndex.add(entity, id); } return new IndexerImpl<E, T>(complexIndex, index); }
@SuppressWarnings("unchecked") private <T> IndexerImpl<E, T> complexIndex(Object[] columns, final Mapper<E, ?> mapper) { Index index = makeIndex(); ComplexIndex<E> complexIndex = new ComplexIndexImpl<E>((Mapper<E, Object>) mapper, index); for (Object col : columns) { String colName = jokerator.decode(col); prop(colName).addComplexIndex(complexIndex); } allComplexIndices = U.expand(allComplexIndices, complexIndex); E entity = newEntity(); for (long id : ids()) { get_(id, entity); complexIndex.add(entity, id); } return new IndexerImpl<E, T>(complexIndex, index); }
@SuppressWarnings("unchecked") @Override public <T> void createIndexOnNamed(String propertyName, Transformer<T> transformer) { try { // WRITE LOCK locker.globalWriteLock(); PropertyInfo prop = prop(propertyName); Index oldIndex = prop.getIndex(); prop.setIndex(null); // temporary set to null if (oldIndex != null) { oldIndex.dispose(); } Transformer<Object> tr = (Transformer<Object>) transformer; prop.setTransformer(tr); Index index = makeIndex(); prop.setIndex(index); long[] idss = ids(); for (long id : idss) { Object value = read(id, propertyName); value = tr.transform(value); index.add(value, id); } } finally { // WRITE UNLOCK locker.globalWriteUnlock(); } }
@SuppressWarnings("unchecked") @Override public <T> void createIndexOnNamed(String propertyName, Transformer<T> transformer) { try { // WRITE LOCK locker.globalWriteLock(); PropertyInfo prop = prop(propertyName); Index oldIndex = prop.getIndex(); prop.setIndex(null); // temporary set to null if (oldIndex != null) { oldIndex.dispose(); } Transformer<Object> tr = (Transformer<Object>) transformer; prop.setTransformer(tr); Index index = makeIndex(); prop.setIndex(index); long[] idss = ids(); for (long id : idss) { Object value = read(id, propertyName); value = tr.transform(value); index.add(value, id); } } finally { // WRITE UNLOCK locker.globalWriteUnlock(); } }
@SuppressWarnings("unchecked") @Override public <T> void createIndexOnNamed(String propertyName, Transformer<T> transformer) { try { // WRITE LOCK locker.globalWriteLock(); PropertyInfo prop = prop(propertyName); Index oldIndex = prop.getIndex(); prop.setIndex(null); // temporary set to null if (oldIndex != null) { oldIndex.dispose(); } Transformer<Object> tr = (Transformer<Object>) transformer; prop.setTransformer(tr); Index index = makeIndex(); prop.setIndex(index); long[] idss = ids(); for (long id : idss) { Object value = read(id, propertyName); value = tr.transform(value); index.add(value, id); } } finally { // WRITE UNLOCK locker.globalWriteUnlock(); } }