Package org.jitterbit.util.persist

Examples of org.jitterbit.util.persist.Persistor


    public void testSaveAndLoad() {
        LdapSearchParametersPersistor toTest = new LdapSearchParametersPersistor();
        XmlPersistor xml = XmlPersistor.newRoot("Test");
        LdapSearchParameters[] entries = createSearchParams();
        for (LdapSearchParameters e : entries) {
            Persistor p = xml.createChild("Params");
            toTest.writeTo(e, p);
        }
        if (PRINT_XML) {
            xml.printToConsole();
        }
View Full Code Here


        }
    }

    private void writeSegmentsTo(Persistor media) {
        SegmentPersistor writer = new SegmentPersistor();
        Persistor segmentRoot = media.createChild("Segments");
        for (Segment s : segmentList) {
            writer.save(s, segmentRoot.createChild("Segment"));
        }
    }
View Full Code Here

            restoreSegmentsFrom(media);
        }
    }

    private void restoreSegmentsFrom(Persistor media) {
        Persistor segmentRoot = media.getFirstChild("Segments");
        if (segmentRoot == null) {
            throw new IllegalArgumentException("Invalid persistor: the Segments root is missing");
        }
        segmentList = Lists.newArrayList();
        SegmentPersistor loader = new SegmentPersistor();
        for (Persistor sp : segmentRoot.getChildren("Segment")) {
            segmentList.add(loader.restoreFrom(sp));
        }
    }
View Full Code Here

        responseStructure.restoreFrom(p.getFirstChild("Response"));
        responseStructure.setOpInfo(opInfo);
    }

    private void restoreCallRestrictions(Persistor p) {
        Persistor child = p.getFirstChild("CallRestrictions");
        if (child != null) {
            callRestriction = new CallRestrictions();
            callRestriction.restoreFrom(child);
        }
    }
View Full Code Here

    }

    private void persistSearchParams(Persistor media) {
        LdapSearchParametersPersistor writer = new LdapSearchParametersPersistor();
        for (Map.Entry<NumericOid, LdapSearchParameters> e : searchParams.entrySet()) {
            Persistor p = media.createChild("SearchParams");
            p.putString("oid", e.getKey().toString());
            Persistor data = p.createChild("Data");
            writer.writeTo(e.getValue(), data);
        }
    }
View Full Code Here

    private void restoreSearchParams(Persistor root) {
        LdapSearchParametersPersistor loader = new LdapSearchParametersPersistor();
        Map<NumericOid, LdapSearchParameters> searchParams = Maps.newHashMap();
        for (Persistor p : root.getChildren("SearchParams")) {
            NumericOid oid = new NumericOid(p.getString("oid"));
            Persistor data = p.getFirstChild("Data");
            searchParams.put(oid, loader.restoreFrom(data));
        }
        this.searchParams = new HashMap<NumericOid, LdapSearchParameters>(searchParams);
    }
View Full Code Here

    private static void logPersistError(Exception ex) {
        ErrorLog.log(ObjectClassDefinition.class, "Failed to store object class definitions in local cache", ex);
    }

    private static void persistDefinition(ObjectClassDefinition classDef, Persistor parent) {
        Persistor child = parent.createChild(CLASS_DEFINITION);
        child.putString(OID, classDef.getOid().toString());
        child.putString(NAME, classDef.getName());
        child.putString(DESCRIPTION, classDef.getDescription());
        child.putBoolean(OBSOLETE, classDef.isObsolete());
        child.putString(TYPE, classDef.getType().name());
    }
View Full Code Here

        }

        private XmlPersistor persistProject(IntegrationProject project) {
            XmlPersistor root = XmlPersistor.newRoot("project");
            storeNameAndId(project, root);
            Persistor operations = root.createChild(OPERATIONS);
            addItems(project, operations, EntityType.Operation);
            Persistor schedules = root.createChild(SCHEDULES);
            addItems(project, schedules, EntityType.Schedule);
            return root;
        }
View Full Code Here

        private void processFolder(Persistor parent, Folder folder, EntityType type) {
            assert type == EntityType.Schedule || type == EntityType.Operation;
            for (IntegrationEntity e : folder.getAllChildren()) {
                if (e instanceof org.jitterbit.integration.data.entity.Folder) {
                    Persistor folderPersistor = parent.createChild(FOLDER);
                    storeNameAndId(folder, folderPersistor);
                    processFolder(folderPersistor, (Folder) e, type);
                } else {
                    if (type == EntityType.Operation) {
                        storeOperation((Operation) e, parent.createChild(OPERATION));
View Full Code Here

* @since 3.1.3
*/
public final class LdapStructureAttributePersistor {

    public static void write(LdapStructureAttribute attr, Persistor p) {
        Persistor child = p.createChild(EntryPersistingConstants.ATTRIBUTE);
        child.putString(EntryPersistingConstants.OID, attr.getOid().toString());
        child.putString(EntryPersistingConstants.NAME, attr.getName());
        child.putString(EntryPersistingConstants.DESCRIPTION, attr.getDescription());
        child.putString(EntryPersistingConstants.USAGE_DESCRIPTION, attr.getUsageDescription());
        child.putInteger(EntryPersistingConstants.USE, attr.getUse().ordinal());
        child.putInteger(EntryPersistingConstants.CARDINALITY, attr.getCardinality().ordinal());
        child.putBoolean(EntryPersistingConstants.READ_ONLY, attr.isReadOnly());
        saveSyntaxInfo(attr, child);
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.util.persist.Persistor

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.