/**
 * Copyright (C) 2009-2017 Simonsoft Nordic AB
 *
 * 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 se.simonsoft.cms.indexing.workflow;

import javax.enterprise.context.ApplicationScoped;

import se.repos.indexing.IndexingDoc;
import se.simonsoft.cms.publish.config.databinds.job.PublishJobManifest;
import se.simonsoft.cms.publish.config.databinds.job.PublishJobOptions;

@ApplicationScoped
public class WorkflowExtractionPublish extends WorkflowExtraction {

	
	public void handle(WorkflowIndexingInput input, IndexingDoc fields) {
		
		PublishJobOptions options = (PublishJobOptions) deserializeOption(input.getOptions(), PublishJobOptions.class);
		
		// Focus on fields available in the manifest in order to support reindexing.
		PublishJobManifest manifest = options.getManifest();
		
		
		
	}
	
	
}

@@ -655,16 +655,67 @@
 kflow;%0A%0A
+import java.util.Map;%0Aimport java.util.Map.Entry;%0A%0A
 import j
@@ -1362,19 +1362,1175 @@
 );%0A%09%09%0A%09%09
-%0A%09%09
+fields.setField(%22embd_%22 + input.getWorkflow() + %22_format%22, manifest.getJob().get(%22format%22));%0A%09%09if (manifest.getJob().containsKey(%22profiling%22)) %7B%0A%09%09%09fields.setField(%22embd_%22 + input.getWorkflow() + %22_profiling%22, manifest.getJob().get(%22profiling%22));%0A%09%09%7D%0A%09%09fields.setField(%22embd_%22 + input.getWorkflow() + %22_start%22, manifest.getJob().get(%22start%22));%0A%09%09fields.setField(%22embd_%22 + input.getWorkflow() + %22_topics%22, manifest.getJob().get(%22topics%22));%0A%09%09%0A%09%09%0A%09%09if (manifest.getDocument() != null) %7B%0A%09%09%09// TODO: #1438 Handle multiple abbreviated versions.%0A%09%09%09%0A%09%09%09// TODO: #1592 Normalize versionrelease for string sorting in SolR.%0A%09%09%09%0A%09%09%09handleManifestMap(%22embd_%22 + input.getWorkflow() + %22_document%22, manifest.getDocument(), fields);%0A%09%09%7D%0A%09%09%0A%09%09if (manifest.getCustom() != null) %7B%0A%09%09%09handleManifestMap(%22embd_%22 + input.getWorkflow() + %22_custom%22, manifest.getCustom(), fields);%0A%09%09%7D%0A%09%09%0A%09%09// Currently ignoring %22meta%22 since it is intended for the target system.%0A%09%7D%0A%09%0A%09%0A%09private void handleManifestMap(String prefix, Map%3CString, String%3E map, IndexingDoc fields) %7B%0A%09%09for (Entry%3CString, String%3E e: map.entrySet()) %7B%0A%09%09%09fields.setField(prefix + %22_%22 + e.getKey(), e.getValue());%09%09%09%0A%09%09%7D
 %0A%09%7D%0A%09%0A%09%0A

Index 'publish' executions.