Package org.apache.isis.runtimes.dflt.runtime.persistence.oidgenerator.simple

Examples of org.apache.isis.runtimes.dflt.runtime.persistence.oidgenerator.simple.SerialOid


        services = handler.services;
    }

    @Override
    public void registerService(final String name, final Oid oid) {
        final SerialOid soid = (SerialOid) oid;
        final ServiceElement element = new ServiceElement(soid, name);
        services.addElement(element);
        saveServices();
    }
View Full Code Here


        testObjects = new TrialObjects();

        final ExampleValuePojo pojo1 = new ExampleValuePojo();
        pojo1.setName("Fred Smith");
        pojo1.setSize(108);
        SerialOid oid = SerialOid.createPersistent(3);
        object1 = testObjects.createAdapter(pojo1, oid);
        specification = object1.getSpecification();

        final ExampleValuePojo pojo2 = new ExampleValuePojo();
        pojo2.setName("John Brown");
View Full Code Here

            final Object candidateFieldValue = candidateData.get(field);

            if (candidateFieldValue instanceof ReferenceVector) {
                final ReferenceVector patternElements = (ReferenceVector) patternFieldValue;
                for (int i = 0; i < patternElements.size(); i++) {
                    final SerialOid requiredElement = patternElements.elementAt(i); // must
                    // have
                    // this
                    // element
                    boolean requiredFound = false;
                    final ReferenceVector testElements = ((ReferenceVector) candidateFieldValue);
                    for (int j = 0; j < testElements.size(); j++) {
                        if (requiredElement.equals(testElements.elementAt(j))) {
                            requiredFound = true;
                            break;
                        }
                    }
                    if (!requiredFound) {
View Full Code Here

                    final String typeName = attributes.getValue("type");
                    final long version = Long.valueOf(attributes.getValue("ver"), 16).longValue();
                    final String user = attributes.getValue("user");
                    final long id = Long.valueOf(attributes.getValue("id"), 16).longValue();
                    final ObjectSpecification spec = IsisContext.getSpecificationLoader().loadSpecification(typeName);
                    final SerialOid oid = SerialOid.createPersistent(id);
                    object = new ObjectData(spec, oid, new FileVersion(user, version));
                } else if (tagName.equals("collection")) {
                    final String type = attributes.getValue("type");
                    final long version = Long.valueOf(attributes.getValue("ver"), 16).longValue();
                    final String user = attributes.getValue("user");
                    final long id = Long.valueOf(attributes.getValue("id"), 16).longValue();
                    final ObjectSpecification spec = IsisContext.getSpecificationLoader().loadSpecification(type);
                    final SerialOid oid = SerialOid.createPersistent(id);
                    collection = new CollectionData(spec, oid, new FileVersion(user, version));
                } else {
                    throw new SAXException("Invalid data");
                }
            }
View Full Code Here

    @Override
    public void execute(final PersistenceCommandContext context) throws ObjectPersistenceException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("  destroy object " + onObject());
        }
        final SerialOid oid = (SerialOid) onObject().getOid();
        getDataManager().remove(oid);
        onObject().setOptimisticLock(null);
    }
View Full Code Here

    public void testInsertObjectWithOneToManyAssociations() throws ObjectPersistenceException {
        final ObjectData data = createData(Team.class, 99, new FileVersion("user", 13));

        data.initCollection("Members");
        final SerialOid oid[] = new SerialOid[3];
        for (int i = 0; i < oid.length; i++) {
            oid[i] = SerialOid.createPersistent(104 + i);
            data.addElement("Members", oid[i]);
        }
        manager.insertObject(data);
View Full Code Here

     */

    private ObjectData createData(final Class<?> type, final long id, final FileVersion version) {

        final ObjectSpecification noSpec = IsisContext.getSpecificationLoader().loadSpecification(type);
        final SerialOid oid = SerialOid.createPersistent(id);
        return new ObjectData(noSpec, oid, version);

    }
View Full Code Here

    public void testNumberOfInstances() {
        assertEquals(SIZE, manager.numberOfInstances(pattern));
    }

    public void testRemove() throws Exception {
        final SerialOid oid = oids[2];
        manager.remove(oid);

        assertEquals(SIZE - 1, manager.numberOfInstances(pattern));

        final ObjectDataVector instances = manager.getInstances(pattern);
View Full Code Here

        ObjectAdapter object;
        final ObjectSpecification specification = IsisContext.getSpecificationLoader().loadSpecification(cls);
        if (specification.isAggregated() && !specification.isCollection()) {
            final String[] split = id.split("@");
            final SerialOid parentOid = SerialOid.createTransient(Long.parseLong(split[0], 16));
            final AggregatedOid oid = new AggregatedOid(parentOid, split[1]);
            object = IsisContext.getPersistenceSession().recreateAdapter(oid, specification);
        } else {
            object = mappedObject("T" + cls + "@" + id);
        }
View Full Code Here

                final String[] split = id.split("@");
                final ObjectSpecification spec =
                    IsisContext.getSpecificationLoader().loadSpecification(split[0].substring(1));
                final Object pojo = spec.createObject(CreationMode.NO_INITIALIZE);
                final String oidData = split[1];
                final SerialOid oid = SerialOid.createTransient(Long.valueOf(oidData, 16).longValue());
                return IsisContext.getPersistenceSession().recreateAdapter(oid, pojo);
            }
            final ObjectAdapter mappedTransientObject = mapping.getObject();
            LOG.debug("retrieved " + mappedTransientObject.getOid() + " for " + id);
            return mappedTransientObject;
        } else {
            final String[] split = id.split("@");
            final ObjectSpecification spec =
                IsisContext.getSpecificationLoader().loadSpecification(split[0].substring(1));

            try {
                final String oidData = split[1];
                LOG.debug("decoding " + oidData);

                ObjectAdapter loadObject;
                Oid oid;
                // HACK - to remove after fix!
                if (oidType == null) {
                    oidType = IsisContext.getPersistenceSession().getServices().get(0).getOid().getClass();
                }
                if (split.length > 2) {
                    final SerialOid parentOid = SerialOid.createPersistent(Long.parseLong(oidData, 16));
                    oid = new AggregatedOid(parentOid, split[2]);
                    IsisContext.getPersistenceSession().loadObject(parentOid, spec);
                    loadObject = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(oid);
                } else if (oidType.isAssignableFrom(SerialOid.class)) {
                    oid = SerialOid.createPersistent(Long.parseLong(oidData, 16));
View Full Code Here

TOP

Related Classes of org.apache.isis.runtimes.dflt.runtime.persistence.oidgenerator.simple.SerialOid

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.