Skip navigation links

Package com.orchestranetworks.addon.tese

Provides classes and interfaces required for the Search and History operations.

See: Description

Package com.orchestranetworks.addon.tese Description

Provides classes and interfaces required for the Search and History operations. It ispossible implement a custom algorithm also.

Before executing a search, you must first define a configuration for the {addon.label}.

        //Dataset in which you want to perform a search
        Adaptation dataset;
        SearchConfigurationContext context = new SearchConfigurationContext();
        context.setDataset(dataset);
        SearchConfiguration configuration = SearchOperationsFactory.getSearchOperations()
                                .getConfiguration(context);
        List<SearchTableConfiguration> tableConfigurations = configuration.getTablesConfigurations()      
        List<SchemaNode> tableSelecteds = new ArrayList<SchemaNode>();              
        for(SearchTableConfiguration tableConfig : tableConfigurations)
        {
                AdaptationTable tableItem = dataset.getTable(tableConfig.getTablePath());
                tableSelecteds.add(tableItem.getTableNode());
        }
        SearchContext searchContext = new SearchContext(
                                                dataset,
                                                Locale.US,
                                                tableSelecteds,
                                                searchText, //Search term 
                                                BigDecimal.valueOf(configuration.getSensitivityDefaultValue()),
                                                session);
        DatasetSearchResult datasetResult= SearchOperationsFactory.getSearchOperations().searchDataset(searchContext);

To launch a search at the repository level, do as follows:

        //the repository to search
        Repository repository;
        
        //a table in the repository to search
        AdaptationTable table1;
        
        //another table to search
        Path tablePath;
        HomeKey homeKey;
        AdaptationName adaptationName;
        
        List<TableDescriptor> tableDescriptors = new ArrayList<TableDescriptor>();
        TableDescriptor tableDescriptor1 = new TableDescriptor(table1);
        TableDescriptor tableDescriptor2 = new TableDescriptor(tablePath, adaptationName, homeKey);
        tableDescriptors.add(tableDescriptor1);
        tableDescriptors.add(tableDescriptor2);
        
        //keyword used to search
        String query = "keyword";
        
        //save the search history or not.
        boolean savedToHistory = false;
        
        //current user session
        Session session;
        
        RepositorySearchContext searchContext = new RepositorySearchContext(
                repository,
                tableDescriptors,
                query,
                savedToHistory,
                session);
        RepositorySearchResult searchResult = SearchOperationsFactory.getSearchOperations()
                .search(searchContext);

Sample usage of HistoryOperations.

        Repository repository;
        Session session;
        Adaptation dataset;
        AdaptationTable table;
        HistoryOperations historyOperations = HistoryOperationsFactory.getHistoryOperations();
        
        //Deletes all records in the History table for the current user at the repository search scope.
        historyOperations.clearRepositorySearchHistory(repository, session);
        
        //Deletes all records in the History table for the current user at the dataset search scope.
        historyOperations.clearDatasetSearchHistory(repository, dataset, session);
        
        //Deletes all records in the History table for the current user at the table search scope.
        historyOperations.clearTableSearchHistory(repository, new TableDescriptor(table), session);

To implement a custom algorithm, do as follows:

Firstly, define a custom algorithm by extending the SearchDistance interface:

        public class CustomAlgorithmDefinition implements AlgorithmDefinition
        {
                public List<ParameterDefinition> getParameters()
                {
                        return null;
                }

                public SearchComparator getAlgorithm(AlgorithmDefinitionContext adContext)
                {
                        if (adContext == null)
                        {
                                return new CustomAlgorithm(null, Locale.US);
                        }
                        return new CustomAlgorithm(adContext.getField(), adContext.getLocale());
                }
                public Class<SearchAlgorithmConfiguration> getSearchConfigurationClass()
                {
                 return SearchAlgorithmConfiguration.class;
                }

                public UserMessage checkParameterValueRange(List<InputParameter> parameters, Locale locale)
                {
                        return null;
                }
        }

Secondly, define the a Definition class:

        public class CustomAlgorithmDefinition implements AlgorithmDefinition
        {
                public List<ParameterDefinition> getParameters()
                {
                        return null;
                }

                public SearchComparator getAlgorithm(AlgorithmDefinitionContext adContext)
                {
                        if (adContext == null)
                        {
                                return new CustomAlgorithm(null, Locale.US);
                        }
                        return new CustomAlgorithm(adContext.getField(), adContext.getLocale());
                }
                public Class<SearchAlgorithmConfiguration> getSearchConfigurationClass()
                {
                 return SearchAlgorithmConfiguration.class;
                }

                public UserMessage checkParameterValueRange(List<InputParameter> parameters, Locale locale)
                {
                        return null;
                }
        }

Finally, register the algorithm:

        AlgorithmCatalog.add(new CustomAlgorithmDefinition());
Skip navigation links

Add-ons Version 4.5.22.

Copyright 2001-2025. Cloud Software Group, Inc. All rights reserved.
All third party product and company names and third party marks mentioned in this document are the property of their respective owners and are mentioned for identification.