Ejemplo n.º 1
0
 private void buildOptions(AbstractMetadataRecord record, StringBuilder options) {
   if (!record.getProperties().isEmpty()) {
     for (Map.Entry<String, String> entry : record.getProperties().entrySet()) {
       addOption(options, entry.getKey(), entry.getValue());
     }
   }
 }
Ejemplo n.º 2
0
  /**
   * Set the "header" values on the specified MetadataRecord. All index file record headers are of
   * the form: recordType|upperFullName|objectID|fullName|nameInSource|parentObjectID The order of
   * the fields in the index file header must also be the order of the arguments in method
   * signature.
   */
  private static void setRecordHeaderValues(
      final AbstractMetadataRecord record,
      final String recordType,
      final String upperName,
      final String objectID,
      final String fullName,
      final String nameInSource,
      final String parentObjectID) {

    record.setRecordType(recordType.toCharArray()[0]);
    record.setUUID(getObjectValue(objectID));
    record.setFullName(fullName);
    record.setNameInSource(getObjectValue(nameInSource));
    record.setParentUUID(getObjectValue(parentObjectID));
  }
Ejemplo n.º 3
0
 /**
  * Return the {@link org.teiid.designer.metadata.runtime.MetadataRecord} instances for specified
  * IEntryResult.
  *
  * @param entryResult
  * @param container Container reference to be set on the record
  */
 public static MetadataRecord getMetadataRecord(
     final IEntryResult queryResult, final EObjectFinder container) {
   MetadataRecord record = getMetadataRecord(queryResult.getWord());
   if (record instanceof AbstractMetadataRecord) {
     ((AbstractMetadataRecord) record).setEObjectFinder(container);
   }
   return record;
 }
Ejemplo n.º 4
0
  /**
   * Set the "footer" values on the specified MetadataRecord. All index file record footers are of
   * the form: modelPath|name|indexVersion The order of the fields in the index file header must
   * also be the order of the arguments in method signature.
   */
  private static void setRecordFooterValues(
      final AbstractMetadataRecord record, final List tokens, int tokenIndex) {
    record.setResourcePath(getOptionalToken(tokens, tokenIndex++));
    record.setName(getOptionalToken(tokens, tokenIndex++));

    String version = getOptionalToken(tokens, tokenIndex++);
    if (version != null && version.length() > 0) {
      if (version.charAt(0) == IndexConstants.RECORD_STRING.INDEX_VERSION_MARKER) {
        version = version.substring(1);
      }
      try {
        record.setIndexVersion(Integer.parseInt(version));
      } catch (NumberFormatException err) {
        // Log error
      }
    }
  }
Ejemplo n.º 5
0
 private void addCommonOptions(StringBuilder sb, AbstractMetadataRecord record) {
   if (record.isUUIDSet()
       && record.getUUID() != null
       && !record.getUUID().startsWith("tid:")) { // $NON-NLS-1$
     addOption(sb, UUID, record.getUUID());
   }
   if (record.getAnnotation() != null) {
     addOption(sb, ANNOTATION, record.getAnnotation());
   }
   if (record.getNameInSource() != null) {
     addOption(sb, NAMEINSOURCE, record.getNameInSource());
   }
 }