// Path: server/war/src/main/java/eu/stratuslab/marketplace/server/utils/MarketplaceUtils.java
// public final class MarketplaceUtils {
// 		
// 	private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
// 	
// 	private MarketplaceUtils(){}
// 	
// 	public static String getCurrentDate() {
// 		return getFormattedDate(new Date());
// 	}
// 
// 	public static Date getFormattedDate(String timestamp) throws ParseException{
// 		return getDateFormat().parse(timestamp);
// 	}
// 	
// 	public static String getFormattedDate(Date date){
// 		return getDateFormat().format(date);
// 	}
// 	
// 	private static DateFormat getDateFormat() {
// 		SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
// 		format.setLenient(false);
// 		format.setTimeZone(TimeZone.getTimeZone("UTC"));
// 
// 		return format;
// 	}
// 
// }


import java.util.Map;
import eu.stratuslab.marketplace.PatternUtils;
import eu.stratuslab.marketplace.server.utils.MarketplaceUtils;
    	//Build the paging query
    	String searching = buildSearchingFilter(requestQueryValues);
    	   	         
        String where = WHERE
            + SparqlUtils.WHERE_BLOCK;
        
        StringBuilder wherePredicate = new StringBuilder(
                    where);

        wherePredicate.append(filter);

        if (!hasDate) {
                wherePredicate
                        .append(SparqlUtils.getLatestFilter());
        }
                     
        setStatus(wherePredicate, status);
        setAccess(wherePredicate, access);
                        
        wherePredicate.append(searching);
        wherePredicate.append(" }");

        query.append(wherePredicate);
        query.append(SparqlUtils.GROUP_BY);
    }
	
	private void setStatus(StringBuilder wherePredicate, String status){
		if(status.equals("expired")){ //implies validity date in the past and not deprecated
        	wherePredicate
              	.append(SparqlUtils.getExpiredFilter(
// Path: server/war/src/main/java/eu/stratuslab/marketplace/server/utils/MarketplaceUtils.java
// public final class MarketplaceUtils {
// 		
// 	private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
// 	
// 	private MarketplaceUtils(){}
// 	
// 	public static String getCurrentDate() {
// 		return getFormattedDate(new Date());
// 	}
// 
// 	public static Date getFormattedDate(String timestamp) throws ParseException{
// 		return getDateFormat().parse(timestamp);
// 	}
// 	
// 	public static String getFormattedDate(Date date){
// 		return getDateFormat().format(date);
// 	}
// 	
// 	private static DateFormat getDateFormat() {
// 		SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
// 		format.setLenient(false);
// 		format.setTimeZone(TimeZone.getTimeZone("UTC"));
// 
// 		return format;
// 	}
// 
// }


// Path: server/war/src/main/java/eu/stratuslab/marketplace/server/query/SparqlBuilder.java
import java.util.Map;
import eu.stratuslab.marketplace.PatternUtils;
import eu.stratuslab.marketplace.server.utils.MarketplaceUtils;

    	//Build the paging query
    	String searching = buildSearchingFilter(requestQueryValues);
    	   	         
        String where = WHERE
            + SparqlUtils.WHERE_BLOCK;
        
        StringBuilder wherePredicate = new StringBuilder(
                    where);

        wherePredicate.append(filter);

        if (!hasDate) {
                wherePredicate
                        .append(SparqlUtils.getLatestFilter());
        }
                     
        setStatus(wherePredicate, status);
        setAccess(wherePredicate, access);
                        
        wherePredicate.append(searching);
        wherePredicate.append(" }");

        query.append(wherePredicate);
        query.append(SparqlUtils.GROUP_BY);
    }
	
	private void setStatus(StringBuilder wherePredicate, String status){
		if(status.equals("expired")){ //implies validity date in the past and not deprecated
        	wherePredicate
              	.append(SparqlUtils.getExpiredFilter(
              			MarketplaceUtils.getCurrentDate()));