Thursday, 13 November 2014

Content Engine JAVA API

Content Engine API's

// Get Connection

    public Connection getCEConnectionHTTP() {
        try{
        String UserName = "p8admin";
        String Password = "p8admin";
        String Url = "http://localhost:9080/wsi/FNCEWS40MTOM/";
        String Stanza = "FileNetP8WSI";
        connection = Factory.Connection.getConnection(Url);
        System.out.println("Connection is established");
        subject = UserContext.createSubject(connection, UserName, Password, Stanza);
        UserContext uc = UserContext.get();
        uc.pushSubject(subject);
        return connection;
        }
        catch (EngineRuntimeException engineRuntimeException) {
            System.out.println("RuntimeException occured while getting the connection = "+ engineRuntimeException.getMessage());
                           
            engineRuntimeException.printStackTrace();
        }
        return connection;
    }


//Get Domain


public Domain getFileNetDomain()
    {
        String domainName = "P8DEVAirtelAfrica";
        Domain domain = null;
        try
        {
        domain = Factory.Domain.fetchInstance(getCEConnectionHTTP(), domainName, null);
        }
        catch (EngineRuntimeException engineRuntimeException) {
            System.out.println("RuntimeException occured while getting the Domain = "+ engineRuntimeException.getMessage());
                           
            engineRuntimeException.printStackTrace();
        }
        return domain;
    }


// Get Object Store

public ObjectStore getObjectStore(Domain domain, String objectStoreName) {
        ObjectStore os = null;
        try {
//            domain = null;
            os = Factory.ObjectStore.fetchInstance(domain, objectStoreName, null);
            System.out.println("ObjectStor Details " + os.get_DisplayName());
        } catch (EngineRuntimeException ere) {
            System.out.println("getObjectStore :" + ere.getExceptionCode().getKey());
            ere.printStackTrace();
        }
        return os;
    }









No comments:

Post a Comment