Package com.force.sdk.jpa.schema

Examples of com.force.sdk.jpa.schema.ForceSchemaWriter


     * @param storeManager the store manager
     * @param mconn the managed connection that contains connections for the Force.com APIs
     */
    public void emit(ForceStoreManager storeManager, ForceManagedConnection mconn) {
        try {
            ForceSchemaWriter schemaWriter = storeManager.getSchemaWriter();
            if (customObject != null) {
                schemaWriter.addCustomObject(customObject, cmd, storeManager, this);
               
                for (CustomField field : customObject.getFields()) {
                    schemaWriter.addCustomField(customObject, field);
                }
               
                customObject = null;
            }
        } catch (Exception x) {
View Full Code Here


     * @param mconn ForceMangedConnection
     * @throws Exception Exception
     */
    public static void cleanSchema(ForceManagedConnection mconn) throws Exception {
        PartnerConnection pc = (PartnerConnection) mconn.getConnection();
        ForceSchemaWriter writer = new ForceSchemaWriter(new SchemaDeleteProperty(true, true));
        DescribeGlobalResult objs = pc.describeGlobal();
        for (DescribeGlobalSObjectResult s : objs.getSobjects()) {
            CustomObject co = new CustomObject();
            co.setFullName(s.getName());
            DescribeSObjectResult sobject = pc.describeSObject(s.getName());
            Field[] fields = sobject.getFields();
            List<CustomField> customFields = new ArrayList<CustomField>();
            for (Field f : fields) {
                if (f.isCustom()) {
                    CustomField cf = new CustomField();
                    cf.setFullName(f.getName());
                    if (!s.isCustom()) {
                        if (!customFieldsToKeep.contains((s.getName() + "." + f.getName()).toLowerCase())) {
                            writer.addCustomField(co, cf);
                        }
                    } else {
                        writer.addCustomField(co, cf);
                        customFields.add(cf);
                    }
                }
            }
            if (customFields.size() > 0) {
                co.setFields(customFields.toArray(new CustomField[customFields.size()]));
            }
            if (s.isCustom()) {
                writer.addCustomObject(co, true);
            }
        }
        writer.write(mconn);
    }
View Full Code Here

TOP

Related Classes of com.force.sdk.jpa.schema.ForceSchemaWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.