private boolean checkFilteredXSSF() {
		XSSFWorkbook currentXSSFWorkbook = (XSSFWorkbook) this.currentWorkbook;
     		POIXMLProperties props = currentXSSFWorkbook.getProperties();
		SimpleDateFormat format = new SimpleDateFormat(MSExcelParser.DATE_FORMAT); 
		// check for each defined property
		// check if we need to match all
		boolean matchAll=true;
		boolean matchFull=true;
		boolean matchOnce=false;
		if (this.hocr.getMetaDataFilter().get(MATCH_ALL)!=null) {
			if ("true".equalsIgnoreCase(this.hocr.getMetaDataFilter().get(MATCH_ALL))) {
				matchAll=true;
				LOG.info("matching all metadata properties");
			} else if ("false".equalsIgnoreCase(this.hocr.getMetaDataFilter().get(MATCH_ALL)))	{
				matchAll=false;
				LOG.info("matching at least one metadata property");
			} else {
				LOG.error("Metadata property matchAll not defined correctly. Assuming that at only least one attribute needs to match");
			}
		}
		// check core properties
		String corePropertyName;
		POIXMLProperties.CoreProperties coreProp=props.getCoreProperties();
		corePropertyName="category";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getCategory();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
					LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="contentstatus";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getContentStatus();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="contenttype";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getContentType();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="created";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				Date corePropStr=coreProp.getCreated();
				if ((corePropStr!=null) && (format.format(corePropStr).matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+format.format(corePropStr)+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
						LOG.debug(corePropertyName);
				}
		}
		corePropertyName="creator";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getCreator();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="description";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getDescription();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="identifier";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getIdentifier();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="keywords";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getKeywords();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="lastmodifiedbyuser";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getLastModifiedByUser();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="lastprinted";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				Date corePropStr=coreProp.getLastPrinted();
				if ((corePropStr!=null) && (format.format(corePropStr).matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+format.format(corePropStr)+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
						LOG.debug(corePropertyName);
				}
		}
		corePropertyName="modified";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				Date corePropStr=coreProp.getModified();
				if ((corePropStr!=null) && (format.format(corePropStr).matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
						LOG.debug(corePropertyName);
				}
		}
		corePropertyName="revision";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getRevision();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="subject";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getSubject();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="title";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getTitle();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		// check for custom properties
		POIXMLProperties.CustomProperties custProp = props.getCustomProperties();
		for (Map.Entry<String,String> entry: this.hocr.getMetaDataFilter().entrySet()) {
			if (entry.getKey().startsWith("custom.")) {
				String strippedKey=entry.getKey().substring("custom.".length());
				if (strippedKey.length()>0) {
					String valueMatch=entry.getValue();
					if (valueMatch!=null) {
						
						if ((custProp.getProperty(strippedKey)!=null) && (custProp.getProperty(strippedKey).getName()!=null)&& (custProp.getProperty(strippedKey).getLpwstr().matches(valueMatch))) {
		matchOnce=true;
	} else {
		matchFull=false;
	}
					}
				}
			}
		}		
		
		if (!(matchAll)) {
			return  matchOnce;
		} else {
			return matchFull;
		}
	}
private boolean checkFilteredXSSF ( ) { XSSFWorkbook currentXSSFWorkbook = ( XSSFWorkbook ) this . currentWorkbook ; POIXMLProperties props = currentXSSFWorkbook . getProperties ( ) ; SimpleDateFormat format = new SimpleDateFormat ( MSExcelParser . DATE_FORMAT ) ; boolean matchAll = true ; boolean matchFull = true ; boolean matchOnce = false ; if ( this . hocr . getMetaDataFilter ( ) . get ( MATCH_ALL ) != null ) { if ( "true" . equalsIgnoreCase ( this . hocr . getMetaDataFilter ( ) . get ( MATCH_ALL ) ) ) { matchAll = true ; LOG . info ( "matching all metadata properties" ) ; } else if ( "false" . equalsIgnoreCase ( this . hocr . getMetaDataFilter ( ) . get ( MATCH_ALL ) ) ) { matchAll = false ; LOG . info ( "matching at least one metadata property" ) ; } else { LOG . error ( "Metadata property matchAll not defined correctly. Assuming that at only least one attribute needs to match" ) ; } } String corePropertyName ; POIXMLProperties . CoreProperties coreProp = props . getCoreProperties ( ) ; corePropertyName = "category" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getCategory ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "contentstatus" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getContentStatus ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "contenttype" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getContentType ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "created" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { Date corePropStr = coreProp . getCreated ( ) ; if ( ( corePropStr != null ) && ( format . format ( corePropStr ) . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + format . format ( corePropStr ) + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; LOG . debug ( corePropertyName ) ; } } corePropertyName = "creator" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getCreator ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "description" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getDescription ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "identifier" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getIdentifier ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "keywords" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getKeywords ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "lastmodifiedbyuser" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getLastModifiedByUser ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "lastprinted" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { Date corePropStr = coreProp . getLastPrinted ( ) ; if ( ( corePropStr != null ) && ( format . format ( corePropStr ) . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + format . format ( corePropStr ) + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; LOG . debug ( corePropertyName ) ; } } corePropertyName = "modified" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { Date corePropStr = coreProp . getModified ( ) ; if ( ( corePropStr != null ) && ( format . format ( corePropStr ) . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; LOG . debug ( corePropertyName ) ; } } corePropertyName = "revision" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getRevision ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "subject" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getSubject ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } corePropertyName = "title" ; if ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) != null ) { String corePropStr = coreProp . getTitle ( ) ; if ( ( corePropStr != null ) && ( corePropStr . matches ( this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ) ) { matchOnce = true ; } else { matchFull = false ; LOG . debug ( NOT_MATCHING + corePropStr + ":" + this . hocr . getMetaDataFilter ( ) . get ( corePropertyName ) ) ; } } POIXMLProperties . CustomProperties custProp = props . getCustomProperties ( ) ; for ( Map . Entry < String , String > entry : this . hocr . getMetaDataFilter ( ) . entrySet ( ) ) { if ( entry . getKey ( ) . startsWith ( "custom." ) ) { String strippedKey = entry . getKey ( ) . substring ( "custom." . length ( ) ) ; if ( strippedKey . length ( ) > 0 ) { String valueMatch = entry . getValue ( ) ; if ( valueMatch != null ) { if ( ( custProp . getProperty ( strippedKey ) != null ) && ( custProp . getProperty ( strippedKey ) . getName ( ) != null ) && ( custProp . getProperty ( strippedKey ) . getLpwstr ( ) . matches ( valueMatch ) ) ) { matchOnce = true ; } else { matchFull = false ; } } } } } if ( ! ( matchAll ) ) { return matchOnce ; } else { return matchFull ; } }
/*
Check if document matches the metadata filters for XSSF documents.

@return true, if it matches, false if not