@@ -0,0 +1,2773 @@
+package com.adobe.aem.scf.extensions;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport javax.jcr.Session;%0A%0Aimport org.apache.felix.scr.annotations.Component;%0Aimport org.apache.felix.scr.annotations.Property;%0Aimport org.apache.felix.scr.annotations.Reference;%0Aimport org.apache.felix.scr.annotations.Service;%0Aimport org.apache.sling.api.SlingHttpServletRequest;%0Aimport org.apache.sling.api.resource.Resource;%0Aimport org.apache.sling.api.resource.ValueMap;%0Aimport org.apache.sling.servlets.post.PostOperation;%0A%0Aimport com.adobe.cq.social.commons.client.api.SocialComponent;%0Aimport com.adobe.cq.social.commons.client.api.SocialComponentFactory;%0Aimport com.adobe.cq.social.commons.client.api.SocialComponentFactoryManager;%0Aimport com.adobe.cq.social.commons.client.endpoints.AbstractSocialOperation;%0Aimport com.adobe.cq.social.commons.client.endpoints.OperationException;%0Aimport com.adobe.cq.social.commons.client.endpoints.SocialOperationResult;%0Aimport com.adobe.cq.social.forum.client.endpoints.ForumOperations;%0A%0A@Component(immediate = true)%0A@Service%0A@Property(name = PostOperation.PROP_OPERATION_NAME, value = %22social:setIdeaStatus%22)%0Apublic class SetStatusOperation extends AbstractSocialOperation implements PostOperation%7B%0A    %0A    @Reference%0A    private ForumOperations forumService;%0A    %0A    @Reference%0A    private SocialComponentFactoryManager srf;%0A%0A    @Override%0A    protected SocialOperationResult performOperation(SlingHttpServletRequest req) throws OperationException %7B%0A        final String statusToSet = req.getParameter(%22status%22);%0A        final Resource idea = req.getResource();%0A        final ValueMap props = idea.adaptTo(ValueMap.class);%0A        final String%5B%5D tags = props.get(%22cq:tags%22, new String%5B%5D%7B%7D);%0A        final List%3CString%3E tagList = new ArrayList%3CString%3E();%0A        for(String tag: tags) %7B%0A            if(!tag.startsWith(%22acmeideas:%22)) %7B%0A                tagList.add(tag);%0A            %7D%0A        %7D%0A        tagList.add(statusToSet);%0A        Map%3CString,Object%3E updates = new HashMap%3CString,Object%3E();%0A        updates.put(%22cq:tags%22, tagList.toArray(new String%5B%5D%7B%7D));%0A        Resource updatedResource = forumService.update(req.getResource(), updates, null, req.getResourceResolver().adaptTo(Session.class));%0A        return new SocialOperationResult(this.getSocialComponentForResource(updatedResource, req), 200, updatedResource.getPath());%0A    %7D%0A%0A    private SocialComponent getSocialComponentForResource(Resource newProject, SlingHttpServletRequest request) %7B%0A        if (newProject == null) %7B%0A            return null;%0A        %7D%0A        final SocialComponentFactory factory = this.srf.getSocialComponentFactory(newProject);%0A        return factory.getSocialComponent(newProject, request);%0A    %7D%0A%0A%7D%0A

Add an SCF Operation endpoint to set the status of an operation