DataSearchQueryBuilder { public DataSearchQueryBuilder metadataAttribute() { String content = dsf.getMetadataAttributeQuery(); if (!Strings.isNullOrEmpty(content)) { Splittable attr = StringQuoter.createSplittable(); Splittable attrBool = addChild(attr, BOOL); Splittable attrShouldList = addArray(attrBool, "should"); Splittable metadata = metadataNested(content, METADATA_ATTRIBUTE); appendArrayItem(attrShouldList, metadata); Splittable childFileQuery = childQuery("file_metadata", metadata.deepCopy()); appendArrayItem(attrShouldList, childFileQuery); Splittable childFolderQuery = childQuery("folder_metadata", metadata.deepCopy()); appendArrayItem(attrShouldList, childFolderQuery); appendArrayItem(mustList, attr); } return this; } DataSearchQueryBuilder(DiskResourceQueryTemplate dsf, UserInfo userinfo); String buildFullQuery(); String taggedWith(); DataSearchQueryBuilder ownedBy(); DataSearchQueryBuilder createdWithin(); DataSearchQueryBuilder file(); DataSearchQueryBuilder fileSizeRange(); String getQuery(); DataSearchQueryBuilder metadataAttribute(); DataSearchQueryBuilder metadataValue(); DataSearchQueryBuilder modifiedWithin(); DataSearchQueryBuilder negatedFile(); DataSearchQueryBuilder sharedWith(); @Override String toString(); Splittable getSimpleQuery(String field, String userEntry); static final String METADATA_VALUE; static final String METADATA_ATTRIBUTE; static final String FIELDS; static final String QUERY_STRING; static final String LESSER; static final String GREATER; static final String RANGE2; static final String WILDCARD; static final String OR_OPERATOR; static final String DATE_MODIFIED; static final String QUERY2; static final String PATH; static final String METADATA2; static final String NESTED2; static final String HAS_CHILD; static final String FILE_SIZE; static final String LABEL; static final String DATE_CREATED; static final String BOOL; }
@Test public void testMetadataAttribute() { final String expectedValue = setMetadataAttributeQuery("some* metadata* to* search* for*"); String result = new DataSearchQueryBuilder(dsf, userInfoMock).metadataAttribute().toString(); assertEquals(wrappedQuery(expectedValue), result); }