F
- the interface all fields of this source must implement.@StableMinor(version="10.1", sinceVersion="4.0") public abstract class Source<F extends ISourceField> extends Observable
Modifier and Type | Field and Description |
---|---|
protected String |
addInterfaceId |
protected String |
administrationInterfaceId |
protected String |
connectionId |
protected String |
detailsInterfaceId |
protected String |
editInterfaceId |
protected List<F> |
fields
A unmodifiable list of this source's fields.
|
protected Map<String,F> |
fieldsMap
A map of field id to the
ISourceField instance. |
protected String |
id |
protected F |
introductionSourceField |
protected F |
keywordsSourceField |
protected boolean |
load |
protected String |
metaDataSourceId |
protected Map<String,Object> |
parameters |
protected F |
primaryNameSourceField |
protected String |
readData |
static String |
SOURCE_READ_DATA_ALWAYS |
static String |
SOURCE_READ_DATA_NEVER |
static String |
SOURCE_READ_DATA_ON_DEMAND |
protected ISourceContext |
sourceContext |
protected Node |
sourceDefinitionNode |
Constructor and Description |
---|
Source(Node sourceDefinitionNode,
ISourceContext sourceContext) |
Modifier and Type | Method and Description |
---|---|
void |
applyPostLoadFilters()
Apply the filters specified in this source to its data.
|
protected abstract void |
convertDataToDefinedDataTypes()
Converts the data in this source to the values that should be used according to
its fields definitions.
|
protected F |
createCustomSourceField(Node fieldNode)
Factory method for creating a custom source field.
|
protected ISourceFilter |
createDefaultCompositeFilterInstance()
Creates and returns a source filter instance to be used
as default to
filters nodes. |
protected ISourceFilter |
createDefaultFilterInstance()
Creates and returns a source filter instance to be used
as default to
filter nodes. |
protected F |
createSourceField(Node fieldNode)
Factory method for creating a source field instance that corresponds
to the field node given.
|
ISourceFilter |
createSourceFilter(Node filterNode)
Creates a source filter for the given filter definition node.
|
String |
getAddInterfaceId()
Returns the default add interface id for this source.
|
String |
getAdministrationInterfaceId()
Returns the main administration interface id for this source.
|
<S extends Source<?>> |
getBigDataPersister()
Returns the ISourceBigDataPersister implementation to be used for this source.
|
ISourceData |
getData()
Returns this source's data.
|
<S extends Source> |
getDataProvider()
Returns the data provider for this source.
|
protected <S extends Source<?>> |
getDefaultBigDataPersister()
Returns the default ISourceBigDataPersister implementation to be used for this source if the big data persisting
is not disabled and no specific persister class is configured for this source.
|
protected abstract String |
getDefaultProviderClass()
Abstract method that returns the default data provider class name.
|
Node |
getDefinitionNode()
Deprecated.
This method may not be public in the future.
|
String |
getDetailsInterfaceId()
Returns the default details interface id for this source.
|
boolean |
getDistinct()
Returns the distinct property of the source.
|
DouiContext |
getDouiContext()
Returns this source's doui context.
|
DouiHyperlinkItemParameterField |
getDouiHyperlinkItemParameterField()
Returns the information about the field that is associated with the item id page parameter.
|
String |
getEditInterfaceId()
Returns the default edit interface id for this source.
|
F |
getField(String fieldId)
Returns the field with the given id.
|
List<F> |
getFields()
Returns a unmodifiable list of the fields in this source.
|
ISourceFilter |
getFilter()
Returns the filter for this source.
|
Node |
getFiltersNode()
Returns the "filters" node of the source.
|
Collection<String> |
getHyperlinkDefaultParameters()
Returns the default parameters that should be used when creating a
hyperlink url from this source.
|
String |
getId()
Returns the source id.
|
F |
getIntroductionField()
Returns the field that is the introduction of this source.
|
F |
getIntroductionImageField()
Returns the field that is the introduction image of this source.
|
F |
getKeywordsField() |
boolean |
getLoad()
Returns the load property.
|
String |
getMetaDataSourceId()
Returns the metaDataId.
|
Class<?> |
getParameterClass(String parameterName)
Returns the class given a parameter name.
|
Object |
getParameterValue(String parameterName)
Returns a parameter value previously set.
|
F |
getPrimaryNameField()
Returns the field that is the primary name of this source.
|
F |
getPublishStartDateField()
Returns the field that is the publish start date of this source.
|
String |
getReadData() |
SourceContainer |
getSourceContainer()
Returns this source's container.
|
ISourceContext |
getSourceContext()
Returns this source's context.
|
ITransaction |
getTransaction()
Returns the transaction for this source.
|
protected boolean |
isAdministrationInterface(IServiceInterface serviceInterface)
Returns true if the given service interface is the main administration interface for this source.
|
boolean |
isDetails()
Returns whether this source is the main source for a details interface,
intended for obtaining the detailed information of a data.
|
void |
load()
This is where the actual loading of the source data takes place.
|
protected void |
postProcessSource()
Executes the post load processors associated with the current source.
|
protected void |
readFieldsIntoFieldsMap()
Reads this source's fields into the
fieldsMap . |
void |
setLoad(boolean load)
Sets the property indicating whether this source must be loaded by its data provider.
|
void |
setParameterValue(String parameterName,
Object value)
Deprecated.
Since 7.1.0 replaced by
setParameterValue(String, Object, String)
to allow proper conversion of value to string. This method is kept only for
backwards compatibility with callers and is no longer called by the
portal container. The final modifier has been applied to this method
to force overriding methods to be adjusted to override the correct method
instead of being silently ignored. |
void |
setParameterValue(String parameterName,
Object value,
String valueAsString)
Sets a parameter value in this source.
|
void |
setReadData(String loadType)
Returns the load type of the source.
|
protected boolean |
valueChanged(String parameterName,
String newValueAsString)
Returns true if the current value of the parameter changed from the previous value.
|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
public static final String SOURCE_READ_DATA_ON_DEMAND
public static final String SOURCE_READ_DATA_NEVER
public static final String SOURCE_READ_DATA_ALWAYS
protected final String id
protected final String metaDataSourceId
protected final String connectionId
protected final ISourceContext sourceContext
protected final Node sourceDefinitionNode
protected final String administrationInterfaceId
protected final String addInterfaceId
protected final String editInterfaceId
protected final String detailsInterfaceId
protected final Map<String,F extends ISourceField> fieldsMap
ISourceField
instance. Changes to this
map automatically reflects in the fields
list. The fields
list has the order the entries were put in this map.fields
protected final List<F extends ISourceField> fields
fieldsMap
.
The order of fields in this list is the same as the order the fields were put
in fieldsMap
.fieldsMap
protected boolean load
protected String readData
protected F extends ISourceField primaryNameSourceField
protected F extends ISourceField introductionSourceField
protected F extends ISourceField keywordsSourceField
public Source(Node sourceDefinitionNode, ISourceContext sourceContext) throws PortalException
PortalException
protected boolean isAdministrationInterface(IServiceInterface serviceInterface)
serviceInterface
- the service interface.protected void readFieldsIntoFieldsMap() throws PortalException
fieldsMap
.
The order the source fields are put in the map will define the
order the fields will be in the fields
list. This
order may affect some field processing.PortalException
- if an error was found while reading the
source's fields into the fields
map.protected F createCustomSourceField(Node fieldNode) throws PortalException
fieldNode
- the field definition.PortalException
protected F createSourceField(Node fieldNode) throws PortalException
fieldNode
- the field node.PortalException
createCustomSourceField(Node)
public ISourceFilter createSourceFilter(Node filterNode) throws PortalException
filters
or filter
node.filterNode
- the filter definition node.PortalException
protected ISourceFilter createDefaultFilterInstance()
filter
nodes.protected ISourceFilter createDefaultCompositeFilterInstance()
filters
nodes.public ISourceFilter getFilter()
public String getId()
public Class<?> getParameterClass(String parameterName)
The class is determined by the field type where the fieldId equals the parameter name.
parameterName
- @Deprecated public final void setParameterValue(String parameterName, Object value)
setParameterValue(String, Object, String)
to allow proper conversion of value to string. This method is kept only for
backwards compatibility with callers and is no longer called by the
portal container. The final
modifier has been applied to this method
to force overriding methods to be adjusted to override the correct method
instead of being silently ignored.parameterName
- value
- public void setParameterValue(String parameterName, Object value, String valueAsString)
The source's parameter values usually affect which or how data is loaded on it.
parameterName
- the parameter name.value
- the value.valueAsString
- the value converted to string. It is important that
the string corresponds to the value, such as when another equivalent
value is set its string is also equivalent to this one, and when another
value is different its string is also different of this one.public Object getParameterValue(String parameterName)
parameterName
- protected boolean valueChanged(String parameterName, String newValueAsString)
parameterName
- the parameter name.newValueAsString
- the new value converted to String.true
if the value changed, false
otherwise.setParameterValue(String, Object, String)
@Deprecated public Node getDefinitionNode()
public String getAdministrationInterfaceId()
null
if the
source does not have a main administration interface.public String getAddInterfaceId()
null
if the
source does not have a default add interface.public String getEditInterfaceId()
null
if the
source does not have a default edit interface.public String getDetailsInterfaceId()
null
if the
source does not have a default details interface.public <S extends Source> IDataProvider<S> getDataProvider() throws PortalException
S
- PortalException
protected abstract String getDefaultProviderClass() throws PortalException
PortalException
public ISourceData getData() throws PortalException
PortalException
public void setLoad(boolean load)
load
- public boolean getLoad()
The doui framework uses this to determine whether the source should be loaded or not.
public ITransaction getTransaction() throws PortalException
PortalException
public void load() throws PortalException
The data provider is called by the source to load its data. After data is loaded, all data conversion is performed and observers are notified.
PortalException
protected void postProcessSource() throws PortalException
PortalException
protected abstract void convertDataToDefinedDataTypes() throws PortalException
PortalException
public String getReadData()
public void setReadData(String loadType)
loadType
- The loadType to set.public Node getFiltersNode() throws PortalException
A null value is returned if no filters are specified.
PortalException
public void applyPostLoadFilters() throws PortalException
Data providers that may provide significant quantity of data should implement its own filtering during load instead of using this method, to prevent unnecessary use of server's memory and cpu.
UnsupportedOperationException
- if the source's implementation
for this method does not support the filters specified.PortalException
IDataProvider#loadData(lumis.portal.SessionConfig, Source, lumis.util.ITransaction)
public ISourceContext getSourceContext()
public DouiContext getDouiContext()
public SourceContainer getSourceContainer()
public boolean getDistinct() throws PortalException
The data provider reads this property to determine how to retrieve data.
PortalException
public String getMetaDataSourceId()
public F getField(String fieldId)
fieldId
- the field's id.public List<F> getFields()
public F getPrimaryNameField()
public F getIntroductionField()
public F getIntroductionImageField()
public F getPublishStartDateField()
public F getKeywordsField()
public DouiHyperlinkItemParameterField getDouiHyperlinkItemParameterField()
PageConfig.PAGE_PARAMETER_ITEMID
,
DouiHyperlinkItemParameterField
public Collection<String> getHyperlinkDefaultParameters()
public boolean isDetails()
true
if this source is a details source, false
otherwise.public <S extends Source<?>> ISourceBigDataPersister<S> getBigDataPersister()
protected <S extends Source<?>> ISourceBigDataPersister<S> getDefaultBigDataPersister()
This method is called by getBigDataPersister()
when the default is to be used.
Lumisportal 10.1.2.170428 - Copyright © 2006–2017 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.