public boolean delete(GeogitTransaction transaction, Feature f) throws Exception { final WorkingTree workTree = (transaction != null ? transaction.getWorkingTree() : repo.getWorkingTree()); Name name = f.getType().getName(); String localPart = name.getLocalPart(); String id = f.getIdentifier().getID(); boolean existed = workTree.delete(localPart, id); return existed; }
/** Inserts the feature to the index but does not stages it to be committed */ public ObjectId insert(GeogitTransaction transaction, Feature f) throws Exception { final WorkingTree workTree = (transaction != null ? transaction.getWorkingTree() : repo.getWorkingTree()); Name name = f.getType().getName(); String parentPath = name.getLocalPart(); Node ref = workTree.insert(parentPath, f); ObjectId objectId = ref.getObjectId(); return objectId; }
void addShp(VectorDataset data, Repository repo) throws IOException { String name = data.getName(); repo.getWorkingTree() .insert( name, GT.iterator(data.cursor(new Query())), new NullProgressListener(), null, null); data.close(); AddOp add = repo.command(AddOp.class); add.call(); CommitOp commit = repo.command(CommitOp.class); commit.setMessage("initial commit of " + name); commit.call(); }