Search in sources :

Example 1 with CollectRecord

use of org.openforis.collect.model.CollectRecord in project collect by openforis.

the class RecordDao method load.

public CollectRecord load(CollectSurvey survey, int id, Step step, boolean toBeUpdated) {
    SelectQuery query = selectRecordQuery(id, false, step, null);
    Record r = query.fetchOne();
    return r == null ? null : fromQueryResult(survey, r, toBeUpdated);
}
Also used : SelectQuery(org.jooq.SelectQuery) OfcRecordRecord(org.openforis.collect.persistence.jooq.tables.records.OfcRecordRecord) CollectRecord(org.openforis.collect.model.CollectRecord) OfcRecordDataRecord(org.openforis.collect.persistence.jooq.tables.records.OfcRecordDataRecord) Record(org.jooq.Record)

Example 2 with CollectRecord

use of org.openforis.collect.model.CollectRecord in project collect by openforis.

the class RecordDao method load.

public CollectRecord load(CollectSurvey survey, int id, int workflowSequenceNumber, boolean toBeUpdated) {
    SelectQuery query = selectRecordQuery(id, false, null, workflowSequenceNumber);
    Record r = query.fetchOne();
    return r == null ? null : fromQueryResult(survey, r, toBeUpdated);
}
Also used : SelectQuery(org.jooq.SelectQuery) OfcRecordRecord(org.openforis.collect.persistence.jooq.tables.records.OfcRecordRecord) CollectRecord(org.openforis.collect.model.CollectRecord) OfcRecordDataRecord(org.openforis.collect.persistence.jooq.tables.records.OfcRecordDataRecord) Record(org.jooq.Record)

Example 3 with CollectRecord

use of org.openforis.collect.model.CollectRecord in project collect by openforis.

the class CollectMinCountValidator method evaluate.

@Override
public ValidationResultFlag evaluate(Entity entity) {
    CollectRecord record = (CollectRecord) entity.getRecord();
    ValidationResultFlag resultFlag = super.evaluate(entity);
    // you can approve missing values in entry phase as well
    if (resultFlag == ValidationResultFlag.ERROR) {
        if (record.getStep() == Step.CLEANSING && record.isMissingApproved(entity, getNodeDefinition())) {
            resultFlag = ValidationResultFlag.WARNING;
        }
    }
    return resultFlag;
}
Also used : CollectRecord(org.openforis.collect.model.CollectRecord) ValidationResultFlag(org.openforis.idm.metamodel.validation.ValidationResultFlag)

Example 4 with CollectRecord

use of org.openforis.collect.model.CollectRecord in project collect by openforis.

the class CollectNumberValueUnitValidator method evaluate.

@Override
public ValidationResultFlag evaluate(NumberAttribute<?, ?> attribute) {
    CollectRecord record = (CollectRecord) attribute.getRecord();
    Step step = record.getStep();
    ValidationResultFlag resultFlag = super.evaluate(attribute);
    if (resultFlag == ValidationResultFlag.ERROR && step == Step.ENTRY) {
        Character unitSymbolChar = attribute.getUnitField().getSymbol();
        FieldSymbol unitSymbol = FieldSymbol.valueOf(unitSymbolChar);
        if (unitSymbol != null && unitSymbol.isReasonBlank()) {
            return ValidationResultFlag.WARNING;
        }
    }
    return resultFlag;
}
Also used : CollectRecord(org.openforis.collect.model.CollectRecord) ValidationResultFlag(org.openforis.idm.metamodel.validation.ValidationResultFlag) FieldSymbol(org.openforis.collect.model.FieldSymbol) Step(org.openforis.collect.model.CollectRecord.Step)

Example 5 with CollectRecord

use of org.openforis.collect.model.CollectRecord in project collect by openforis.

the class CollectValidator method validateMaxCount.

@Override
public ValidationResultFlag validateMaxCount(Entity entity, NodeDefinition childDef) {
    ValidationResultFlag flag = super.validateMaxCount(entity, childDef);
    CollectRecord record = (CollectRecord) entity.getRecord();
    record.updateMaxCountsValidationCache(entity, childDef, flag);
    return flag;
}
Also used : CollectRecord(org.openforis.collect.model.CollectRecord) ValidationResultFlag(org.openforis.idm.metamodel.validation.ValidationResultFlag)

Aggregations

CollectRecord (org.openforis.collect.model.CollectRecord)141 Entity (org.openforis.idm.model.Entity)36 Test (org.junit.Test)30 CollectSurvey (org.openforis.collect.model.CollectSurvey)29 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)29 CollectIntegrationTest (org.openforis.collect.CollectIntegrationTest)27 CollectRecordSummary (org.openforis.collect.model.CollectRecordSummary)24 Step (org.openforis.collect.model.CollectRecord.Step)23 User (org.openforis.collect.model.User)19 SessionState (org.openforis.collect.web.session.SessionState)15 RecordFilter (org.openforis.collect.model.RecordFilter)14 Transactional (org.springframework.transaction.annotation.Transactional)14 ParsingError (org.openforis.collect.io.metadata.parsing.ParsingError)12 Secured (org.springframework.security.access.annotation.Secured)12 ArrayList (java.util.ArrayList)11 Date (org.openforis.idm.model.Date)10 GregorianCalendar (java.util.GregorianCalendar)9 Code (org.openforis.idm.model.Code)9 RealAttribute (org.openforis.idm.model.RealAttribute)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9