本文整理汇总了Java中jetbrains.exodus.entitystore.StoreTransaction类的典型用法代码示例。如果您正苦于以下问题:Java StoreTransaction类的具体用法?Java StoreTransaction怎么用?Java StoreTransaction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StoreTransaction类属于jetbrains.exodus.entitystore包,在下文中一共展示了StoreTransaction类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteLinks
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
private static void deleteLinks(StoreTransaction txn, Entity mainEntity) {
Set<String> names = new HashSet<>(3);
names.add(LINK_VARIABLE);
names.add(LINK_FIELD_ACCESS);
names.add(LINK_METHOD_CALL);
// for (Entity entity : mainEntity.getLinks(LINK_REV_CLASS_REFERENCES)) {
// Entity classEntity = entity.getLink(LINK_CLASS);
// if (nonNull(classEntity)) {
// // reload
// classEntity.deleteLink(LINK_CLASS_REFERENCES, entity);
// }
// }
for (Entity entity : mainEntity.getLinks(names)) {
entity.delete();
}
for (String name : names) {
mainEntity.deleteLinks(name);
}
// mainEntity.deleteLinks(LINK_REV_CLASS_REFERENCES);
}
示例2: addClassReference
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
private static void addClassReference(
StoreTransaction txn,
Entity mainEntity,
Map<String, ClassIndex> classIndex,
Entity entity,
String fqcn) {
if (isNull(fqcn)) {
return;
}
classIndex.computeIfPresent(
fqcn,
(key, index) -> {
try {
EntityId entityId = index.getEntityId();
if (nonNull(entityId)) {
Entity classEntity = txn.getEntity(entityId);
classEntity.addLink(LINK_CLASS_REFERENCES, entity);
entity.addLink(LINK_CLASS, classEntity);
mainEntity.addLink(LINK_REV_CLASS_REFERENCES, entity);
}
} catch (Exception e) {
log.warn(e.getMessage());
}
return index;
});
}
示例3: store
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
@Override
public void store(StoreTransaction txn, Entity entity) {
entity.setProperty("filePath", this.filePath);
if (isNull(this.packageName)) {
entity.setProperty("packageName", "");
} else {
entity.setProperty("packageName", this.packageName);
}
entity.setProperty("fqcn", this.getFQCN());
}
示例4: store
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
@Override
public void store(StoreTransaction txn, Entity entity) {
entity.setProperty("declaration", this.declaration);
entity.setProperty("name", this.name);
if (isNull(this.filePath)) {
// use test only
entity.setProperty("filePath", "");
} else {
entity.setProperty("filePath", this.filePath);
}
entity.setProperty("isAnnotation", this.isAnnotation);
entity.setProperty("isInterface", this.isInterface);
entity.setProperty("functional", this.functional);
}
示例5: store
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
@Override
public void store(StoreTransaction txn, Entity entity) {
entity.setProperty("name", name);
}
示例6: store
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
@Override
public void store(StoreTransaction txn, Entity entity) {
long now = Instant.now().getEpochSecond();
entity.setProperty("createdAt", now);
entity.setProperty("result", this.success);
entity.setProperty("problems", this.diagnostics.size());
for (Diagnostic<? extends JavaFileObject> diagnostic : this.diagnostics) {
String kind = diagnostic.getKind().toString();
long line = diagnostic.getLineNumber();
long column = diagnostic.getColumnNumber();
String message = diagnostic.getMessage(null);
if (isNull(message)) {
message = "";
}
JavaFileObject fileObject = diagnostic.getSource();
String path = null;
if (fileObject != null) {
final URI uri = fileObject.toUri();
final File file = new File(uri);
try {
path = file.getCanonicalPath();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
String code = diagnostic.getCode();
Entity subEntity = txn.newEntity(CompileResult.DIAGNOSTIC_ENTITY_TYPE);
subEntity.setProperty("kind", kind);
subEntity.setProperty("line", line);
subEntity.setProperty("column", column);
subEntity.setProperty("message", message);
if (nonNull(path)) {
subEntity.setProperty("path", path);
}
if (nonNull(code)) {
subEntity.setProperty("code", code);
}
entity.addLink("diagnostic", entity);
}
}
示例7: execute
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
public <R> boolean execute(Function<StoreTransaction, Boolean> fn) {
return this.entityStore.computeInTransaction(fn::apply);
}
示例8: computeInReadonly
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
public <R> R computeInReadonly(Function<StoreTransaction, R> fn) {
return this.entityStore.computeInReadonlyTransaction(fn::apply);
}
示例9: getTransaction
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
private StoreTransaction getTransaction() {
if(!collectingTransaction.isPresent())
collectingTransaction = Optional.of(occStore.beginTransaction());
return collectingTransaction.get();
}
示例10: store
import jetbrains.exodus.entitystore.StoreTransaction; //导入依赖的package包/类
void store(StoreTransaction txn, Entity mainEntity);