Search in sources :

Example 1 with BatchFile

use of org.kuali.kfs.sys.batch.BatchFile in project cu-kfs by CU-CommunityApps.

the class CuBatchFileLookupableHelperServiceImpl method getSearchResults.

@Override
public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
    List<BatchFile> results = new ArrayList<BatchFile>();
    IOFileFilter filter = FileFilterUtils.fileFileFilter();
    String fileNamePattern = fieldValues.get("fileName");
    IOFileFilter fileNameBasedFilter = getFileNameBasedFilter(fileNamePattern);
    if (fileNameBasedFilter != null) {
        filter = FileFilterUtils.andFileFilter(filter, fileNameBasedFilter);
    }
    String lastModifiedDate = fieldValues.get("lastModifiedDate");
    IOFileFilter lastModifiedDateBasedFilter = getLastModifiedDateBasedFilter(lastModifiedDate);
    if (lastModifiedDateBasedFilter != null) {
        filter = FileFilterUtils.andFileFilter(filter, lastModifiedDateBasedFilter);
    }
    BatchFileFinder finder = new BatchFileFinder(results, filter);
    List<File> selectedDirectories = getSelectedDirectories(getSelectedPaths());
    if (selectedDirectories.isEmpty()) {
        List<File> rootDirectories = retrieveRootDirectories();
        finder.find(rootDirectories);
    } else {
        finder.find(selectedDirectories);
    }
    return results;
}
Also used : BatchFile(org.kuali.kfs.sys.batch.BatchFile) ArrayList(java.util.ArrayList) IOFileFilter(org.apache.commons.io.filefilter.IOFileFilter) BatchFile(org.kuali.kfs.sys.batch.BatchFile) File(java.io.File)

Example 2 with BatchFile

use of org.kuali.kfs.sys.batch.BatchFile in project cu-kfs by CU-CommunityApps.

the class CreateDoneKualiBatchFileAdminAction method createDone.

public ActionForward createDone(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    KualiBatchFileAdminForm fileAdminForm = (KualiBatchFileAdminForm) form;
    String filePath = BatchFileUtils.resolvePathToAbsolutePath(fileAdminForm.getFilePath());
    File file = new File(filePath).getAbsoluteFile();
    BatchFile batchFile = new BatchFile();
    batchFile.setFile(file);
    if (!SpringContext.getBean(CreateDoneBatchFileAuthorizationService.class).canCreateDoneFile(batchFile, GlobalVariables.getUserSession().getPerson())) {
        throw new RuntimeException("Error: not authorized to create a .done file");
    }
    String status = createDoneFile(filePath);
    request.setAttribute("status", status);
    return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
Also used : CreateDoneBatchFile(edu.cornell.kfs.sys.batch.CreateDoneBatchFile) BatchFile(org.kuali.kfs.sys.batch.BatchFile) KualiBatchFileAdminForm(org.kuali.kfs.sys.web.struts.KualiBatchFileAdminForm) CreateDoneBatchFile(edu.cornell.kfs.sys.batch.CreateDoneBatchFile) File(java.io.File) BatchFile(org.kuali.kfs.sys.batch.BatchFile)

Example 3 with BatchFile

use of org.kuali.kfs.sys.batch.BatchFile in project cu-kfs by CU-CommunityApps.

the class CreateDoneBatchFileLookupableHelperServiceImpl method getCustomActionUrls.

@Override
public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
    List<HtmlData> links = new ArrayList<HtmlData>();
    BatchFile batchFile = (BatchFile) businessObject;
    if (canCreateDoneFile(batchFile)) {
        links.add(getCreateDoneUrl(batchFile));
    }
    return links;
}
Also used : BatchFile(org.kuali.kfs.sys.batch.BatchFile) ArrayList(java.util.ArrayList) HtmlData(org.kuali.kfs.kns.lookup.HtmlData) AnchorHtmlData(org.kuali.kfs.kns.lookup.HtmlData.AnchorHtmlData)

Aggregations

BatchFile (org.kuali.kfs.sys.batch.BatchFile)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 CreateDoneBatchFile (edu.cornell.kfs.sys.batch.CreateDoneBatchFile)1 IOFileFilter (org.apache.commons.io.filefilter.IOFileFilter)1 HtmlData (org.kuali.kfs.kns.lookup.HtmlData)1 AnchorHtmlData (org.kuali.kfs.kns.lookup.HtmlData.AnchorHtmlData)1 KualiBatchFileAdminForm (org.kuali.kfs.sys.web.struts.KualiBatchFileAdminForm)1