How to use the ember-flexberry-data/query/condition.And function in ember-flexberry-data

To help you get started, we’ve selected a few ember-flexberry-data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Flexberry / ember-flexberry-designer / addon / routes / fd-diagram-list-form.js View on Github external
objectListViewLimitPredicate() {
    let stage = this.get('currentContext').getCurrentStage();
    let spStage = new SimplePredicate('subsystem.stage', 'eq', stage);

    let iopDiagrams = Ember.A();
    iopDiagrams.pushObject(new IsOfPredicate('fd-dev-uml-ad'));
    iopDiagrams.pushObject(new IsOfPredicate('fd-dev-uml-cad'));
    iopDiagrams.pushObject(new IsOfPredicate('fd-dev-uml-cod'));
    iopDiagrams.pushObject(new IsOfPredicate('fd-dev-uml-dpd'));
    iopDiagrams.pushObject(new IsOfPredicate('fd-dev-uml-sd'));
    iopDiagrams.pushObject(new IsOfPredicate('fd-dev-uml-std'));
    iopDiagrams.pushObject(new IsOfPredicate('fd-dev-uml-ucd'));
    let cpDiagrams = new ComplexPredicate(Condition.Or, ...iopDiagrams);

    return new ComplexPredicate(Condition.And, spStage, cpDiagrams);
  },
});
github Flexberry / ember-flexberry-designer / addon / controllers / fd-setting.js View on Github external
validateData(model) {
    let modelName = model.get('name');

    if (isBlank(modelName)) {
      return reject({ message: this.get('i18n').t('forms.fd-setting.error-message.empty-name').toString() });
    }

    const store = this.get('store');
    let predicate = new ComplexPredicate(Condition.And,
      new SimplePredicate('name', FilterOperator.Eq, modelName),
      new SimplePredicate('configuration', FilterOperator.Eq, model.get('configuration.id')),
      new SimplePredicate('id', FilterOperator.Neq, model.get('id')));

    const builder = new Builder(store)
    .from('fd-dev-stage')
    .selectByProjection('SearchRepObjView')
    .where(predicate);

    return store.queryRecord('fd-dev-stage', builder.build()).then((result) => {
      if (!isNone(result)) {
        return reject({ message: this.get('i18n').t('forms.fd-setting.error-message.exist-stage').toString() });
      }

      if (isBlank(model.get('product'))) {
        model.set('product', transliteration(modelName));
github Flexberry / ember-flexberry-designer / addon / services / fd-current-project-context.js View on Github external
this.set('context.systemPromise', undefined);
    this.set('context.class', undefined);
    this.set('context.classModel', undefined);

    if (this.get('readonlyModeProject')) {
      return;
    }

    let store = this.get('store');
    let modelName = 'fd-dev-system';
    let projectionName = 'SearchSystem';
    let systemName = 'Autogenerated';

    let stagePredicate = new SimplePredicate('stage', FilterOperator.Eq, stage.get('id'));
    let systemNamePredicate = new SimplePredicate('name', FilterOperator.Eq, systemName);
    let predicate = new ComplexPredicate(Condition.And, stagePredicate, systemNamePredicate);

    let builder = new Builder(store)
    .from(modelName)
    .selectByProjection(projectionName)
    .where(predicate);

    let _this = this;
    let promise = new Promise(function(resolve, reject) {
      store.query(modelName, builder.build()).then((result) => {
        if (!result || result.get('length') !== undefined && result.get('length') === 0) {
          store.createRecord(modelName, {
            name: systemName,
            stage: stage
          }).save().then((systemAfterSave) => {
            _this.set('context.system', systemAfterSave.get('id'));
            _this.set('context.systemModel', systemAfterSave);