working project
This commit is contained in:
		@@ -60,7 +60,7 @@ public class Main {
 | 
			
		||||
                from("activemq:queue:RawMaterial")
 | 
			
		||||
                        .enrich("direct:getPackages", new MyAggregator())
 | 
			
		||||
                        .marshal(xmlDataFormat)
 | 
			
		||||
                        .to("activemq:queue:materialPackage")
 | 
			
		||||
                        .to("activemq:queue:MaterialPackage")
 | 
			
		||||
                        .to("log:?level=INFO&showBody=true");
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,8 @@ import org.apache.camel.Exchange;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.regex.Matcher;
 | 
			
		||||
import java.util.regex.Pattern;
 | 
			
		||||
 | 
			
		||||
public class MyAggregator implements AggregationStrategy {
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -35,8 +37,23 @@ public class MyAggregator implements AggregationStrategy {
 | 
			
		||||
            p.setDimension((String) newEx.get(i).get("dimension"));
 | 
			
		||||
            p.setDescription((String) newEx.get(i).get("description"));
 | 
			
		||||
            material.getPackages().add(p);
 | 
			
		||||
 | 
			
		||||
            //validation
 | 
			
		||||
            Pattern pattern = Pattern.compile("\\d\\dx\\d\\dx\\d\\d");
 | 
			
		||||
            Matcher matcher = pattern.matcher(p.getDimension());
 | 
			
		||||
            if(matcher.matches()){
 | 
			
		||||
                System.out.println("maczuje");
 | 
			
		||||
            }
 | 
			
		||||
            else{
 | 
			
		||||
                System.out.println("nieeeeeeeee");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        Exchange result = oldExchange;
 | 
			
		||||
        result.getIn().setBody(material);
 | 
			
		||||
        return result;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user