Tabnine Logo
Metadata.getTags
Code IndexAdd Tabnine to your IDE (free)

How to use
getTags
method
in
co.cask.cdap.api.metadata.Metadata

Best Java code snippets using co.cask.cdap.api.metadata.Metadata.getTags (Showing top 9 results out of 315)

origin: co.cask.cdap/cdap-app-fabric

  metadataAdmin.addProperties(entity, metadata.getProperties());
 if (metadata != null && metadata.getTags() != null && !metadata.getTags().isEmpty()) {
  Set<String> toAdd = metadata.getTags();
  metadataAdmin.addTags(entity, toAdd);
 metadataAdmin.removeProperties(entity, toRemove);
if (metadata != null && metadata.getTags() != null && !metadata.getTags().isEmpty()) {
 Set<String> toRemove = metadata.getTags();
 metadataAdmin.removeTags(entity, toRemove);
origin: cdapio/cdap

private int addAllSystemMetadata(Set<String> allMetadata) {
 for (AuditMessage auditMessage : getMetadataUpdateMessages()) {
  AuditPayload payload = auditMessage.getPayload();
  Assert.assertTrue(payload instanceof MetadataPayload);
  MetadataPayload metadataPayload = (MetadataPayload) payload;
  Map<MetadataScope, Metadata> additions = metadataPayload.getAdditions();
  if (additions.containsKey(MetadataScope.SYSTEM)) {
   allMetadata.addAll(additions.get(MetadataScope.SYSTEM).getProperties().keySet());
   allMetadata.addAll(additions.get(MetadataScope.SYSTEM).getTags());
  }
  Map<MetadataScope, Metadata> deletions = metadataPayload.getDeletions();
  if (deletions.containsKey(MetadataScope.SYSTEM)) {
   allMetadata.addAll(deletions.get(MetadataScope.SYSTEM).getProperties().keySet());
   allMetadata.addAll(deletions.get(MetadataScope.SYSTEM).getTags());
  }
 }
 return allMetadata.size();
}
origin: co.cask.cdap/hydrator-test

case PUT:
 context.addTags(curOperation.getEntity(), curOperation.getMetadata().getTags());
 context.addProperties(curOperation.getEntity(), curOperation.getMetadata().getProperties());
 break;
           curOperation.getMetadata().getTags().toArray(new String[0]));
 context.removeProperties(curOperation.getEntity(),
              curOperation.getMetadata().getProperties().keySet().toArray(new String[0]));
origin: cdapio/cdap

Metadata metadata = null;
for (Map.Entry<MetadataScope, co.cask.cdap.api.metadata.Metadata> entry : record.getMetadata().entrySet()) {
 Metadata toAdd = new Metadata(entry.getKey(), entry.getValue().getTags(), entry.getValue().getProperties());
 metadata = metadata == null ? toAdd : mergeDisjointMetadata(metadata, toAdd);
origin: cdapio/cdap

/************************************************* PUT ***********************************************************/
@PUT
@Path("metadata/{dataset}/tags")
public void addTag(HttpServiceRequest request, HttpServiceResponder responder,
          @PathParam("dataset") String dataset) {
 String tag = StandardCharsets.UTF_8.decode(request.getContent()).toString();
 getContext().addTags(MetadataEntity.ofDataset(getContext().getNamespace(), dataset), tag);
 // wait till change is recorded to store
 try {
  Tasks.waitFor(true, () -> {
   Map<MetadataScope, Metadata> metadata2 =
    getContext().getMetadata(MetadataEntity.ofDataset(getContext().getNamespace(), dataset));
   return metadata2.get(MetadataScope.USER).getTags().contains(tag);
  }, 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS);
 } catch (Exception e) {
  responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR.code());
 }
 responder.sendStatus(HttpResponseStatus.OK.code());
}
origin: cdapio/cdap

/************************************************ DELETE *********************************************************/
@DELETE
@Path("metadata/{dataset}/tags/{tag}")
public void removeTag(HttpServiceRequest request, HttpServiceResponder responder,
           @PathParam("dataset") String dataset, @PathParam("tag") String tag) {
 getContext().removeTags(MetadataEntity.ofDataset(getContext().getNamespace(), dataset), tag);
 // wait till change is recorded to store
 try {
  Tasks.waitFor(true, () -> {
   Map<MetadataScope, Metadata> metadata2 =
    getContext().getMetadata(MetadataEntity.ofDataset(getContext().getNamespace(), dataset));
   return !metadata2.get(MetadataScope.USER).getTags().contains(tag);
  }, 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS);
 } catch (Exception e) {
  responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR.code());
 }
 responder.sendStatus(HttpResponseStatus.OK.code());
}
origin: cdapio/cdap

 @DELETE
 @Path("metadata/{dataset}")
 public void removeMetadata(HttpServiceRequest request, HttpServiceResponder responder,
               @PathParam("dataset") String dataset) {
  getContext().removeMetadata(MetadataEntity.ofDataset(getContext().getNamespace(), dataset));
  // wait till change is recorded to store
  try {
   Tasks.waitFor(true, () -> {
    Map<MetadataScope, Metadata> metadata2 =
     getContext().getMetadata(MetadataEntity.ofDataset(getContext().getNamespace(), dataset));
    return metadata2.get(MetadataScope.USER).getProperties().isEmpty() && metadata2.get(MetadataScope.USER)
     .getTags().isEmpty();
   }, 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS);
  } catch (Exception e) {
   responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR.code());
  }
  responder.sendStatus(HttpResponseStatus.OK.code());
 }
}
origin: cdapio/cdap

@DELETE
@Path("metadata/{dataset}/tags")
public void removeAllTags(HttpServiceRequest request, HttpServiceResponder responder,
             @PathParam("dataset") String dataset) {
 getContext().removeTags(MetadataEntity.ofDataset(getContext().getNamespace(), dataset));
 // wait till change is recorded to store
 try {
  Tasks.waitFor(true, () -> {
   Map<MetadataScope, Metadata> metadata2 =
    getContext().getMetadata(MetadataEntity.ofDataset(getContext().getNamespace(), dataset));
   return metadata2.get(MetadataScope.USER).getTags().isEmpty();
  }, 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS);
 } catch (Exception e) {
  responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR.code());
 }
 responder.sendStatus(HttpResponseStatus.OK.code());
}
origin: cdapio/cdap

Assert.assertTrue(scopeMetadata.containsKey(MetadataScope.USER));
Assert.assertFalse(scopeMetadata.get(MetadataScope.SYSTEM).getProperties().isEmpty());
Assert.assertFalse(scopeMetadata.get(MetadataScope.SYSTEM).getTags().isEmpty());
Assert.assertTrue(scopeMetadata.get(MetadataScope.SYSTEM).getProperties().containsKey("entity-name"));
Assert.assertEquals(AppWithMetadataPrograms.METADATA_SERVICE_DATASET,
          scopeMetadata.get(MetadataScope.SYSTEM).getProperties().get("entity-name"));
Assert.assertTrue(scopeMetadata.get(MetadataScope.SYSTEM).getTags()
          .containsAll(Arrays.asList("explore", "batch")));
Assert.assertFalse(scopeMetadata.get(MetadataScope.USER).getTags().isEmpty());
Assert.assertTrue(scopeMetadata.get(MetadataScope.USER).getTags().containsAll(Arrays.asList("tag1", "tag2")));
Assert.assertTrue(scopeMetadata.get(MetadataScope.USER).getProperties().containsKey("k1"));
Assert.assertTrue(scopeMetadata.get(MetadataScope.USER).getProperties().containsKey("k2"));
 AppWithMetadataPrograms.METADATA_SERVICE_DATASET);
scopeMetadata = GSON.fromJson(result, MAP_METADATASCOPE_METADATA_TYPE);
Assert.assertEquals(1, scopeMetadata.get(MetadataScope.USER).getTags().size());
Assert.assertTrue(scopeMetadata.get(MetadataScope.USER).getTags().contains("tag2"));
Assert.assertEquals(1, scopeMetadata.get(MetadataScope.USER).getProperties().size());
Assert.assertTrue(scopeMetadata.get(MetadataScope.USER).getProperties().containsKey("k2"));
 AppWithMetadataPrograms.METADATA_SERVICE_DATASET);
scopeMetadata = GSON.fromJson(result, MAP_METADATASCOPE_METADATA_TYPE);
Assert.assertTrue(scopeMetadata.get(MetadataScope.USER).getTags().isEmpty());
Assert.assertFalse(scopeMetadata.get(MetadataScope.USER).getProperties().isEmpty());
 AppWithMetadataPrograms.METADATA_SERVICE_DATASET);
scopeMetadata = GSON.fromJson(result, MAP_METADATASCOPE_METADATA_TYPE);
Assert.assertFalse(scopeMetadata.get(MetadataScope.USER).getTags().isEmpty());
co.cask.cdap.api.metadataMetadatagetTags

Popular methods of Metadata

  • getProperties
  • <init>

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Sublime Text plugins
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