Class SpreadsheetModel

    • Constructor Detail

      • SpreadsheetModel

        public SpreadsheetModel()
    • Method Detail

      • addWorksheet

        public void addWorksheet​(SpreadsheetWorksheet worksheet)
        The purpose of this method is to associate the given worksheet with this spreadsheet. Any worksheet that starts with SpreadsheetConstants.WSH_IGNORE_CHARS is ignored.
        Parameters:
        worksheet -
      • addReference

        public void addReference​(SpreadsheetReference reference)
        Associate the given reference with this spreadsheet.
        Parameters:
        reference -
      • isLoaded

        public boolean isLoaded()
        Since:
        1.6
      • loadSpreadsheet

        protected abstract void loadSpreadsheet()
                                         throws java.lang.Exception
        The purpose of this method is to load the spreadsheet.
        Throws:
        java.lang.Exception
      • getSpreadsheetMetadata

        protected abstract ISpreadsheetMetadata getSpreadsheetMetadata()
        The purpose of this method is to return an instance of the ISpreadsheetMetadata implementation for retrieving metadata for this spreadsheet model
      • loadConfigurationFile

        protected void loadConfigurationFile()
                                      throws java.lang.Exception
        The purpose of this method is to load the configuration file
        Throws:
        java.lang.Exception
      • isMetadataConfigurationDefined

        protected abstract boolean isMetadataConfigurationDefined()
        Returns:
        true if metadata has been provided, false otherwise
      • getEnumerationValue

        public java.lang.Object getEnumerationValue​(java.lang.String enumeration,
                                                    java.lang.String label)
        Specified by:
        getEnumerationValue in interface IModel
      • allContents

        public java.util.List<SpreadsheetRow> allContents()
        This method returns all rows of all worksheets.
        Specified by:
        allContents in interface IModel
        Returns:
        all of the objects contained in this model.
      • getTypeOf

        public SpreadsheetWorksheet getTypeOf​(java.lang.Object instance)
        This method returns the worksheet that the given instance (row) belongs to. If the instance is not a SpreadsheetRow object then null is returned.
        Specified by:
        getTypeOf in interface IModel
        Overrides:
        getTypeOf in class Model
      • getTypeNameOf

        public java.lang.String getTypeNameOf​(java.lang.Object instance)
        This method returns the name of the worksheet that the instance (row) belongs to.
        Specified by:
        getTypeNameOf in interface IModel
        Parameters:
        instance - The model object whose type is to be determined.
        Returns:
        the name of the type of the model object, instance.
      • createInstance

        public java.lang.Object createInstance​(java.lang.String type,
                                               java.util.Collection<java.lang.Object> parameters)
                                        throws EolModelElementTypeNotFoundException
        This method creates a new row in the worksheet identifiable by type. The given collection is expected to contain one instance of map. Every cell is assigned a value from the map in the order in which the values are returned by the collections framework. If the worksheet does not exist in the spreadsheet then an attempt is made to create it.
        Specified by:
        createInstance in interface IModel
        Overrides:
        createInstance in class Model
        Throws:
        EolModelElementTypeNotFoundException
      • createInstance

        public java.lang.Object createInstance​(java.lang.String type,
                                               java.util.Map<java.lang.String,​java.lang.Object> parameters)
                                        throws EolModelElementTypeNotFoundException
        This method creates a new row in the worksheet identifiable by type. Every cell is assigned a value from the map in the order in which the values are returned by the collections framework. If the worksheet does not exist in the spreadsheet then an attempt is made to create it.
        Parameters:
        type -
        parameters -
        Returns:
        newly created SpreadsheetRow
        Throws:
        EolModelElementTypeNotFoundException - if worksheet cannot be found
      • getElementById

        public java.lang.Object getElementById​(java.lang.String id)
        Specified by:
        getElementById in interface IModel
      • getElementId

        public java.lang.String getElementId​(java.lang.Object instance)
        Specified by:
        getElementId in interface IModel
      • setElementId

        public void setElementId​(java.lang.Object instance,
                                 java.lang.String newId)
        Specified by:
        setElementId in interface IModel
      • owns

        public boolean owns​(java.lang.Object instance)
        Description copied from interface: IModel
        Used to test whether an object is contained in this model.
        Specified by:
        owns in interface IModel
        Parameters:
        instance - the Java object to test.
        Returns:
        true if and only if instance is contained by this model.
      • hasType

        public boolean hasType​(java.lang.String type)
        Specified by:
        hasType in interface IModel
      • isInstantiable

        public boolean isInstantiable​(java.lang.String type)
        Specified by:
        isInstantiable in interface IModel
      • store

        public boolean store​(java.lang.String location)
        Specified by:
        store in interface IModel
      • store

        public boolean store()
        Specified by:
        store in interface IModel
      • getReferencesBySource

        public java.util.Set<SpreadsheetReference> getReferencesBySource​(SpreadsheetWorksheet worksheet)
        The purpose of this method is to find all references where the given worksheet is a source i.e. is referencing.
        Parameters:
        worksheet -
        Returns:
        Set
      • getReferencesBySource

        public java.util.Set<SpreadsheetReference> getReferencesBySource​(SpreadsheetWorksheet worksheet,
                                                                         SpreadsheetColumn column)
        The purpose of this method is to find all references where the given worksheet and column is a source i.e. are referencing.
        Parameters:
        worksheet -
        column -
        Returns:
        Set
      • getReferencesByTarget

        public java.util.Set<SpreadsheetReference> getReferencesByTarget​(SpreadsheetWorksheet worksheet)
        The purpose of this method is to find all references where the given worksheet is a target i.e. being referenced.
        Parameters:
        worksheet -
        Returns:
        Set
      • getReferencesByTarget

        public java.util.Set<SpreadsheetReference> getReferencesByTarget​(SpreadsheetWorksheet worksheet,
                                                                         SpreadsheetColumn column)
        The purpose of this method is to find all references where the given worksheet and column is a target i.e. being referenced.
        Parameters:
        worksheet -
        column -
        Returns:
        Set
      • deleteWorksheet

        protected abstract void deleteWorksheet​(SpreadsheetWorksheet worksheet)
        The purpose of this method is to delete the given worksheet from this spreadsheet
        Parameters:
        worksheet -