Tabnine Logo
MetadataEntity$Builder.build
Code IndexAdd Tabnine to your IDE (free)

How to use
build
method
in
co.cask.cdap.api.metadata.MetadataEntity$Builder

Best Java code snippets using co.cask.cdap.api.metadata.MetadataEntity$Builder.build (Showing top 20 results out of 315)

origin: caskdata/cdap

private static MetadataEntity fromCliString(String cliString) {
 String[] keyValues = cliString.split(METADATA_ENTITY_PARTS_SEPARATOR);
 int lastKeyValueIndex = keyValues.length - 1;
 MetadataEntity.Builder builder = MetadataEntity.builder();
 String customType = null;
 if (getKeyValue(keyValues[lastKeyValueIndex])[0].equalsIgnoreCase(METADATA_ENTITY_TYPE)) {
  // if a type is specified then store it to call appendAsType later
  customType = getKeyValue(keyValues[lastKeyValueIndex])[1];
  lastKeyValueIndex -= 1;
 }
 for (int i = 0; i <= lastKeyValueIndex; i++) {
  String[] part = getKeyValue(keyValues[i]);
  if (part[0].equals(customType)) {
   builder.appendAsType(part[0], part[1]);
  } else {
   builder.append(part[0], part[1]);
  }
 }
 return builder.build();
}
origin: co.cask.cdap/cdap-cli

private static MetadataEntity fromCliString(String cliString) {
 String[] keyValues = cliString.split(METADATA_ENTITY_PARTS_SEPARATOR);
 int lastKeyValueIndex = keyValues.length - 1;
 MetadataEntity.Builder builder = MetadataEntity.builder();
 String customType = null;
 if (getKeyValue(keyValues[lastKeyValueIndex])[0].equalsIgnoreCase(METADATA_ENTITY_TYPE)) {
  // if a type is specified then store it to call appendAsType later
  customType = getKeyValue(keyValues[lastKeyValueIndex])[1];
  lastKeyValueIndex -= 1;
 }
 for (int i = 0; i <= lastKeyValueIndex; i++) {
  String[] part = getKeyValue(keyValues[i]);
  if (part[0].equals(customType)) {
   builder.appendAsType(part[0], part[1]);
  } else {
   builder.append(part[0], part[1]);
  }
 }
 return builder.build();
}
origin: caskdata/cdap

@Test
public void testSearchOnTypes() throws Exception {
 MetadataStorage mds = getMetadataStorage();
 MetadataEntity myDs = NamespaceId.DEFAULT.dataset("myDs").toMetadataEntity();
 MetadataEntity myField1 = MetadataEntity.builder(myDs).appendAsType("field", "myField1").build();
 MetadataEntity myField2 = MetadataEntity.builder(myDs).appendAsType("field", "myField2").build();
 MetadataRecord record1 = new MetadataRecord(myField1, new Metadata(USER, props("testKey1", "testValue1")));
 MetadataRecord record2 = new MetadataRecord(myField2, new Metadata(USER, props("testKey2", "testValue2")));
 mds.apply(new Update(myField1, record1.getMetadata()));
 mds.apply(new Update(myField2, record2.getMetadata()));
 // Search for it based on value
 assertResults(mds, SearchRequest.of("field:myField1").build(), record1);
 // should return both fields
 assertResults(mds, SearchRequest.of("field:myFie*").build(), record1, record2);
 assertResults(mds, SearchRequest.of("field*").build(), record1, record2);
 // clean up
 mds.batch(ImmutableList.of(new Drop(myField1), new Drop(myField2)));
}
origin: caskdata/cdap

 @Test
 public void testToEntityId() {
  // should be able to get get an EntityId if Metadata belong to a cdap entity id
  DatasetId myDs = NamespaceId.DEFAULT.dataset("myDs");
  MetadataDataset.Record metadata1 = new MetadataDataset.Record(myDs);
  Assert.assertEquals(myDs, metadata1.getEntityId());

  MetadataEntity metadataEntity =
   MetadataEntity.builder(MetadataEntity.ofDataset(NamespaceId.DEFAULT.getEntityName(), "myDs"))
    .appendAsType("field", "myField").build();
  MetadataDataset.Record metadata2 = new MetadataDataset.Record(metadataEntity);
  try {
   metadata2.getEntityId();
   Assert.fail();
  } catch (IllegalArgumentException e) {
   // expected
  }
 }
}
origin: cdapio/cdap

/**
 * Creates a {@link MetadataEntity} representing the given datasetName in the specified namespace.
 *
 * @param namespace the name of the namespace
 * @param datasetName the name of the dataset
 * @return {@link MetadataEntity} representing the dataset name
 * @throws IllegalArgumentException if the key is a CDAP entity and the MetadataEntity is not correct to represent
 * the CDAP entity
 */
public static MetadataEntity ofDataset(String namespace, String datasetName) {
 return builder().append(MetadataEntity.NAMESPACE, namespace)
  .appendAsType(MetadataEntity.DATASET, datasetName).build();
}
origin: co.cask.cdap/cdap-proto

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace).append(MetadataEntity.STREAM, stream)
  .appendAsType(MetadataEntity.VIEW, view)
  .build();
}
origin: co.cask.cdap/cdap-proto

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .appendAsType(MetadataEntity.APPLICATION, application)
  .append(MetadataEntity.VERSION, version)
  .build();
}
origin: cdapio/cdap

/**
 * Creates a {@link MetadataEntity} representing the given namespace.
 *
 * @param namespace the name of the namespace
 * @return {@link MetadataEntity} representing the namespace name
 * @throws IllegalArgumentException if the key is a CDAP entity and the MetadataEntity is not correct to represent
 * the CDAP entity
 */
public static MetadataEntity ofNamespace(String namespace) {
 return builder().appendAsType(MetadataEntity.NAMESPACE, namespace).build();
}
origin: co.cask.cdap/cdap-proto

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .append(MetadataEntity.APPLICATION, application)
  .append(MetadataEntity.VERSION, version).append(MetadataEntity.TYPE, type.getPrettyName())
  .appendAsType(MetadataEntity.PROGRAM, program)
  .build();
}
origin: co.cask.cdap/cdap-proto

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .append(MetadataEntity.APPLICATION, application).append(MetadataEntity.VERSION, version)
  .appendAsType(MetadataEntity.SCHEDULE, schedule)
  .build();
}
origin: co.cask.cdap/cdap-proto

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .append(MetadataEntity.APPLICATION, application).append(MetadataEntity.VERSION, version)
  .append(MetadataEntity.FLOW, flow).appendAsType(MetadataEntity.FLOWLET, flowlet)
  .build();
}
origin: co.cask.cdap/cdap-proto

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .appendAsType(MetadataEntity.ARTIFACT, artifact)
  .append(MetadataEntity.VERSION, version)
  .build();
}
origin: cdapio/cdap

/**
 * Creates a {@link MetadataEntity} representing the given datasetName. To create a {@link MetadataEntity} for a
 * dataset in a specified namespace please use {@link MetadataEntity#ofDataset(String, String)}.
 *
 * @param datasetName the name of the dataset
 * @return {@link MetadataEntity} representing the dataset name
 */
public static MetadataEntity ofDataset(String datasetName) {
 return builder().appendAsType(MetadataEntity.DATASET, datasetName).build();
}
origin: caskdata/cdap

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .appendAsType(MetadataEntity.APPLICATION, application)
  .append(MetadataEntity.VERSION, version)
  .build();
}
origin: caskdata/cdap

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .append(MetadataEntity.APPLICATION, application).append(MetadataEntity.VERSION, version)
  .appendAsType(MetadataEntity.SCHEDULE, schedule)
  .build();
}
origin: caskdata/cdap

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .append(MetadataEntity.APPLICATION, application)
  .append(MetadataEntity.VERSION, version).append(MetadataEntity.TYPE, type.getPrettyName())
  .appendAsType(MetadataEntity.PROGRAM, program)
  .build();
}
origin: caskdata/cdap

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .append(MetadataEntity.APPLICATION, application)
  .append(MetadataEntity.VERSION, version).append(MetadataEntity.TYPE, type.getPrettyName())
  .append(MetadataEntity.PROGRAM, program)
  .appendAsType(MetadataEntity.PROGRAM_RUN, run)
  .build();
}
origin: co.cask.cdap/cdap-proto

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .appendAsType(MetadataEntity.STREAM, stream)
  .build();
}
origin: co.cask.cdap/cdap-proto

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .append(MetadataEntity.APPLICATION, application)
  .append(MetadataEntity.VERSION, version).append(MetadataEntity.TYPE, type.getPrettyName())
  .append(MetadataEntity.PROGRAM, program)
  .appendAsType(MetadataEntity.PROGRAM_RUN, run)
  .build();
}
origin: caskdata/cdap

@Override
public MetadataEntity toMetadataEntity() {
 return MetadataEntity.builder().append(MetadataEntity.NAMESPACE, namespace)
  .appendAsType(MetadataEntity.ARTIFACT, artifact)
  .append(MetadataEntity.VERSION, version)
  .build();
}
co.cask.cdap.api.metadataMetadataEntity$Builderbuild

Javadoc

Builds a MetadataEntity from the builder.

Popular methods of MetadataEntity$Builder

  • appendAsType
  • append
  • <init>
  • validateHierarchy
  • validateKey

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onRequestPermissionsResult (Fragment)
  • getApplicationContext (Context)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now