nl.cloudfarming.client.area.field
Class FieldAreaService

java.lang.Object
  extended by nl.cloudfarming.client.model.DataProvider
      extended by nl.cloudfarming.client.model.CommonModelService
          extended by nl.cloudfarming.client.area.field.FieldAreaService
All Implemented Interfaces:
AreaService, BeanService, org.openide.explorer.ExplorerManager.Provider, org.openide.util.Lookup.Provider

public class FieldAreaService
extends CommonModelService
implements AreaService

Author:
Timon Veenstra

Constructor Summary
FieldAreaService()
           
 
Method Summary
 void createNewAbLine(AbLine abLine)
           
 void createNewField(Field field)
           
 void createNewHelpLine(HelpLine helpLine)
           
 void createNewPartField(PartField pf)
          Creates a new partField
 void createNewShapeFile(ShapeFile shapeFile)
           
 boolean endField(Field field)
          Sets the endDate of the field to now.
 List<Field> findAllActiveFields()
          Find all the fields where the endDate is not filled
 List<Field> findAllCurrentFields()
           
 List<HelpLine> findAllHelpLines()
          Find all the fields where the endDate is not filled
 Field findFieldById(long id)
          Find a Field by ID
 List<PartField> findPartFieldsByDate(Date date)
          Find partfields by Date
 List<ProductionUnit> findProductionUnitsByDate(Date date)
          Find production units by date
 ShapeFile findShapeFileByNameAndChecksum(String name, String checksum)
          Find a Field by specifying the filename and the checksum
protected  String getModuleName()
           
protected  void initExplorer()
           
 void removeField(Field field)
          Removes a field.
 void removeHelpLine(HelpLine line)
          Removes a line.
 void saveFieldChanges(Field field)
           
 void savePartFieldChanges(PartField partField)
           
 
Methods inherited from class nl.cloudfarming.client.model.CommonModelService
commit, findAllFieldPlans, findAllFields, findNumberOfPartFieldForFieldPlan, flush, getEntityManager, merge, mergeAndPersistInTransaction, persistInTransaction, remove, save, startTransaction
 
Methods inherited from class nl.cloudfarming.client.model.DataProvider
addBeanToSelection, addSaveCookie, addToLookup, findNodeForBean, getExplorerManager, getLookup, getUndoredoManager, removeBeanFromSelection, removeFromLookup, removeSaveCookie, setExplorerManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.cloudfarming.client.area.AreaService
findAllFields
 

Constructor Detail

FieldAreaService

public FieldAreaService()
Method Detail

getModuleName

protected String getModuleName()
Specified by:
getModuleName in class CommonModelService

findAllCurrentFields

public final List<Field> findAllCurrentFields()

createNewField

public final void createNewField(Field field)
Specified by:
createNewField in interface AreaService

createNewHelpLine

public void createNewHelpLine(HelpLine helpLine)
Specified by:
createNewHelpLine in interface AreaService

createNewAbLine

public void createNewAbLine(AbLine abLine)
Specified by:
createNewAbLine in interface AreaService

saveFieldChanges

public final void saveFieldChanges(Field field)
Specified by:
saveFieldChanges in interface AreaService

savePartFieldChanges

public final void savePartFieldChanges(PartField partField)

createNewShapeFile

public final void createNewShapeFile(ShapeFile shapeFile)
Specified by:
createNewShapeFile in interface AreaService

createNewPartField

public void createNewPartField(PartField pf)
Creates a new partField

Parameters:
pf - the partfield that should be created

findProductionUnitsByDate

public List<ProductionUnit> findProductionUnitsByDate(Date date)
Find production units by date

Specified by:
findProductionUnitsByDate in interface AreaService
Parameters:
date - The PU should be active on this date
Returns:
The list of PU's active on the specified Date

endField

public boolean endField(Field field)
Sets the endDate of the field to now.

Parameters:
field - the field that should be ended
Throws:
IllegalArgumentException - if the Provided field is not a persisted entity

initExplorer

protected void initExplorer()
Specified by:
initExplorer in class DataProvider

findPartFieldsByDate

public List<PartField> findPartFieldsByDate(Date date)
Find partfields by Date

Specified by:
findPartFieldsByDate in interface AreaService
Parameters:
date - The date the field has to be active.
Returns:
The list of partfields active on Date date

findShapeFileByNameAndChecksum

public ShapeFile findShapeFileByNameAndChecksum(String name,
                                                String checksum)
Find a Field by specifying the filename and the checksum

Specified by:
findShapeFileByNameAndChecksum in interface AreaService
Parameters:
name - Filename
checksum - file checksum
Returns:

findFieldById

public Field findFieldById(long id)
Find a Field by ID

Specified by:
findFieldById in interface AreaService
Parameters:
id -
Returns:

findAllActiveFields

public List<Field> findAllActiveFields()
Find all the fields where the endDate is not filled

Returns:
all the active Fields

findAllHelpLines

public List<HelpLine> findAllHelpLines()
Find all the fields where the endDate is not filled

Returns:
all the active Fields

removeField

public void removeField(Field field)
Removes a field. If a field has partFields the field will not be removed. Instead the endDate of the field and all of its partFields will be filed.

Parameters:
field - which will be removed

removeHelpLine

public void removeHelpLine(HelpLine line)
Removes a line. If a field has partFields the field will not be removed. Instead the endDate of the field and all of its partFields will be filed.

Parameters:
field - which will be removed


Copyright © 2011. All Rights Reserved.