Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
<dependencies>
    <dependency>
        <groupId>de.actonic</groupId>
        <artifactId>gdpr-api</artifactId>
        <version>1.0.0<2</version>
    </dependency>
</dependencies>
 
...
 
<Export-Package>
    de.actonic.gdpr.api.*,
</Export-Package>
 
...
 
<DynamicImport-Package>
    de.actonic.jira.gdpr.api.*;resolution:="optional",
</DynamicImport-Package>

...

Code Block
languagejava
package decom.actonicother.exampletest.testGDPRApiPlugin;


import java.util.*;


import com.atlassian.jira.component.*;
import de.actonic.gdpr.api.*;
import org.springframework.beans.factory.*;
import org.springframework.stereotype.*;


@Component
public class Anonymizer implements IGDPRAnonymizer, InitializingBean, DisposableBean {
	...
		// class constructor and some other unnecessary parts are @Overrideskipped 
	...

	@Override
	public List<GDPRAnonymizeObject> search(StringList<String> sourceUsersourceUserKeys) {
		List<GDPRAnonymizeObject> anonymizeObjects = new ArrayList<>();
		for (String sourceUserKey : sourceUserKeys) // here you look for all the data on the incoming parameters and return the result
        return null;
    }
{
			ApplicationUser applicationUser = userManager.getUserByKey(sourceUserKey);
			if (applicationUser != null) {
				Collection<PortalPage> portalPages = portalPageManager.getAllOwnedPortalPages(applicationUser);
				for (PortalPage portalPage : portalPages) {
					anonymizeObjects.add(new GDPRAnonymizeObject(portalPage.getName(), "Dashboard", "/secure/Dashboard.jspa?selectPageId=" + portalPage.getId()));
				}
			}
		}
		return anonymizeObjects;
	}

    @Override
    public List<GDPRAnonymizeObject> anonymize(StringList<String> sourceUsersourceUserKeys, String targetUsertargetUserKey) {
        		// here you anonymize all data by incoming parameters and return the result
        return null;
    }

     @Override
    public void stop() {
        		// here you interrupt the search/anonymization process
    }


    @Override
    public String getPluginName() {
        return "Plugin #2";
    }


    @Override
    public String getNamegetAnonymizerName() {
        return "User actions anonymizer";
    }

     @Override
    public void afterPropertiesSet() throws Exception {
        IGDPRAnonymizeService anonymizeService = ComponentAccessor.getOSGiComponentInstanceOfType(IGDPRAnonymizeService.class);
        if (anonymizeService != null) {
            anonymizeService.addAnonymizer(this);
        }
    }


    @Override
    public void destroy() throws Exception {
        IGDPRAnonymizeService anonymizeService = ComponentAccessor.getOSGiComponentInstanceOfType(IGDPRAnonymizeService.class);
        if (anonymizeService != null) {
            anonymizeService.removeAnonymizer(this);
        }
    }
}

...