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

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

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

origin: cdapio/cdap

private MetadataEntity.Builder appendHelper(MetadataEntity.Builder builder, @Nullable String entityType,
                  String key, String value) {
 if (entityType == null || entityType.isEmpty()) {
  // if a type is not provided then keep appending as type to update the type on every append
  return builder.appendAsType(key, value);
 } else {
  if (entityType.equalsIgnoreCase(key)) {
   // if a type was provided and this key is the type then appendAsType
   return builder.appendAsType(key, value);
  } else {
   return builder.append(key, value);
  }
 }
}
origin: co.cask.cdap/cdap-app-fabric

private MetadataEntity.Builder appendHelper(MetadataEntity.Builder builder, @Nullable String entityType,
                  String key, String value) {
 if (entityType == null || entityType.isEmpty()) {
  // if a type is not provided then keep appending as type to update the type on every append
  return builder.appendAsType(key, value);
 } else {
  if (entityType.equalsIgnoreCase(key)) {
   // if a type was provided and this key is the type then appendAsType
   return builder.appendAsType(key, value);
  } else {
   return builder.append(key, value);
  }
 }
}
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$BuilderappendAsType

Javadoc

Put the given key (case insensitive) with the given value in MetadataEntity.Builder. The returned MetadataEntity type is set to the given key. If an append is required without the type change then #append(String,String) should be used.

Popular methods of MetadataEntity$Builder

  • build
  • append
  • <init>
  • validateHierarchy
  • validateKey

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • Menu (java.awt)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JOptionPane (javax.swing)
  • CodeWhisperer alternatives
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