Skip to content

Commit

Permalink
ajout du pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe.demanget committed Oct 11, 2013
1 parent 43107cb commit 4c73ce9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions doc/scrap.jpage
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"sdfsdfsdfsdffstestsdfsfsdfdsf".matches(".*test.*")(boolean) true

(boolean) false
11 changes: 7 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.7</source>
<target>1.5</target>
</configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/*Point*.java</exclude>
</excludes>
</configuration>
<version>2.1</version>
</plugin>
</plugins>
</build>
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/fr/warlog/bus/FileMgt.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public List<FileNode> list(FileNode root) {
}




/**
* Lit le fichier à envoyer
*/
Expand Down Expand Up @@ -149,7 +151,7 @@ public String readFile( String pMsg ) {
* @param col
* @param sep
*/
public Data<List<Line>> readFileLines( String pMsg , int start, int limit, String sep, int col) {
public Data<List<Line>> readFileLines( String pMsg , int start, int limit, String sep, int col, String pattern) {
List<Line> result = new ArrayList<Line>();
Data<List<Line>> dataRes = new Data<List<Line>>(result);
BufferedReader lBis = null;
Expand All @@ -166,6 +168,10 @@ public Data<List<Line>> readFileLines( String pMsg , int start, int limit, Str
boolean doProcess=true;
int total=0;
while ( ( line = lBis.readLine() ) != null ) {
if(pattern !=null && !line.matches(pattern)){
continue;
}

if(start>0){
start--;
}else{
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/fr/warlog/web/FileServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
String path = req.getParameter("path");
String raw = req.getParameter("raw");
String sep = req.getParameter("sep");
String pattern = req.getParameter("pattern");
int col = toInt(req.getParameter("col"),1);
int start = toInt(req.getParameter("start"),0);
int limit = toInt(req.getParameter("limit"),-1);
Expand All @@ -42,7 +43,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
if(raw != null){
result = new FileMgt().readFile(path);
}else{
result = JSONUtils.toJsonString(new FileMgt().readFileLines(path,start,limit,sep,col));
result = JSONUtils.toJsonString(new FileMgt().readFileLines(path,start,limit,sep,col, pattern));
}
}catch (Exception e){
result=JSONUtils.toJsonError(e);
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/app/store/Lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Ext.define('app.store.Lines', {
extend: 'Ext.data.Store',
model: 'app.model.Line',
autoLoad: false,
pageSize: 100,

proxy: {
type: 'appajax',
Expand Down

0 comments on commit 4c73ce9

Please sign in to comment.