Example #1
0
 @Override
 public Set<String> entryToObject(TupleInput in) {
   int n = in.readInt();
   Set<String> h = new HashSet<String>(n);
   for (int i = 0; i < n; ++i) h.add(in.readString());
   return h;
 }
Example #2
0
    /**
     * Extract the supplier key from a shipment key/value pair. The supplier key is stored in the
     * shipment key, so the shipment value is not used.
     */
    public boolean createSecondaryKey(
        TupleInput primaryKeyInput, Object valueInput, TupleOutput indexKeyOutput) {

      primaryKeyInput.readString(); // skip the partNumber
      String supplierNumber = primaryKeyInput.readString();
      indexKeyOutput.writeString(supplierNumber);
      return true;
    }
Example #3
0
    /**
     * Create the entity by combining the stored key and data. This "tricky" binding returns the
     * stored data as the entity, but first it sets the transient key fields from the stored key.
     */
    public Object entryToObject(TupleInput keyInput, Object dataInput) {

      String partNumber = keyInput.readString();
      String supplierNumber = keyInput.readString();
      Shipment shipment = (Shipment) dataInput;
      shipment.setKey(partNumber, supplierNumber);
      return shipment;
    }
 @Override
 public List<UUID> entryToObject(TupleInput ti) {
   int size = ti.readShort();
   List<UUID> uuidList = new ArrayList<>(size);
   for (int i = 0; i < size; i++) {
     uuidList.add(new UUID(ti.readLong(), ti.readLong()));
   }
   return uuidList;
 }
Example #5
0
    /**
     * Create the entity by combining the stored key and data. This "tricky" binding returns the
     * stored data as the entity, but first it sets the transient key fields from the stored key.
     */
    public Object entryToObject(TupleInput keyInput, Object dataInput) {

      String number = keyInput.readString();
      Supplier supplier = (Supplier) dataInput;
      supplier.setKey(number);
      return supplier;
    }
Example #6
0
    /**
     * Create the entity by combining the stored key and data. This "tricky" binding returns the
     * stored data as the entity, but first it sets the transient key fields from the stored key.
     */
    public Object entryToObject(TupleInput keyInput, Object dataInput) {

      String number = keyInput.readString();
      Part part = (Part) dataInput;
      part.setKey(number);
      return part;
    }
Example #7
0
    /**
     * Extract the part key from a shipment key/value pair. The part key is stored in the shipment
     * key, so the shipment value is not used.
     */
    public boolean createSecondaryKey(
        TupleInput primaryKeyInput, Object valueInput, TupleOutput indexKeyOutput) {

      String partNumber = primaryKeyInput.readString();
      // don't bother reading the supplierNumber
      indexKeyOutput.writeString(partNumber);
      return true;
    }
Example #8
0
 @Override
 public WebURL entryToObject(TupleInput input) {
   WebURL webURL = new WebURL();
   webURL.setPrimeKey(input.readString());
   webURL.setURL(input.readString());
   webURL.setDocid(input.readInt());
   webURL.setParentDocid(input.readInt());
   webURL.setParentUrl(input.readString());
   webURL.setDepth(input.readShort());
   webURL.setCookie(input.readString());
   webURL.setFormParams(input.readString());
   webURL.setMethod(input.readString());
   return webURL;
 }
Example #9
0
 public BooleanRevision(TupleInput input, BooleanMember primoridalMember) {
   super(input, primoridalMember);
   booleanValue = input.readBoolean();
 }
Example #10
0
    /** Create the key object from the stored key tuple entry. */
    public Object entryToObject(TupleInput input) {

      String number = input.readString();
      return new SupplierKey(number);
    }
 @Override
 protected void readMemberFields(TupleInput input) {
   longValue = input.readLong();
 }
Example #12
0
  @SuppressWarnings("unchecked")
  public ConcurrentSkipListSet<RefexMember<?, ?>> entryToObject(
      TupleInput input, int enclosingConceptNid) {
    int listSize = input.readShort();

    if (listSize == 0) {
      return null;
    }

    ConcurrentSkipListSet<RefexMember<?, ?>> newRefsetMemberList =
        new ConcurrentSkipListSet<>(
            new Comparator<RefexChronicleBI<?>>() {
              @Override
              public int compare(RefexChronicleBI<?> t, RefexChronicleBI<?> t1) {
                return t.getNid() - t1.getNid();
              }
            });

    for (int index = 0; index < listSize; index++) {
      int typeNid = input.readInt();

      input.mark(8);

      int nid = input.readInt();

      input.reset();

      RefexMember<?, ?> refsetMember = (RefexMember<?, ?>) ConceptChronicle.componentsCRHM.get(nid);

      if (refsetMember == null) {
        try {
          refsetMember = factory.create(nid, typeNid, enclosingConceptNid, input);

          if (refsetMember.getTime() != Long.MIN_VALUE) {
            RefexMember<?, ?> oldMember =
                (RefexMember<?, ?>) ConceptChronicle.componentsCRHM.putIfAbsent(nid, refsetMember);

            if (oldMember != null) {
              refsetMember = oldMember;
            }
          }
        } catch (IOException ex) {
          throw new RuntimeException(ex);
        }
      } else {
        try {
          refsetMember.merge(
              factory.create(nid, typeNid, enclosingConceptNid, input),
              new HashSet<ConceptChronicleBI>());
        } catch (IOException ex) {
          throw new RuntimeException(ex);
        }
      }

      if (refsetMember.getTime() != Long.MIN_VALUE) {
        newRefsetMemberList.add(refsetMember);
      }
    }

    return newRefsetMemberList;
  }
Example #13
0
 /** Serializes from a TupleInput after retrieving from storage. */
 public static NameIdPair deserialize(TupleInput buffer) {
   return new NameIdPair(buffer.readString(), buffer.readInt());
 }
Example #14
0
    /** Create the key object from the stored key tuple entry. */
    public Object entryToObject(TupleInput input) {

      String partNumber = input.readString();
      String supplierNumber = input.readString();
      return new ShipmentKey(partNumber, supplierNumber);
    }
Example #15
0
 public Odds read(TupleInput tupleInput) {
   return new Odds(tupleInput.readLong(), tupleInput.readLong(), tupleInput.readLong());
 }
 public IdentifierVersionString(TupleInput input) {
   super(input);
   stringDenotation = input.readString();
 }
  public void unmarshalEntry(TupleInput dataInput) {

    data = dataInput.readString();
    indexKey1 = dataInput.readString();
    indexKey2 = dataInput.readString();
  }
Example #18
0
 /** {@inheritDoc} */
 @Override
 public LogKey entryToObject(TupleInput arg0) {
   final LogKey key = new LogKey(arg0.readBoolean(), arg0.readInt(), arg0.readLong());
   return key;
 }
  public void unmarshalPrimaryKey(TupleInput keyInput) {

    primaryKey = keyInput.readString();
  }
 @Override
 protected void readMemberFields(TupleInput input) {
   c1Nid = input.readInt();
   c2Nid = input.readInt();
 }
 @Override
 protected void readMemberFields(TupleInput input) {
   intValue = input.readInt();
 }
Example #22
0
  public void unmarshalKey(TupleInput keyInput) {

    this.number = keyInput.readString();
  }
  @Override
  public Collection<RefsetMember<?, ?>> entryToObject(TupleInput input) {
    assert enclosingConcept != null;
    int listSize = input.readInt();
    Collection<RefsetMember<?, ?>> newRefsetMemberList;
    HashMap<Integer, RefsetMember<?, ?>> nidToRefsetMemberMap = null;
    if (refsetMemberList != null) {
      newRefsetMemberList = refsetMemberList;
      nidToRefsetMemberMap = new HashMap<Integer, RefsetMember<?, ?>>(listSize);
      for (RefsetMember<?, ?> component : refsetMemberList) {
        nidToRefsetMemberMap.put(component.nid, component);
      }
    } else {
      newRefsetMemberList = new ArrayList<RefsetMember<?, ?>>(listSize);
    }

    for (int index = 0; index < listSize; index++) {
      int typeNid = input.readInt();

      // Can be removed in the future, here strictly for read/write conformance testing.
      try {
        REFSET_TYPES.nidToType(typeNid);
      } catch (IOException e1) {
        AceLog.getAppLog()
            .alertAndLogException(new Exception("For concept: " + enclosingConcept.toString(), e1));
        AceLog.getAppLog().info("List prior to exception: " + newRefsetMemberList);
        return newRefsetMemberList;
      }
      input.mark(8);
      int nid = input.readInt();
      input.reset();
      RefsetMember<?, ?> refsetMember = (RefsetMember<?, ?>) Concept.componentsCRHM.get(nid);
      if (nidToRefsetMemberMap != null && nidToRefsetMemberMap.containsKey(nid)) {
        if (refsetMember == null) {
          refsetMember = nidToRefsetMemberMap.get(nid);
          RefsetMember<?, ?> oldMember =
              (RefsetMember<?, ?>) Concept.componentsCRHM.putIfAbsent(nid, refsetMember);
          if (oldMember != null) {
            refsetMember = oldMember;
            if (nidToRefsetMemberMap != null) {
              nidToRefsetMemberMap.put(nid, refsetMember);
            }
          }
        }
        refsetMember.readComponentFromBdb(input);
      } else {
        try {
          if (refsetMember == null) {
            refsetMember = factory.create(nid, typeNid, enclosingConcept, input);
            if (refsetMember.getTime() != Long.MIN_VALUE) {
              Concept.componentsCRHM.putIfAbsent(nid, refsetMember);
              RefsetMember<?, ?> oldMember =
                  (RefsetMember<?, ?>) Concept.componentsCRHM.putIfAbsent(nid, refsetMember);
              if (oldMember != null) {
                refsetMember = oldMember;
                if (nidToRefsetMemberMap != null) {
                  nidToRefsetMemberMap.put(nid, refsetMember);
                }
              }
            } else {
              AceLog.getAppLog()
                  .warning(
                      "\n########## Suppressing refset member:\n     "
                          + refsetMember
                          + "\n##########");
            }
          } else {
            refsetMember.merge(factory.create(nid, typeNid, enclosingConcept, input));
          }
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        if (refsetMember.getTime() != Long.MIN_VALUE) {
          newRefsetMemberList.add(refsetMember);
        }
      }
    }
    return newRefsetMemberList;
  }