package com.dev.swms.server.action.formatter;

import java.util.List;

import com.dev.energy.server.format.Formatter;

public class NewLotInforFormatter implements Formatter {
	public String format(String property, Object cellValue, List origenData,
			String referenceModel, String locale) {
		String[] fromTo = property.split(",");
		String format = "";
		Object lotValues[] = origenData.subList(Integer.valueOf(fromTo[0]).intValue(),Integer.valueOf(fromTo[1]).intValue()+1).toArray(new String[0]);
		for(int i = 0 ; i < lotValues.length ; i ++){
			if(lotValues[i] != null && !"".equals(lotValues[i]) && !"-".equals(lotValues[i]) && !"0".equals(lotValues[i])) {
				if("".equals(format)) {
					format += lotValues[i].toString();
				} else {
					format += "/" + lotValues[i].toString();
				}
			}
		}
		if("".equals(format)){
			format = "-";
		}
		return format;
	}
}
