@Test public void destructuringCanBeAppliedOnlyToDateOrDatetimeFields() { Stream.of(ANY,ENCRYPTED,TEXT,MLTEXT,CONTENT,INT,LONG,FLOAT,DOUBLE, BOOLEAN,QNAME,CATEGORY,NODE_REF,CHILD_ASSOC_REF,ASSOC_REF, PATH,LOCALE,PERIOD) .map(qname -> { PropertyDefinition propertyThatCannotBeDestructured = mock(PropertyDefinition.class); DataTypeDefinition def = Mockito.mock(DataTypeDefinition.class); when(def.getName()).thenReturn(qname); when(propertyThatCannotBeDestructured.getDataType()).thenReturn(def); return propertyThatCannotBeDestructured;}) .forEach(property -> assertFalse( "Destructuring must be supported only on Date or Datetime fields!", infoServer.canBeDestructured(property, "somedatatype@sd@{http: }
boolean canBeDestructured(PropertyDefinition definition, String fieldName) { return !definition.isMultiValued() && fieldName != null && fieldName.contains("@") && dateFieldDestructuringHasBeenEnabledOnThisInstance && (definition.getDataType().getName().equals(DataTypeDefinition.DATETIME) || definition.getDataType().getName().equals(DataTypeDefinition.DATE)); }
SolrInformationServer implements InformationServer { boolean canBeDestructured(PropertyDefinition definition, String fieldName) { return !definition.isMultiValued() && fieldName != null && fieldName.contains("@") && dateFieldDestructuringHasBeenEnabledOnThisInstance && (definition.getDataType().getName().equals(DataTypeDefinition.DATETIME) || definition.getDataType().getName().equals(DataTypeDefinition.DATE)); } }
SolrInformationServer implements InformationServer { boolean canBeDestructured(PropertyDefinition definition, String fieldName) { return !definition.isMultiValued() && fieldName != null && fieldName.contains("@") && dateFieldDestructuringHasBeenEnabledOnThisInstance && (definition.getDataType().getName().equals(DataTypeDefinition.DATETIME) || definition.getDataType().getName().equals(DataTypeDefinition.DATE)); } SolrInformationServer(AlfrescoCoreAdminHandler adminHandler, SolrCore core, SOLRAPIClient repositoryClient); }
SolrInformationServer implements InformationServer { boolean canBeDestructured(PropertyDefinition definition, String fieldName) { return !definition.isMultiValued() && fieldName != null && fieldName.contains("@") && dateFieldDestructuringHasBeenEnabledOnThisInstance && (definition.getDataType().getName().equals(DataTypeDefinition.DATETIME) || definition.getDataType().getName().equals(DataTypeDefinition.DATE)); } SolrInformationServer(AlfrescoCoreAdminHandler adminHandler, SolrCore core, SOLRAPIClient repositoryClient); @Override AlfrescoCoreAdminHandler getAdminHandler(); @Override boolean cascadeTrackingEnabled(); @Override synchronized void initSkippingDescendantDocs(); @Override void addContentOutdatedAndUpdatedCounts(NamedList<Object> report); @Override void afterInitModels(); @Override AclReport checkAclInIndex(Long aclid, AclReport aclReport); @Override IndexHealthReport reportIndexTransactions(Long minTxId, IOpenBitSet txIdsInDb, long maxTxId); @Override IndexHealthReport reportAclTransactionsInIndex(Long minAclTxId, IOpenBitSet aclTxIdsInDb, long maxAclTxId); @Override List<TenantDbId> getDocsWithUncleanContent(); @Override void addCommonNodeReportInfo(NodeReport nodeReport); @Override void commit(); @Override void hardCommit(); @Override boolean commit(boolean openSearcher); @Override void deleteByAclChangeSetId(Long aclChangeSetId); @Override void deleteByAclId(Long aclId); @Override void deleteByNodeId(Long nodeId); @Override void deleteByTransactionId(Long transactionId); @Override List<AlfrescoModel> getAlfrescoModels(); @SuppressWarnings({ "unchecked", "rawtypes" }) @Override Iterable<Entry<String, Object>> getCoreStats(); @Override DictionaryComponent getDictionaryService(String alternativeDictionary); @Override int getTxDocsSize(String targetTxId, String targetTxCommitTime); @Override int getAclTxDocsSize(String aclTxId, String aclTxCommitTime); @Override Set<Long> getErrorDocIds(); @Override long getHoleRetention(); @Override M2Model getM2Model(QName modelQName); @Override Map<String, Set<String>> getModelErrors(); @Override NamespaceDAO getNamespaceDAO(); @Override IOpenBitSet getOpenBitSetInstance(); @Override int getRegisteredSearcherCount(); @Override ISimpleOrderedMap<T> getSimpleOrderedMapInstance(); @Override TrackerStats getTrackerStats(); @Override TrackerState getTrackerInitialState(); @Override void continueState(TrackerState state); @Override long indexAcl(List<AclReaders> aclReaderList, boolean overwrite); @Override void indexAclTransaction(AclChangeSet changeSet, boolean overwrite); @Override AclChangeSet getMaxAclChangeSetIdAndCommitTimeInIndex(); @Override void dirtyTransaction(long txnId); @Override void capIndex(long dbid); @Override void maintainCap(long dbid); @Override long nodeCount(); @Override long maxNodeId(); @Override long minNodeId(); @Override long getIndexCap(); @Override void indexNode(Node node, boolean overwrite); @Override List<NodeMetaData> getCascadeNodes(List<Long> txnIds); @Override void cascadeNodes(List<NodeMetaData> nodeMetaDatas, boolean overwrite); @Override void updateContent(TenantDbId docRef); @Override void indexNodes(List<Node> nodes, boolean overwrite); @Override void updateTransaction(Transaction txn); @Override void indexTransaction(Transaction info, boolean overwrite); @Override Transaction getMaxTransactionIdAndCommitTimeInIndex(); @Override boolean isInIndex(String id); @Override List<Transaction> getCascades(int num); @Override boolean txnInIndex(long txnId, boolean populateCache); @Override boolean aclChangeSetInIndex(long changeSetId, boolean populateCache); @Override void clearProcessedTransactions(); @Override void clearProcessedAclChangeSets(); @Override boolean putModel(M2Model model); @Override void rollback(); @Override void registerTrackerThread(); @Override void unregisterTrackerThread(); @Override void reindexNodeByQuery(String query); @Override String getBaseUrl(); @Override int getPort(); @Override String getHostName(); @Override void setCleanContentTxnFloor(long cleanContentTxnFloor); @Override void setCleanCascadeTxnFloor(long cleanCascadeTxnFloor); Properties getProps(); int getDocListSize(String query); }
SolrInformationServer implements InformationServer { boolean canBeDestructured(PropertyDefinition definition, String fieldName) { return !definition.isMultiValued() && fieldName != null && fieldName.contains("@") && dateFieldDestructuringHasBeenEnabledOnThisInstance && (definition.getDataType().getName().equals(DataTypeDefinition.DATETIME) || definition.getDataType().getName().equals(DataTypeDefinition.DATE)); } SolrInformationServer(AlfrescoCoreAdminHandler adminHandler, SolrCore core, SOLRAPIClient repositoryClient); @Override AlfrescoCoreAdminHandler getAdminHandler(); @Override boolean cascadeTrackingEnabled(); @Override synchronized void initSkippingDescendantDocs(); @Override void addContentOutdatedAndUpdatedCounts(NamedList<Object> report); @Override void afterInitModels(); @Override AclReport checkAclInIndex(Long aclid, AclReport aclReport); @Override IndexHealthReport reportIndexTransactions(Long minTxId, IOpenBitSet txIdsInDb, long maxTxId); @Override IndexHealthReport reportAclTransactionsInIndex(Long minAclTxId, IOpenBitSet aclTxIdsInDb, long maxAclTxId); @Override List<TenantDbId> getDocsWithUncleanContent(); @Override void addCommonNodeReportInfo(NodeReport nodeReport); @Override void commit(); @Override void hardCommit(); @Override boolean commit(boolean openSearcher); @Override void deleteByAclChangeSetId(Long aclChangeSetId); @Override void deleteByAclId(Long aclId); @Override void deleteByNodeId(Long nodeId); @Override void deleteByTransactionId(Long transactionId); @Override List<AlfrescoModel> getAlfrescoModels(); @SuppressWarnings({ "unchecked", "rawtypes" }) @Override Iterable<Entry<String, Object>> getCoreStats(); @Override DictionaryComponent getDictionaryService(String alternativeDictionary); @Override int getTxDocsSize(String targetTxId, String targetTxCommitTime); @Override int getAclTxDocsSize(String aclTxId, String aclTxCommitTime); @Override Set<Long> getErrorDocIds(); @Override long getHoleRetention(); @Override M2Model getM2Model(QName modelQName); @Override Map<String, Set<String>> getModelErrors(); @Override NamespaceDAO getNamespaceDAO(); @Override IOpenBitSet getOpenBitSetInstance(); @Override int getRegisteredSearcherCount(); @Override ISimpleOrderedMap<T> getSimpleOrderedMapInstance(); @Override TrackerStats getTrackerStats(); @Override TrackerState getTrackerInitialState(); @Override void continueState(TrackerState state); @Override long indexAcl(List<AclReaders> aclReaderList, boolean overwrite); @Override void indexAclTransaction(AclChangeSet changeSet, boolean overwrite); @Override AclChangeSet getMaxAclChangeSetIdAndCommitTimeInIndex(); @Override void dirtyTransaction(long txnId); @Override void capIndex(long dbid); @Override void maintainCap(long dbid); @Override long nodeCount(); @Override long maxNodeId(); @Override long minNodeId(); @Override long getIndexCap(); @Override void indexNode(Node node, boolean overwrite); @Override List<NodeMetaData> getCascadeNodes(List<Long> txnIds); @Override void cascadeNodes(List<NodeMetaData> nodeMetaDatas, boolean overwrite); @Override void updateContent(TenantDbId docRef); @Override void indexNodes(List<Node> nodes, boolean overwrite); @Override void updateTransaction(Transaction txn); @Override void indexTransaction(Transaction info, boolean overwrite); @Override Transaction getMaxTransactionIdAndCommitTimeInIndex(); @Override boolean isInIndex(String id); @Override List<Transaction> getCascades(int num); @Override boolean txnInIndex(long txnId, boolean populateCache); @Override boolean aclChangeSetInIndex(long changeSetId, boolean populateCache); @Override void clearProcessedTransactions(); @Override void clearProcessedAclChangeSets(); @Override boolean putModel(M2Model model); @Override void rollback(); @Override void registerTrackerThread(); @Override void unregisterTrackerThread(); @Override void reindexNodeByQuery(String query); @Override String getBaseUrl(); @Override int getPort(); @Override String getHostName(); @Override void setCleanContentTxnFloor(long cleanContentTxnFloor); @Override void setCleanCascadeTxnFloor(long cleanCascadeTxnFloor); Properties getProps(); int getDocListSize(String query); static final String AND; static final String OR; static final String DOC_TYPE_NODE; static final String DOC_TYPE_ACL; static final String DOC_TYPE_TX; static final String DOC_TYPE_ACL_TX; static final String SOLR_HOST; static final String SOLR_PORT; static final String SOLR_BASEURL; static final String CASCADE_TRACKER_ENABLED; static final String UNIT_OF_TIME_YEAR_FIELD_SUFFIX; static final String UNIT_OF_TIME_QUARTER_FIELD_SUFFIX; static final String UNIT_OF_TIME_MONTH_FIELD_SUFFIX; static final String UNIT_OF_TIME_DAY_FIELD_SUFFIX; static final String UNIT_OF_TIME_DAY_OF_WEEK_FIELD_SUFFIX; static final String UNIT_OF_TIME_DAY_OF_YEAR_FIELD_SUFFIX; static final String UNIT_OF_TIME_HOUR_FIELD_SUFFIX; static final String UNIT_OF_TIME_MINUTE_FIELD_SUFFIX; static final String UNIT_OF_TIME_SECOND_FIELD_SUFFIX; }