@Override public List<String> getFormsByDeployment( String deploymentId ) { Map<String, String> forms = formManagerService.getAllFormsByDeployment( deploymentId ); if (forms != null) { ArrayList<String> result = new ArrayList<String>( forms.keySet() ); Collections.sort( result ); return result; } return null; } }
public void indexDeploymentForms(String containerId) { Map<String, String> forms = formManagerService.getAllFormsByDeployment(containerId); if (forms != null) { List<String> supportedFormsOnly = forms.entrySet() .stream() .filter( entry -> entry.getKey().endsWith( ".frm" ) ) .map( entry -> entry.getValue() ) .collect(Collectors.toList()); if (!supportedFormsOnly.isEmpty()) { Map<String, String> formsByDeployment = new HashMap<>(); indexedForms.put(containerId, formsByDeployment); for (String formContent : supportedFormsOnly) { String formId = formReader.readFromString(formContent).getId(); formsByDeployment.put(formId, formContent); } } } }
protected String render( String formName, String deploymentId ) { String formContent = formManagerService.getFormByKey( deploymentId, formName); if ( !StringUtils.isEmpty( formContent ) ) { return generateRenderingContextString( formContent, formManagerService.getAllFormsByDeployment( deploymentId ) ); } return null; }
@Override public Form getFormById( String ctxUID, long formId ) { FormRenderContext renderContext = formRenderContextManager.getRootContext( ctxUID ); if ( renderContext != null ) { try { if ( renderContext.getForm().getId().equals( new Long( formId ) ) ) { return renderContext.getForm(); } Map forms = formManagerService.getAllFormsByDeployment( renderContext.getDeploymentId() ); if ( forms == null ) forms = renderContext.getContextForms(); String header = formSerializationManager.generateHeaderFormFormId( formId ); for ( Iterator it = forms.keySet().iterator(); it.hasNext(); ) { String key = ( String ) it.next(); Object form = forms.get( key ); if ( form instanceof Form ) { if ( ( ( Form ) form ).getId().equals( formId ) ) { return ( Form ) form; } } else if ( form instanceof String && form.toString().trim().startsWith( header ) ) { Form result = formSerializationManager.loadFormFromXML( ( String ) form ); renderContext.getContextForms().put( key, result ); return result; } } } catch ( Exception e ) { log.warn( "Error getting form {} from context {}: {}", formId, ctxUID, e ); } } return null; }