Java tutorial
package com.enprowess.migration.bulkimport.webscripts; import java.util.HashMap; import java.util.Map; import com.enprowess.migration.bulkimport.BulkFilesystemImporter; import org.alfresco.service.descriptor.DescriptorService; import org.alfresco.service.license.LicenseDescriptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptRequest; /** * This webscript gets the license version if it is enterprise edition then only it will starts the bulk import * @author Khushbu * */ public class BulkFilesystemImportStatusWebScript extends DeclarativeWebScript { @SuppressWarnings("unused") private static final Log logger = LogFactory.getLog(BulkFilesystemImportStatusWebScript.class); @SuppressWarnings("unused") private static final String RESULT_IMPORT_STATUS = "importStatus"; @SuppressWarnings("unused") private static final String IS_ENTERPRISE = "isEnterprise"; private BulkFilesystemImporter bulkImporter; private DescriptorService descriptorService; public void setBulkImporter(BulkFilesystemImporter bulkImporter) { this.bulkImporter = bulkImporter; } public void setDescriptorService(DescriptorService descriptorService) { this.descriptorService = descriptorService; } protected Map<String, Object> executeImpl(WebScriptRequest request, Status status, Cache cache) { Map<String, Object> result = new HashMap<>(); cache.setNeverCache(true); LicenseDescriptor licenseDescriptor = this.descriptorService.getLicenseDescriptor(); boolean isEnterprise = licenseDescriptor != null; result.put("isEnterprise", Boolean.valueOf(isEnterprise)); result.put("importStatus", this.bulkImporter.getStatus()); return result; } }