![JAR search and dependency download from the Maven repository](/logo.png)
nl.cloudfarming.client.spray.SprayTask Maven / Gradle / Ivy
/**
* Copyright (C) 2008-2012 AgroSense Foundation.
*
* AgroSense is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
* this software, see the FLOSS License Exception
* .
*
* AgroSense is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AgroSense. If not, see .
*/
package nl.cloudfarming.client.spray;
import java.util.Collection;
import nl.cloudfarming.client.field.model.Field;
import nl.cloudfarming.client.field.model.TreatmentZone;
import nl.cloudfarming.client.fleet.model.Implement;
import nl.cloudfarming.client.fleet.model.Vehicle;
import nl.cloudfarming.client.model.Entity;
import nl.cloudfarming.client.model.ItemIdType;
import nl.cloudfarming.client.task.Task;
/**
*
* @author Maciek Dulkiewicz
*/
public class SprayTask extends Task {
public static final String EXT = "stk";
public static final String MIME_TYPE = "application/x-agrosense-spray-task";
public static final Class[] requires = new Class[]{
Field.class,
TreatmentZone.class,
Vehicle.class,
Implement.class
};
public SprayTask(Collection extends Entity> entities) {
super(entities.iterator().next().getURI(), requires, ItemIdType.STK);
for (Entity entity : entities) {
getContext().addItem(entity);
}
}
public SprayTask(Entity entity) {
super(entity.getURI(), requires, ItemIdType.STK);
getContext().addItem(entity);
}
public boolean hasEntitiesOfClass(Class clazz) {
Collection foundObjects = getContext().lookupAll(clazz);
return foundObjects.size() > 0;
}
@Override
public Class[] getRequiredClasses() {
return requires;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy