Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * Copyright 2011 JBoss Inc
    * 
    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
    * use this file except in compliance with the License. You may obtain a copy of
    * the License at
    * 
    * http://www.apache.org/licenses/LICENSE-2.0
    * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   * License for the specific language governing permissions and limitations under
   * the License.
   */
  
  package org.drools.guvnor.server;
  
  import java.util.Date;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  
  import org.mvel2.MVEL;
  
 
This is the implementation of the repository service to drive the GWT based front end. Generally requests for this are passed through from RepositoryServiceServlet - and Seam manages instances of this.
 
 public class ServiceImplementation
     implements
 
     private static final long          serialVersionUID = 510l;
 
     private static final LoggingHelper log              = LoggingHelper.getLoggerServiceImplementation.class );
 
     @Inject @Preferred
     private RulesRepository            rulesRepository;
 
     @Inject
     private ServiceSecurity            serviceSecurity;
 
     @Inject
 
     @Inject
 
     @Inject
 
     @Inject
     private Backchannel                backchannel;
 
     @Inject
     private Identity                   identity;
 
     @WebRemote
     @LoggedIn
     public String[] listWorkspaces() {
         return .listWorkspaces();
     }
 
     @WebRemote
     @LoggedIn
     public void createWorkspace(String workspace) {
         .createWorkspaceworkspace );
     }
 
     @WebRemote
     @LoggedIn
     public void removeWorkspace(String workspace) {
         .removeWorkspaceworkspace );
     }

    
For the time being, module == package
 
     @WebRemote
     @LoggedIn
     public void updateWorkspace(String workspace,
                                 String[] selectedModules,
                                 String[] unselectedModules) {
         for ( String moduleName : selectedModules ) {
             ModuleItem module = .loadModulemoduleName );
             module.addWorkspaceworkspace );
             module.checkin"Add workspace" );
         }
         for ( String moduleName : unselectedModules ) {
             ModuleItem module = .loadModulemoduleName );
             module.removeWorkspaceworkspace );
             module.checkin"Remove workspace" );
         }
     }

    
This will create a new asset. It will be saved, but not checked in. The initial state will be the draft state. Returns the UUID of the asset.
 
     @WebRemote
     @LoggedIn
     //@Restrict("#{identity.checkPermission(new PackageNameType( packageName ),initialPackage)}")
     public String createNewRule(String ruleName,
                                 String description,
                                 String initialCategory,
                                 String initialPackage,
                                 String formatthrows SerializationException {
 
         .info"USER:" + getCurrentUserName() + " CREATING new asset name [" + ruleName + "] in package [" + initialPackage + "]" );
 
         try {
 
             ModuleItem pkg = .loadModuleinitialPackage );
             AssetItem asset = pkg.addAssetruleName,
                                             description,
                                             initialCategory,
                                             format );
 
             new AssetTemplateCreator().applyPreBuiltTemplatesruleName,
                                                                format,
                                                                asset );
             .save();
 
             push"categoryChange",
                   initialCategory );
             push"packageChange",
                   pkg.getName() );
 
             return asset.getUUID();
         } catch ( RulesRepositoryException e ) {
             if ( e.getCause() instanceof ItemExistsException ) {
                 return "DUPLICATE";
             }
             .error"An error occurred creating new asset" + ruleName + "] in package [" + initialPackage + "]: ",
                        e );
             throw new SerializationExceptione.getMessage() );
 
         }
 
     }

    
This will create a new asset. It will be saved, but not checked in. The initial state will be the draft state. Returns the UUID of the asset.
 
     @WebRemote
     @LoggedIn
     public String createNewRule(NewAssetConfiguration configurationthrows SerializationException {
 
         String assetName = configuration.getAssetName();
         String description = configuration.getDescription();
         String initialCategory = configuration.getInitialCategory();
         String packageName = configuration.getPackageName();
         String format = configuration.getFormat();
 
 
         return createNewRuleassetName,
                               description,
                               initialCategory,
                               packageName,
                               format );
     }

    
This will create a new asset. It will be saved, but not checked in. The initial state will be the draft state. Returns the UUID of the asset.
 
     @WebRemote
     @LoggedIn
     public String createNewRule(NewAssetWithContentConfiguration< ? extends PortableObjectconfigurationthrows SerializationException {
 
         final String assetName = configuration.getAssetName();
         final String description = configuration.getDescription();
         final String initialCategory = configuration.getInitialCategory();
         final String packageName = configuration.getPackageName();
         final String format = configuration.getFormat();
         final PortableObject content = configuration.getContent();
 
 
         .info"USER:" + getCurrentUserName() + " CREATING new asset name [" + assetName + "] in package [" + packageName + "]" );
 
         try {
 
             //Create new Asset
             ModuleItem pkg = .loadModulepackageName );
             AssetItem assetItem = pkg.addAssetassetName,
                                                 description,
                                                 initialCategory,
                                                 format );
 
             //Set the Assets content - no need to use AssetTemplateCreator().applyPreBuiltTemplates() as we are provided a model
             //Use a transient Asset object so we can use ContentHandler to convert between model and persisted format correctly.
             Asset asset = new AssetPopulator().populateFromassetItem );
             ContentHandler handler = ContentManager.getHandlerassetItem.getFormat() );
             asset.setContentcontent );
             handler.storeAssetContentasset,
                                        assetItem );
 
             .save();
 
             push"categoryChange",
                   initialCategory );
             push"packageChange",
                   pkg.getName() );
 
             return assetItem.getUUID();
 
         } catch ( RulesRepositoryException e ) {
             if ( e.getCause() instanceof ItemExistsException ) {
                 return "DUPLICATE";
             }
             .error"An error occurred creating new asset [" + assetName + "] in package [" + packageName + "]: ",
                        e );
             throw new SerializationExceptione.getMessage() );
         }
 
     }

    
This will create a new asset which refers to an existing asset
 
     @WebRemote
     @LoggedIn
     public String createNewImportedRule(String sharedAssetName,
                                         String initialPackagethrows SerializationException {
 
         .info"USER:" + .getSession().getUserID() + " CREATING shared asset imported from global area named [" + sharedAssetName + "] in package [" + initialPackage + "]" );
 
         try {
             ModuleItem packageItem = .loadModuleinitialPackage );
             AssetItem asset = packageItem.addAssetImportedFromGlobalAreasharedAssetName );
             .save();
 
             return asset.getUUID();
         } catch ( RulesRepositoryException e ) {
             if ( e.getCause() instanceof ItemExistsException ) {
                 return "DUPLICATE";
             }
             .error"An error occurred creating shared asset" + sharedAssetName + "] in package [" + initialPackage + "]: ",
                        e );
             throw new SerializationExceptione.getMessage() );
 
         }
 
     }
 
     @WebRemote
     @LoggedIn
     public void deleteUncheckedRule(String uuid) {
 
         AssetItem asset = .loadAssetByUUIDuuid );
 
         ModuleItem packageItem = asset.getModule();
         packageItem.updateBinaryUpToDatefalse );
 
         asset.remove();
 
         .save();
         push"packageChange",
               packageItem.getName() );
     }

    
 
     @WebRemote
     @LoggedIn
     public TableDataResult loadRuleListForState(String stateName,
                                                 int skip,
                                                 int numRows,
                                                 String tableConfigthrows SerializationException {
 
         // TODO: May need to use a filter that acts on both package based and
         // category based.
         RepositoryFilter filter = new AssetItemFilter );
         AssetItemPageResult result = .findAssetsByStatestateName,
                                                                              false,
                                                                              skip,
                                                                              numRows,
                                                                              filter );
         return new TableDisplayHandlertableConfig ).loadRuleListTableresult );
     }

    
 
     @WebRemote
     @LoggedIn
     public TableConfig loadTableConfig(String listName) {
         TableDisplayHandler handler = new TableDisplayHandlerlistName );
         return handler.loadTableConfig();
     }

    
 
     @WebRemote
     @LoggedIn
     public TableDataResult queryMetaData(final MetaDataQuery[] qr,
                                          Date createdAfter,
                                          Date createdBefore,
                                          Date modifiedAfter,
                                          Date modifiedBefore,
                                          boolean seekArchived,
                                          int skip,
                                          int numRowsthrows SerializationException {
         if ( numRows == 0 ) {
             throw new DetailedSerializationException"Unable to return zero results (bug)",
                                                       "probably have the parameters around the wrong way, sigh..." );
         }
 
         Map<StringString[]> q = new HashMap<StringString[]>() {
             {
                 for ( MetaDataQuery aQr : qr ) {
                     String vals = (aQr.valueList == null) ? "" : aQr.valueList.trim();
                     if ( vals.length() > 0 ) {
                         putaQr.attribute,
                                 vals.split",\\s?" ) );
                     }
                 }
             }
         };
 
         DateQuery[] dates = new DateQuery[2];
 
         dates[0] = new DateQuery"jcr:created",
                                   DateUtil.isoDatecreatedAfter ),
                                   DateUtil.isoDatecreatedBefore ) );
         dates[1] = new DateQuery.,
                                   DateUtil.isoDatemodifiedAfter ),
                                   DateUtil.isoDatemodifiedBefore ) );
         AssetItemIterator it = .queryq,
                                                            seekArchived,
                                                            dates );
         // Add Filter to check Permission
         List<AssetItemresultList = new ArrayList<AssetItem>();
 
         RepositoryFilter packageFilter = new ModuleFilter );
         RepositoryFilter categoryFilter = new CategoryFilter );
 
         while ( it.hasNext() ) {
             AssetItem ai = it.next();
             if ( checkPackagePermissionHelperpackageFilter,
                                                ai,
                                                ..getName() ) || checkCategoryPermissionHelpercategoryFilter,
                                                                                                                        ai,
                                                                                                                        ..getName() ) ) {
                 resultList.addai );
             }
         }
 
         return new TableDisplayHandler"searchresults" ).loadRuleListTableresultList,
                                                                              skip,
                                                                              numRows );
     }
 
     private boolean checkPackagePermissionHelper(RepositoryFilter filter,
                                                  AssetItem item,
                                                  String roleType) {
         return filter.acceptgetConfigDataHelperitem.getModule().getUUID() ),
                               roleType );
     }
 
     private Module getConfigDataHelper(String uuidStr) {
         Module data = new Module();
         data.setUuiduuidStr );
         return data;
     }
 
     @WebRemote
     @LoggedIn
     public String createState(String namethrows SerializationException {
         .info"USER:" + getCurrentUserName() + " CREATING state: [" + name + "]" );
         try {
             name = HtmlCleaner.cleanHTMLname );
             String uuid = .createStatename ).getNode().getUUID();
             .save();
             return uuid;
         } catch ( RepositoryException e ) {
             throw new SerializationException"Unable to create the status." );
         }
     }
 
     @WebRemote
     @LoggedIn
     public void removeState(String namethrows SerializationException {
         .info"USER:" + getCurrentUserName() + " REMOVING state: [" + name + "]" );
 
         try {
             .loadStatename ).remove();
             .save();
 
         } catch ( RulesRepositoryException e ) {
             throw new DetailedSerializationException"Unable to remove status. It is probably still used (even by archived items).",
                                                       e.getMessage() );
         }
     }
 
     @WebRemote
     @LoggedIn
     public void renameState(String oldName,
                             String newNamethrows SerializationException {
         .info"USER:" + getCurrentUserName() + " RENAMING state: [" + oldName + "] to [" + newName + "]" );
         .renameStateoldName,
                                           newName );
 
     }
 
     @WebRemote
     @LoggedIn
     public String[] listStates() throws SerializationException {
         StateItem[] states = .listStates();
         String[] result = new String[states.length];
         for ( int i = 0; i < states.lengthi++ ) {
             result[i] = states[i].getName();
         }
         return result;
     }
 
     @WebRemote
     public void clearRulesRepository() {
 
         admin.clearRulesRepository();
     }
 
     @WebRemote
     @LoggedIn
     public String[] getCustomSelectors() throws SerializationException {
         return SelectorManager.getInstance().getCustomSelectors();
     }
 
     @WebRemote
     @LoggedIn
     public String[] listRulesInGlobalArea() throws SerializationException {
     }
 
     @WebRemote
     @LoggedIn
     public String[] listImagesInGlobalArea() throws SerializationException {
     }

    
 
     @WebRemote
     public LogEntry[] showLog() {
 
         return LoggingHelper.getMessages();
     }
 
     @WebRemote
     public PageResponse<LogPageRowshowLog(PageRequest request) {
         if ( request == null ) {
             throw new IllegalArgumentException"request cannot be null" );
         }
         if ( request.getPageSize() != null && request.getPageSize() < 0 ) {
             throw new IllegalArgumentException"pageSize cannot be less than zero." );
         }
 
 
         long start = System.currentTimeMillis();
         LogEntry[] logEntries = LoggingHelper.getMessages();
         .debug"Search time: " + (System.currentTimeMillis() - start) );
 
         List<LogPageRowrowList = new LogPageRowBuilder()
                                        .withPageRequestrequest )
                                         .withIdentity )
                                        .withContentlogEntries )
                                            .build();
 
         PageResponse<LogPageRowresponse = new PageResponseBuilder<LogPageRow>()
                                                 .withStartRowIndexrequest.getStartRowIndex() )
                                                 .withPageRowListrowList )
                                                 .withTotalRowSizeExact()
                                                 .withLastPage( (rowList.size() + request.getStartRowIndex()) == logEntries.length )
                                                 .withTotalRowSizelogEntries.length )
                                                     .build();
         long methodDuration = System.currentTimeMillis() - start;
         .debug"Retrieved Log Entries in " + methodDuration + " ms." );
         return response;
     }
 
     @WebRemote
     public void cleanLog() {
 
         LoggingHelper.cleanLog();
     }
 
     @WebRemote
     @LoggedIn
     public String[] loadDropDownExpression(String[] valuePairs,
                                            String expression) {
         Map<StringStringcontext = new HashMap<StringString>();
 
         for ( String valuePair : valuePairs ) {
             if ( valuePair == null ) {
                 return new String[0];
             }
             String[] pair = valuePair.split"=" );
             context.putpair[0],
                          pair[1] );
         }
         // first interpolate the pairs
         expression = (String) TemplateRuntime.evalexpression,
                                                     context );
 
         // now we can eval it for real...
         Object result = MVEL.evalexpression );
         if ( result instanceof String[] ) {
             return (String[]) result;
         } else if ( result instanceof List ) {
             List l = (Listresult;
             String[] xs = new String[l.size()];
             for ( int i = 0; i < xs.lengthi++ ) {
                 Object el = l.geti );
                 xs[i] = el.toString();
             }
             return xs;
         } else {
             return null;
         }
     }

    
 
     @LoggedIn
     public Map<StringList<String>> listUserPermissions() {
         return new PermissionManager ).listUsers();
     }
 
     @LoggedIn
         if ( request == null ) {
             throw new IllegalArgumentException"request cannot be null" );
         }
         if ( request.getPageSize() != null && request.getPageSize() < 0 ) {
             throw new IllegalArgumentException"pageSize cannot be less than zero." );
         }
 
 
         long start = System.currentTimeMillis();
         Map<StringList<String>> permissions = new PermissionManager ).listUsers();
 
         .debug"Search time: " + (System.currentTimeMillis() - start) );
 
         List<PermissionsPageRowrowList = new PermissionPageRowBuilder()
                                                 .withPageRequestrequest )
                                                 .withIdentity )
                                                 .withContentpermissions )
                                                     .build();
 
                                                         .withStartRowIndexrequest.getStartRowIndex() )
                                                         .withTotalRowSizepermissions.size() )
                                                         .withTotalRowSizeExact()
                                                         .withPageRowListrowList )
                                                         .withLastPage( (rowList.size() + request.getStartRowIndex()) == permissions.size() )
                                                             .build();
         long methodDuration = System.currentTimeMillis() - start;
         .debug"Retrieved Log Entries in " + methodDuration + " ms." );
         return response;
     }
 
     @LoggedIn
     public Map<StringList<String>> retrieveUserPermissions(String userName) {
 
         PermissionManager pm = new PermissionManager );
         return pm.retrieveUserPermissionsuserName );
     }
 
     @LoggedIn
     public void updateUserPermissions(String userName,
                                       Map<StringList<String>> perms) {
 
         PermissionManager pm = new PermissionManager );
 
         .info"Updating user permissions for userName [" + userName + "] to [" + perms + "]" );
         pm.updateUserPermissionsuserName,
                                   perms );
         .save();
     }
 
     @Deprecated
     @LoggedIn
     public String[] listAvailablePermissionTypes() {
         return RoleTypes.listAvailableTypes();
     }
 
     @LoggedIn
         RoleType[] roleTypes = RoleType.values();
         List<Stringvalues = new ArrayList<String>();
         for ( RoleType roleType : roleTypes ) {
             values.addroleType.getName() );
         }
         return values;
     }
 
     @LoggedIn
     public boolean isDoNotInstallSample() {
         try {
             return .isDoNotInstallSample();
         } catch ( RepositoryException e ) {
             return true;
         }
     }
 
     @LoggedIn
     public void setDoNotInstallSample() {
         try {
             .setDoNotInstallSample();
         } catch ( RepositoryException e ) {
             //Ignored
         }
     }
 
     @LoggedIn
     public void deleteUser(String userName) {
         .info"Removing user permissions for user name [" + userName + "]" );
         PermissionManager pm = new PermissionManager );
         pm.removeUserPermissionsuserName );
         .save();
     }
 
     @LoggedIn
     public void createUser(String userName) {
         .info"Creating user permissions, user name [" + userName + "]" );
         PermissionManager pm = new PermissionManager );
         pm.createUseruserName );
         .save();
     }

    
 
     @LoggedIn
     public TableDataResult loadInbox(String inboxNamethrows DetailedSerializationException {
         try {
             UserInbox ib = new UserInbox );
             if ( inboxName.equals. ) ) {
                 return UserInbox.toTableib.loadRecentOpened(),
                                           false );
             } else if ( inboxName.equals. ) ) {
                 return UserInbox.toTableib.loadRecentEdited(),
                                           false );
             } else {
                 return UserInbox.toTableib.loadIncoming(),
                                           true );
             }
         } catch ( Exception e ) {
             .error"Unable to load Inbox: " + e.getMessage() );
             throw new DetailedSerializationException"Unable to load Inbox",
                                                       e.getMessage() );
         }
     }
 
     @LoggedIn
         if ( request == null ) {
             throw new IllegalArgumentException"request cannot be null" );
         }
         if ( request.getPageSize() != null && request.getPageSize() < 0 ) {
             throw new IllegalArgumentException"pageSize cannot be less than zero." );
         }
 
         String inboxName = request.getInboxName();
         PageResponse<InboxPageRowresponse = new PageResponse<InboxPageRow>();
         long start = System.currentTimeMillis();
 
         try {
 
             List<InboxEntryentries = new UserInbox ).loadEntriesinboxName );
 
             .debug"Search time: " + (System.currentTimeMillis() - start) );
 
             Iterator<InboxEntryiterator = entries.iterator();
             List<InboxPageRowrowList = new InboxPageRowBuilder()
                                             .withPageRequestrequest )
                                             .withIdentity )
                                             .withContentiterator )
                                                 .build();
 
             response = new PageResponseBuilder<InboxPageRow>()
                             .withStartRowIndexrequest.getStartRowIndex() )
                             .withTotalRowSizeentries.size() )
                             .withTotalRowSizeExact()
                             .withPageRowListrowList )
                             .withLastPage( !iterator.hasNext() )
                                 .build();
             long methodDuration = System.currentTimeMillis() - start;
             .debug"Queried inbox ('" + inboxName + "') in " + methodDuration + " ms." );
 
         } catch ( Exception e ) {
             .error"Unable to load Inbox: " + e.getMessage() );
             throw new DetailedSerializationException"Unable to load Inbox",
                                                       e.getMessage() );
         }
         return response;
     }

    
Load and process the repository configuration templates.
 
     public String processTemplate(String name,
                                   Map<StringObjectdata) {
         try {
             Configuration configuration = new Configuration();
             configuration.setObjectWrappernew DefaultObjectWrapper() );
             configuration.setTemplateUpdateDelay( 0 );
 
             Template template = new Templatename,
                                               new InputStreamReaderServiceImplementation.class.getResourceAsStream"/repoconfig/" + name + ".xml" ) ),
                                               configuration );
             StringWriter stringwriter = new StringWriter();
             template.processdata,
                               stringwriter );
             return StringEscapeUtils.escapeXmlstringwriter.toString() );
         } catch ( Exception e ) {
             return "";
         }
     }

    
Returns the Spring context elements specified by SpringContextElementsManager

Returns:
a Map containing the key,value pairs of data.
Throws:
org.drools.guvnor.client.rpc.DetailedSerializationException
 
         try {
             return SpringContextElementsManager.getInstance().getElements();
         } catch ( IOException ex ) {
             .error"Error loading Spring Context Elements",
                        ex );
             throw new DetailedSerializationException"Error loading Spring Context Elements",
                                                       "View server logs for more information" );
         }
     }
 
     @WebRemote
     @LoggedIn
         if ( request == null ) {
             throw new IllegalArgumentException"request cannot be null" );
         }
         if ( request.getPageSize() != null && request.getPageSize() < 0 ) {
             throw new IllegalArgumentException"pageSize cannot be less than zero." );
         }
 
         long start = System.currentTimeMillis();
         AssetItemIterator iterator = .queryFullTextrequest.getSearchText(),
                                                                          request.isSearchArchived() );
         .debug"Search time: " + (System.currentTimeMillis() - start) );
 
         List<QueryPageRowrowList = new QueryFullTextPageRowBuilder()
                                             .withPageRequestrequest )
                                             .withIdentity )
                                             .withContentiterator )
                                                 .build();
         boolean bHasMoreRows = iterator.hasNext();
         PageResponse<QueryPageRowresponse = new PageResponseBuilder<QueryPageRow>()
                                                       .withStartRowIndexrequest.getStartRowIndex() )
                                                       .withPageRowListrowList )
                                                       .withLastPage( !bHasMoreRows )
                                                           .buildWithTotalRowCount( -1 );
 
         long methodDuration = System.currentTimeMillis() - start;
         .debug"Queried repository (Full Text) for (" + request.getSearchText() + ") in " + methodDuration + " ms." );
         return response;
     }
 
     @WebRemote
     @LoggedIn
         if ( request == null ) {
             throw new IllegalArgumentException"request cannot be null" );
         }
         if ( request.getPageSize() != null && request.getPageSize() < 0 ) {
             throw new IllegalArgumentException"pageSize cannot be less than zero." );
         }
 
         // Setup parameters for generic repository query
         Map<StringString[]> queryMap = createQueryMaprequest.getMetadata() );
 
         DateQuery[] dates = createDateQueryForRepositoryrequest );
 
         long start = System.currentTimeMillis();
         AssetItemIterator iterator = .queryqueryMap,
                                                                  request.isSearchArchived(),
                                                                  dates );
         .debug"Search time: " + (System.currentTimeMillis() - start) );
 
         List<QueryPageRowrowList = new QueryMetadataPageRowBuilder()
                                             .withPageRequestrequest )
                                             .withIdentity )
                                             .withContentiterator )
                                             .build();
         boolean bHasMoreRows = iterator.hasNext();
         PageResponse<QueryPageRowresponse = new PageResponseBuilder<QueryPageRow>()
                                                 .withStartRowIndexrequest.getStartRowIndex() )
                                                 .withPageRowListrowList )
                                                 .withLastPage( !bHasMoreRows )
                                                 .buildWithTotalRowCount( -1 );//its impossible to know the exact selected count until we'v reached
                                                                               //the end of iterator
         long methodDuration = System.currentTimeMillis() - start;
         .debug"Queried repository (Metadata) in " + methodDuration + " ms." );
         return response;
 
     }
 
     private Map<StringString[]> createQueryMap(final List<MetaDataQuerymetaDataQuerys) {
         Map<StringString[]> queryMap = new HashMap<StringString[]>();
         for ( MetaDataQuery metaDataQuery : metaDataQuerys ) {
             String vals = (metaDataQuery.valueList == null) ? "" : metaDataQuery.valueList.trim();
             if ( vals.length() > 0 ) {
                 queryMap.putmetaDataQuery.attribute,
                               vals.split",\\s?" ) );
             }
         }
         return queryMap;
     }
 
         DateQuery[] dates = new DateQuery[2];
         dates[0] = new DateQuery"jcr:created",
                                   DateUtil.isoDaterequest.getCreatedAfter() ),
                                   DateUtil.isoDaterequest.getCreatedBefore() ) );
         dates[1] = new DateQuery.,
                                   DateUtil.isoDaterequest.getLastModifiedAfter() ),
                                   DateUtil.isoDaterequest.getLastModifiedBefore() ) );
         return dates;
     }
 
     @WebRemote
     @LoggedIn
         if ( request == null ) {
             throw new IllegalArgumentException"request cannot be null" );
         }
         if ( request.getPageSize() != null && request.getPageSize() < 0 ) {
             throw new IllegalArgumentException"pageSize cannot be less than zero." );
         }
 
         // Do query
         long start = System.currentTimeMillis();
 
         // TODO: May need to use a filter for both package and categories
         // NOTE: Filtering is handled in repository.findAssetsByState()
         int numRowsToReturn = (request.getPageSize() == null ? -1 : request.getPageSize());
         AssetItemPageResult result = .findAssetsByStaterequest.getStateName(),
                                                                              false,
                                                                              request.getStartRowIndex(),
                                                                              numRowsToReturn,
                                                                              new AssetItemFilter ) );
         .debug"Search time: " + (System.currentTimeMillis() - start) );
 
         // Populate response
         boolean bHasMoreRows = result.hasNext;
 
         List<StatePageRowrowList = new StatePageRowBuilder()
                                             .withPageRequestrequest )
                                             .withIdentity )
                                             .withContentresult.assets.iterator() )
                                                 .build();
 
         PageResponse<StatePageRowresponse = new PageResponseBuilder<StatePageRow>()
                                                     .withStartRowIndexrequest.getStartRowIndex() )
                                                     .withPageRowListrowList )
                                                     .withLastPage( !bHasMoreRows )
                                                         .buildWithTotalRowCount( -1 );