Ejemplo n.º 1
0
 @Nullable
 public Integer getCurrentNodeVersion(long receiverId, long senderId, long nidWithoutVersion)
     throws NodeNotFoundException {
   final NodeSerie nodeSerie =
       this.nodes
           .getByUserId(receiverId)
           .getOidToRemovedEmptyAndAliveSeries()
           .get(nidWithoutVersion);
   if (nodeSerie == null) {
     throw new NodeNotFoundException("Node not found");
   }
   if (nodeSerie.hasBeenDeleted() || nodeSerie.hasNoVersion()) {
     return null;
   }
   return nodeSerie.getCurrentVersion();
 }
Ejemplo n.º 2
0
 @Nullable
 public NidVer getLatestVersionBeforeDeletion(
     long receiverId, long senderId, long nidWithoutVersion) throws NodeNotFoundException {
   final NodeSerie nodeSerie =
       this.nodes
           .getByUserId(receiverId)
           .getOidToRemovedEmptyAndAliveSeries()
           .get(nidWithoutVersion);
   if (nodeSerie == null) {
     throw new NodeNotFoundException("Node not found");
   }
   if (nodeSerie.hasNoVersion()) {
     throw new ExpectableException("This shoud never happen");
   }
   if (!nodeSerie.hasBeenDeleted()) {
     return null;
   }
   return new NidVer(nidWithoutVersion, nodeSerie.getLatestVersionBeforeDeletion());
 }