Skip to content

Commit 3105694

Browse files
committed
(evol) Ajout tag typeproc pour récupération type de procédure (basé sur NOMPROC ou TYPEPROC)
1 parent 6f80308 commit 3105694

5 files changed

Lines changed: 43 additions & 5 deletions

File tree

validator-plugin-cnig/src/main/java/fr/ign/validator/cnig/process/DocUrbaPostProcess.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.File;
44

5+
import org.apache.commons.lang.StringUtils;
56
import org.apache.logging.log4j.LogManager;
67
import org.apache.logging.log4j.Logger;
78
import org.apache.logging.log4j.Marker;
@@ -34,6 +35,10 @@ public class DocUrbaPostProcess implements ValidatorListener {
3435
* Tag to store TYPEREF for the document
3536
*/
3637
private static final String TAG_TYPEREF = "typeref";
38+
/**
39+
* Tag to store TYPEPROC for the document
40+
*/
41+
private static final String TAG_TYPEPROC = "typeproc";
3742

3843
@Override
3944
public void beforeMatching(Context context, Document document) throws Exception {
@@ -81,12 +86,16 @@ public void afterValidate(Context context, Document document) throws Exception {
8186
}
8287

8388
/*
84-
* Add idurba and typeref to document tags.
89+
* Add idurba, typeref and typeproc to document tags.
8590
*/
8691
log.info(MARKER, "Found idurba={} in filtered DOC_URBA.", result.idurba);
8792
document.setTag(TAG_IDURBA, result.idurba);
8893
log.info(MARKER, "Found typeref={} in filtered DOC_URBA.", result.typeref);
8994
document.setTag(TAG_TYPEREF, result.typeref);
95+
if (!StringUtils.isEmpty(result.typeproc)) {
96+
log.info(MARKER, "Found typeproc={} in filtered DOC_URBA.", result.typeproc);
97+
document.setTag(TAG_TYPEPROC, result.typeproc);
98+
}
9099

91100
log.info(
92101
MARKER,

validator-plugin-cnig/src/main/java/fr/ign/validator/cnig/tools/DocUrbaFilter.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
/**
2121
*
2222
* Filter table DOC_URBA to keep rows with the expected IDURBA and outputs the
23-
* number of rows, idurba and typeref (cadastral reference) if available.
23+
* number of rows, idurba, typeref (cadastral reference) and typeproc
24+
* (TYPEPROC or NOMPROC column) if available.
2425
*
2526
* @author MBorne
2627
*
@@ -34,6 +35,7 @@ public class Result {
3435
public int count = 0;
3536
public String idurba;
3637
public String typeref = DEFAULT_TYPEREF;
38+
public String typeproc;
3739
}
3840

3941
/**
@@ -83,6 +85,16 @@ public Result process(File docUrbaFile) {
8385
log.warn(MARKER, "TYPEREF not found in DOC_URBA");
8486
}
8587

88+
int indexTypeproc = reader.findColumn("TYPEPROC");
89+
if (indexTypeproc < 0) {
90+
log.warn(MARKER, "TYPEPROC not found in DOC_URBA");
91+
}
92+
93+
int indexNomproc = reader.findColumn("NOMPROC");
94+
if (indexNomproc < 0) {
95+
log.warn(MARKER, "NOMPROC not found in DOC_URBA");
96+
}
97+
8698
/*
8799
* Create writer for filtered file
88100
*/
@@ -126,6 +138,20 @@ public Result process(File docUrbaFile) {
126138
}
127139
}
128140

141+
if (indexTypeproc >= 0) {
142+
String typeproc = row[indexTypeproc];
143+
log.info(MARKER, "Found TYPEPROC={} for IDURBA={}", typeproc, idurba);
144+
if (!StringUtils.isEmpty(typeproc)) {
145+
result.typeproc = typeproc.trim();
146+
}
147+
} else if (indexNomproc >= 0) {
148+
String nomproc = row[indexNomproc];
149+
log.info(MARKER, "Found NOMPROC={} for IDURBA={}", nomproc, idurba);
150+
if (!StringUtils.isEmpty(nomproc)) {
151+
result.typeproc = nomproc.trim();
152+
}
153+
}
154+
129155
printer.printRecord(row);
130156
}
131157

validator-plugin-cnig/src/test/resources/documents-expected/19182_CC_20150517/document-info.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"documentExtent" : [ 1.3550602, 45.2199213, 1.4226516, 45.2535966 ],
9494
"tags" : {
9595
"idurba" : "19182_CC_20150517",
96-
"typeref" : "04"
96+
"typeref" : "04",
97+
"typeproc" : "MS"
9798
},
9899
"metadata" : {
99100
"fileIdentifier" : "fr-000019182-CC20150517",

validator-plugin-cnig/src/test/resources/documents-expected/200078244_SCOT_20180218/document-info.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
"documentExtent" : [ 2.4591245, 49.6799345, 3.2027693, 50.0784749 ],
8989
"tags" : {
9090
"idurba" : "200078244_SCOT_20180218",
91-
"typeref" : "01"
91+
"typeref" : "01",
92+
"typeproc" : "01"
9293
},
9394
"metadata" : {
9495
"fileIdentifier" : "fr-200078244-scot20180218",

validator-plugin-cnig/src/test/resources/documents-expected/30014_PLU_20171013/document-info.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@
220220
"documentExtent" : [ 4.3387357, 43.9760147, 4.3986027, 44.0207913 ],
221221
"tags" : {
222222
"idurba" : "30014_PLU_20171013",
223-
"typeref" : "01"
223+
"typeref" : "01",
224+
"typeproc" : "R"
224225
},
225226
"metadata" : {
226227
"fileIdentifier" : "fr-000030014-PLU20171013",

0 commit comments

Comments
 (0)