Exemplo n.º 1
0
  @SuppressWarnings("nls")
  private void readTagData(JSONArray tags) throws JSONException {
    ArrayList<Metadata> metadata = new ArrayList<Metadata>();
    for (int i = 0; i < tags.length(); i++) {
      JSONObject tagObject = tags.getJSONObject(i);
      TagData tagData = tagDataService.getTag(tagObject.getString("name"), TagData.ID);
      if (tagData == null) tagData = new TagData();
      ActFmSyncService.JsonHelper.tagFromJson(tagObject, tagData);
      tagDataService.save(tagData);

      Metadata tagMeta = new Metadata();
      tagMeta.setValue(Metadata.KEY, TagService.KEY);
      tagMeta.setValue(TagService.TAG, tagData.getValue(TagData.NAME));
      tagMeta.setValue(TagService.REMOTE_ID, tagData.getValue(TagData.REMOTE_ID));
      metadata.add(tagMeta);
    }

    metadataService.synchronizeMetadata(
        task.getId(), metadata, MetadataCriteria.withKey(TagService.KEY));
  }
Exemplo n.º 2
0
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setTheme(android.R.style.Theme_Dialog);

      tag = getIntent().getStringExtra(TAG);
      if (tag == null) {
        finish();
        return;
      }
      DependencyInjectionService.getInstance().inject(this);

      TagData tagData = tagDataService.getTag(tag, TagData.MEMBER_COUNT);
      if (tagData != null && tagData.getValue(TagData.MEMBER_COUNT) > 0) {
        DialogUtilities.okDialog(
            this, getString(R.string.actfm_tag_operation_disabled), getCancelListener());
        return;
      }
      showDialog();
    }