org.gcube.contentmanagement.timeseriesservice.impl.curation.state
Class CurationResource

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
      extended by org.gcube.common.core.state.GCUBEStatefulResource<org.gcube.common.core.state.GCUBEWSResourceKey>
          extended by org.gcube.common.core.state.GCUBEWSResource
              extended by org.gcube.contentmanagement.timeseriesservice.impl.curation.state.CurationResource
All Implemented Interfaces:
org.gcube.common.core.utils.handlers.GCUBEServiceClient, org.globus.wsrf.PersistenceCallback, org.globus.wsrf.Resource, org.globus.wsrf.ResourceLifetime, org.globus.wsrf.ResourceProperties, org.globus.wsrf.TopicListAccessor

public class CurationResource
extends org.gcube.common.core.state.GCUBEWSResource


Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.common.core.state.GCUBEStatefulResource
org.gcube.common.core.state.GCUBEStatefulResource.LOCK, org.gcube.common.core.state.GCUBEStatefulResource.TaskContext
 
Field Summary
static String ID_COLUMN_SUFFIX
           
protected static String RP_ID
           
protected static String RP_SOURCEID
           
protected static String RP_SOURCENAME
           
protected static String RP_TITLE
           
protected static String[] RPNames
           
 
Fields inherited from class org.gcube.common.core.state.GCUBEStatefulResource
logger, uuidGen
 
Constructor Summary
CurationResource()
           
 
Method Summary
 Iterator<Rule> applyableRules(String fieldId)
           
 Iterator<Rule> applyedRules(String fieldID)
           
 void applyRules(org.gcube.contentmanagement.timeseriesservice.stubs.types.RuleItem[] rules, String fieldId)
           
 long checkDimension(String dimensionId, String fieldId, String keyId)
          checks how many errors there will be in edit mode for a specific dimension setting
 long checkRules(String fieldId, org.gcube.contentmanagement.timeseriesservice.stubs.types.FilterCondition[] filters)
          checks how many errors there will be in edit mode for applying a specific rule
 long checkTypeChange(String fieldId, org.gcube.common.dbinterface.types.Type newType)
          checks how many errors there will be in edit mode for applying a specific rule
 void closeEditing()
          allows user to exit from edit mode
 org.gcube.contentmanagement.timeseriesservice.stubs.types.ColumnDefinition columnInEditMode()
          returns which column is actually in edit mode
 void editColumn(String fieldId, org.gcube.common.dbinterface.types.Type type)
          allows user to enter in edit mode for type checking
 void editDimension(String fieldId, String codelistId, String keyId)
          allows user to enter in edit mode form dimension checking
 void editRules(String fieldId)
          allows user to enter in edit mode for rules checking
 org.gcube.contentmanagement.timeseriesservice.stubs.types.ColumnDefinition[] getColumnDefinition()
           
 long getCount(boolean onlyErrors)
          returns the count entries for this resource
 String getDataAsJson(org.gcube.common.dbinterface.queries.Select query, boolean onlyErrors)
          returns the entries of the resource as JSon
 Edit getFieldEditor()
           
 Map<String,int[]> getFieldLenght()
           
 CurationHistory getHistory()
           
 String getId()
          Returns the id.
 ImportResource getImportResource()
          retrieves the import resource
 org.gcube.contentmanagement.timeseriesservice.stubs.types.Status getInitializeEditingState()
           
 String getPossibleValues(String word)
           
 String[] getPropertyNames()
          
 String getSourceId()
           
 String getSourceName()
           
 org.gcube.common.dbinterface.tables.SimpleTable getTable()
           
 String getTitle()
           
 long getTotalLine()
           
 org.gcube.contentmanagement.timeseriesservice.stubs.types.Status getUnderCreationState()
           
 org.gcube.contentmanagement.timeseriesservice.stubs.types.GuessDimensionArray guess(String fieldId)
          perform the guessing for a selected field id
protected  void initialise(Object... initParameters)
           
 boolean isUnderEdit()
           
 void modifyEntryId(String fieldId, String newId, long rowId)
           
 void modifyEntryValue(String fieldId, String newValue, long rowId)
           
protected  void onRemove()
           
 void remove()
          
 void removeAllErrors()
          remove all the rows with wrong field (only in edit mode)
 void removeAllRules(String fieldId)
           
 void removeColumn(String fieldId)
          removes a column
 void removeError(long rowId)
          remove a row with a wrong field (only in edit mode)
 void replaceById(String oldId, String newId, String fieldId)
           
 void replaceByValue(String oldValue, String newValue, String fieldId)
           
 void saveColumnDefinition()
           
 void setColumn(org.gcube.contentmanagement.timeseriesservice.stubs.types.EntryType columnType, String fieldId)
           
 void setColumnDefinition(org.gcube.contentmanagement.timeseriesservice.stubs.types.ColumnDefinition[] columnDefinition)
           
 void setFieldEditor(Edit fieldEditor)
           
 void setFieldLenght(Map<String,int[]> fieldLenght)
           
 void setHistory(CurationHistory history)
           
 void setId(String id)
           
 void setLabel(String fieldId, String label)
           
 void setProperties(String title, String description, String publisher, String rights)
           
 void setSourceId(String sourceId)
           
 void setSourceName(String sourceName)
           
 void setTable(org.gcube.common.dbinterface.tables.SimpleTable table)
           
 void setTitle(String title)
           
 void setTotalLine(int totalLine)
          sets the total resource entries number
 void setUnderCreationState(org.gcube.contentmanagement.timeseriesservice.stubs.types.Status underCreationState)
           
 void setUnderCreationState(String underCreationState)
           
 
Methods inherited from class org.gcube.common.core.state.GCUBEWSResource
getCurrentTime, getEPR, getPorttypeContext, getProperty, getPublisher, getResourcePropertySet, getServiceContext, getTerminationTime, getTopicList, getTopicNames, initialise, initialiseContainers, inScope, load, publish, setPortTypeContext, setTerminationTime, unpublish
 
Methods inherited from class org.gcube.common.core.state.GCUBEStatefulResource
getID, getLock, getScheduledTasks, getScope, launchTask, setID, setPersistenceDelegate, stopTask, store
 
Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
getPortTypeMap, setPortTypeMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.globus.wsrf.PersistenceCallback
store
 

Field Detail

ID_COLUMN_SUFFIX

public static final String ID_COLUMN_SUFFIX
See Also:
Constant Field Values

RP_ID

protected static final String RP_ID
See Also:
Constant Field Values

RP_SOURCEID

protected static final String RP_SOURCEID
See Also:
Constant Field Values

RP_SOURCENAME

protected static final String RP_SOURCENAME
See Also:
Constant Field Values

RP_TITLE

protected static final String RP_TITLE
See Also:
Constant Field Values

RPNames

protected static String[] RPNames
Constructor Detail

CurationResource

public CurationResource()
Method Detail

getPropertyNames

public String[] getPropertyNames()

Overrides:
getPropertyNames in class org.gcube.common.core.state.GCUBEWSResource

initialise

protected void initialise(Object... initParameters)
                   throws Exception
Specified by:
initialise in class org.gcube.common.core.state.GCUBEWSResource
Throws:
Exception

getImportResource

public ImportResource getImportResource()
                                 throws org.globus.wsrf.NoSuchResourceException,
                                        org.globus.wsrf.ResourceException
retrieves the import resource

Returns:
a Import Resource
Throws:
org.globus.wsrf.NoSuchResourceException - -
org.globus.wsrf.ResourceException - -

editDimension

public void editDimension(String fieldId,
                          String codelistId,
                          String keyId)
                   throws Exception
allows user to enter in edit mode form dimension checking

Parameters:
fieldId - field id
dimensionId - dimension id
keyName - key name
Throws:
Exception - -

editRules

public void editRules(String fieldId)
               throws Exception
allows user to enter in edit mode for rules checking

Parameters:
fieldId - field id
dimensionId - dimension id
keyName - key name
Throws:
Exception - -

editColumn

public void editColumn(String fieldId,
                       org.gcube.common.dbinterface.types.Type type)
                throws Exception
allows user to enter in edit mode for type checking

Parameters:
fieldId - field id
dimensionId - dimension id
keyName - key name
Throws:
Exception - -

getCount

public long getCount(boolean onlyErrors)
              throws Exception
returns the count entries for this resource

Parameters:
onlyErrors - if true returns only the wrong entries
Returns:
the count
Throws:
Exception - -

getDataAsJson

public String getDataAsJson(org.gcube.common.dbinterface.queries.Select query,
                            boolean onlyErrors)
                     throws Exception
returns the entries of the resource as JSon

Parameters:
query - the query
onlyErrors - true if the user wants only the wrong entry
Returns:
the String as JSon
Throws:
Exception - -

getId

public String getId()
             throws org.globus.wsrf.ResourceException
Returns the id.

Returns:
the id.
Throws:
org.globus.wsrf.ResourceException

getSourceId

public String getSourceId()
                   throws org.globus.wsrf.ResourceException
Returns:
Throws:
org.globus.wsrf.ResourceException

getSourceName

public String getSourceName()
                     throws org.globus.wsrf.ResourceException
Returns:
Throws:
org.globus.wsrf.ResourceException

getTitle

public String getTitle()
                throws org.globus.wsrf.ResourceException
Returns:
Throws:
org.globus.wsrf.ResourceException

setTitle

public void setTitle(String title)
              throws org.globus.wsrf.ResourceException
Parameters:
id -
Throws:
org.globus.wsrf.ResourceException

setId

public void setId(String id)
           throws org.globus.wsrf.ResourceException
Parameters:
id -
Throws:
org.globus.wsrf.ResourceException

setSourceId

public void setSourceId(String sourceId)
                 throws org.globus.wsrf.ResourceException
Parameters:
sourceId -
Throws:
org.globus.wsrf.ResourceException

setSourceName

public void setSourceName(String sourceName)
                   throws org.globus.wsrf.ResourceException
Parameters:
sourceName -
Throws:
org.globus.wsrf.ResourceException

getTable

public org.gcube.common.dbinterface.tables.SimpleTable getTable()
Returns:

isUnderEdit

public boolean isUnderEdit()
Returns:

getFieldEditor

public Edit getFieldEditor()
Returns:

setFieldEditor

public void setFieldEditor(Edit fieldEditor)
Parameters:
fieldEditor -

getColumnDefinition

public org.gcube.contentmanagement.timeseriesservice.stubs.types.ColumnDefinition[] getColumnDefinition()
Returns:

setColumnDefinition

public void setColumnDefinition(org.gcube.contentmanagement.timeseriesservice.stubs.types.ColumnDefinition[] columnDefinition)
Parameters:
columnDefinition -

saveColumnDefinition

public void saveColumnDefinition()
                          throws Exception
Throws:
Exception

guess

public org.gcube.contentmanagement.timeseriesservice.stubs.types.GuessDimensionArray guess(String fieldId)
                                                                                    throws Exception
perform the guessing for a selected field id

Parameters:
fieldId - field id
limit - the query limit
Returns:
the Dimension Array
Throws:
Exception - -

setLabel

public void setLabel(String fieldId,
                     String label)
              throws Exception
Parameters:
fieldId - field id
label - the label
type - the type
Throws:
Exception - -

remove

public void remove()


getUnderCreationState

public org.gcube.contentmanagement.timeseriesservice.stubs.types.Status getUnderCreationState()

setUnderCreationState

public void setUnderCreationState(org.gcube.contentmanagement.timeseriesservice.stubs.types.Status underCreationState)
Parameters:
underCreationState -

setUnderCreationState

public void setUnderCreationState(String underCreationState)
Parameters:
underCreationState -

getFieldLenght

public Map<String,int[]> getFieldLenght()
Returns:

setFieldLenght

public void setFieldLenght(Map<String,int[]> fieldLenght)
Parameters:
fieldLenght -

getInitializeEditingState

public org.gcube.contentmanagement.timeseriesservice.stubs.types.Status getInitializeEditingState()
                                                                                           throws Exception
Returns:
a state
Throws:
Exception - -

onRemove

protected void onRemove()
                 throws org.globus.wsrf.ResourceException
Overrides:
onRemove in class org.gcube.common.core.state.GCUBEStatefulResource<org.gcube.common.core.state.GCUBEWSResourceKey>
Throws:
org.globus.wsrf.ResourceException

setColumn

public void setColumn(org.gcube.contentmanagement.timeseriesservice.stubs.types.EntryType columnType,
                      String fieldId)
               throws Exception
Parameters:
columnType - column type
fieldId - field id
dataType - data type
Throws:
Exception - -

replaceById

public void replaceById(String oldId,
                        String newId,
                        String fieldId)
                 throws Exception
Parameters:
oldId - old id
newId - new id
fieldId - field id
Throws:
Exception - -

replaceByValue

public void replaceByValue(String oldValue,
                           String newValue,
                           String fieldId)
                    throws Exception
Parameters:
oldValue - old value
newValue - new value
fieldId - field id
Throws:
Exception - -

columnInEditMode

public org.gcube.contentmanagement.timeseriesservice.stubs.types.ColumnDefinition columnInEditMode()
                                                                                            throws Exception
returns which column is actually in edit mode

Returns:
the column definition
Throws:
Exception - -

getTotalLine

public long getTotalLine()
Returns:
the total entries count

setTotalLine

public void setTotalLine(int totalLine)
sets the total resource entries number

Parameters:
totalLine -

removeColumn

public void removeColumn(String fieldId)
                  throws Exception
removes a column

Parameters:
fieldId - the field id
Throws:
Exception - -

checkDimension

public long checkDimension(String dimensionId,
                           String fieldId,
                           String keyId)
                    throws Exception
checks how many errors there will be in edit mode for a specific dimension setting

Parameters:
dimensionId - dimension id
fieldId - field id
keyName - key name
Returns:
the error count
Throws:
Exception - -

checkRules

public long checkRules(String fieldId,
                       org.gcube.contentmanagement.timeseriesservice.stubs.types.FilterCondition[] filters)
                throws Exception
checks how many errors there will be in edit mode for applying a specific rule

Parameters:
fieldId - field id
filters - list of the filter representing the applied rules
Returns:
the error count
Throws:
Exception - -

checkTypeChange

public long checkTypeChange(String fieldId,
                            org.gcube.common.dbinterface.types.Type newType)
                     throws Exception
checks how many errors there will be in edit mode for applying a specific rule

Parameters:
fieldId - field id
filters - list of the filter representing the applied rules
Returns:
the error count
Throws:
Exception - -

closeEditing

public void closeEditing()
                  throws Exception
allows user to exit from edit mode

Throws:
Exception - -

modifyEntryValue

public void modifyEntryValue(String fieldId,
                             String newValue,
                             long rowId)
                      throws Exception
Parameters:
fieldId - field id
newValue - new value
rowId - row id
Throws:
org.gcube.common.core.faults.GCUBEFault - -
Exception

getPossibleValues

public String getPossibleValues(String word)
                         throws Exception
Throws:
Exception

modifyEntryId

public void modifyEntryId(String fieldId,
                          String newId,
                          long rowId)
                   throws Exception
Parameters:
fieldId - field id
newId - new id
rowId - row id
Throws:
org.gcube.common.core.faults.GCUBEFault - -
Exception

removeAllErrors

public void removeAllErrors()
                     throws Exception
remove all the rows with wrong field (only in edit mode)

Throws:
Exception - -

removeError

public void removeError(long rowId)
                 throws Exception
remove a row with a wrong field (only in edit mode)

Parameters:
rowId - the row id
Throws:
Exception - -

getHistory

public CurationHistory getHistory()

setHistory

public void setHistory(CurationHistory history)

setTable

public void setTable(org.gcube.common.dbinterface.tables.SimpleTable table)

applyRules

public void applyRules(org.gcube.contentmanagement.timeseriesservice.stubs.types.RuleItem[] rules,
                       String fieldId)
                throws Exception
Throws:
Exception

applyedRules

public Iterator<Rule> applyedRules(String fieldID)
                            throws Exception
Throws:
Exception

applyableRules

public Iterator<Rule> applyableRules(String fieldId)
                              throws Exception
Throws:
Exception

removeAllRules

public void removeAllRules(String fieldId)
                    throws Exception
Throws:
Exception

setProperties

public void setProperties(String title,
                          String description,
                          String publisher,
                          String rights)
                   throws Exception
Throws:
Exception


Copyright © 2012. All Rights Reserved.