package edu.harvard.iq.dataverse.pidproviders;

import edu.harvard.iq.dataverse.AbstractGlobalIdServiceBean;
import edu.harvard.iq.dataverse.DvObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ejb.Stateless;

@Stateless
public class FakePidProviderServiceBean extends AbstractGlobalIdServiceBean {

    @Override
    public boolean alreadyExists(DvObject dvo) throws Exception {
        return true;
    }

    @Override
    public boolean registerWhenPublished() {
        return false;
    }

    @Override
    public List<String> getProviderInformation() {
        ArrayList<String> providerInfo = new ArrayList<>();
        String providerName = "FAKE";
        String providerLink = "http://dataverse.org";
        providerInfo.add(providerName);
        providerInfo.add(providerLink);
        return providerInfo;
    }

    @Override
    public String createIdentifier(DvObject dvo) throws Throwable {
        return "fakeIdentifier";
    }

    @Override
    public Map<String, String> getIdentifierMetadata(DvObject dvo) {
        Map<String, String> map = new HashMap<>();
        return map;
    }

    @Override
    public String modifyIdentifierTargetURL(DvObject dvo) throws Exception {
        return "fakeModifyIdentifierTargetURL";
    }

    @Override
    public void deleteIdentifier(DvObject dvo) throws Exception {
        // no-op
    }

    @Override
    public Map<String, String> lookupMetadataFromIdentifier(String protocol, String authority, String identifier) {
        Map<String, String> map = new HashMap<>();
        return map;
    }

    @Override
    public boolean publicizeIdentifier(DvObject studyIn) {
        return true;
    }

}

@@ -144,16 +144,59 @@
 Object;%0A
+import edu.harvard.iq.dataverse.GlobalId;%0A%0A
 import j
@@ -503,32 +503,149 @@
 turn true;%0A    %7D
+%0A    %0A    @Override%0A    public boolean alreadyExists(GlobalId globalId) throws Exception %7B%0A        return true;%0A    %7D
 %0A%0A    @Override%0A

update Fake provider