Package org.geoserver.catalog

Examples of org.geoserver.catalog.Info


                       
                        if ( Info.class.isAssignableFrom( g.getReturnType() ) ) {
                            //another info is the changed property, it could be one of two cases
                            // 1) the info object was changed in place: x.getY().setFoo(...)
                            // 2) a new info object was set x.setY(...)
                            Info original = (Info) g.invoke(proxyObject, null);
                            Info modified = (Info) unwrap(v);
                            if ( original == modified ) {
                                //case 1, in this case get the proxy and commit it
                                if ( v instanceof Proxy ) {
                                    ModificationProxy h = handler( v );
                                    if ( h != null && h.isDirty() ) {
View Full Code Here


                       
                        if ( Info.class.isAssignableFrom( g.getReturnType() ) ) {
                            //another info is the changed property, it could be one of two cases
                            // 1) the info object was changed in place: x.getY().setFoo(...)
                            // 2) a new info object was set x.setY(...)
                            Info original = (Info) g.invoke(proxyObject, null);
                            Info modified = (Info) unwrap(v);
                            if ( original == modified ) {
                                //case 1, in this case get the proxy and commit it
                                if ( v instanceof Proxy ) {
                                    ModificationProxy h = handler( v );
                                    if ( h != null && h.isDirty() ) {
View Full Code Here

        return (T) sessionFactory.getCurrentSession().merge(entity);
    }
   
    protected void delete(Info entity) {
        Session session = sessionFactory.getCurrentSession();
        Info attached = (Info) session.merge(entity);
        session.delete(attached);
    }
View Full Code Here

            for (int i = 0; i < propertyNames.length; i++) {
                propertyNamesChanged.add(propertyNames[i]);
            }
        }
       
        Info info = (Info) entity;
        Event e = new Event(info, propertyNamesChanged);
       
        if (events.get() == null) {
            events.set(new ArrayList());
        }
View Full Code Here

    /**
     * @param info
     */
    private void testSaved(Info info) {
        Info saved = database.save(info);
        assertNotSame(info, saved);
        if (info instanceof DataStoreInfo) {
            assertEquals(((DataStoreInfo) info).getWorkspace(),
                    ((DataStoreInfo) saved).getWorkspace());
        }
View Full Code Here

                       
                        if ( Info.class.isAssignableFrom( g.getReturnType() ) ) {
                            //another info is the changed property, it could be one of two cases
                            // 1) the info object was changed in place: x.getY().setFoo(...)
                            // 2) a new info object was set x.setY(...)
                            Info original = (Info) g.invoke(proxyObject, null);
                            Info modified = (Info) unwrap(v);
                            if ( original == modified ) {
                                //case 1, in this case get the proxy and commit it
                                if ( v instanceof Proxy ) {
                                    ModificationProxy h = handler( v );
                                    if ( h != null && h.isDirty() ) {
View Full Code Here

        Integer relatedObjectId = null;
        final Integer concreteTargetPropertyOid;

        if (isRelationShip) {
            Info relatedObject = lookUpRelatedObject(info, prop, colIndex);
            if (relatedObject == null) {
                concreteTargetPropertyOid = null;
            } else {
                // the related property may refer to an abstract type (e.g.
                // LayerInfo.resource.name), so we need to find out the actual property type id (for
                // example, whether it belongs to FeatureTypeInfo or CoverageInfo)
                relatedObject = ModificationProxy.unwrap(relatedObject);
                relatedObjectId = this.findObjectId(relatedObject);

                Integer targetPropertyOid = prop.getPropertyType().getTargetPropertyOid();
                PropertyType targetProperty;
                String targetPropertyName;

                Class<?> targetQueryType;
                ClassMappings classMappings = ClassMappings.fromImpl(relatedObject.getClass());
                targetQueryType = classMappings.getInterface();
                targetProperty = dbMappings.getPropertyType(targetPropertyOid);
                targetPropertyName = targetProperty.getPropertyName();

                Set<Integer> propertyTypeIds;
View Full Code Here

        checkNotNull(id, "Can't modify an object with no id");

        final ModificationProxy modificationProxy = ModificationProxy.handler(info);
        Preconditions.checkNotNull(modificationProxy, "Not a modification proxy: ", info);

        final Info oldObject = (Info) modificationProxy.getProxyObject();

        cache.invalidate(id);

        // get changed properties before h.commit()s
        final Iterable<Property> changedProperties = dbMappings.changedProperties(oldObject, info);

        // see HACK block bellow
        final boolean updateResouceLayersName = info instanceof ResourceInfo
                && modificationProxy.getPropertyNames().contains("name");

        modificationProxy.commit();

        Map<String, ?> params;

        // get the object's internal id
        final Integer objectId = findObjectId(info);
        final String blob;
        try {
            byte[] value = binding.objectToEntry(info);
            blob = new String(value, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw Throwables.propagate(e);
        }
        String updateStatement = "update object set blob = :blob where oid = :oid";
        params = params("blob", blob, "oid", objectId);
        logStatement(updateStatement, params);
        template.update(updateStatement, params);

        updateQueryableProperties(oldObject, objectId, changedProperties);

        cache.invalidate(id);
        Class<T> clazz = ClassMappings.fromImpl(oldObject.getClass()).getInterface();

        // / <HACK>
        // we're explicitly changing the resourceinfo's layer name property here because
        // LayerInfo.getName() is a derived property. This can be removed once LayerInfo.name become
        // a regular JavaBean property
View Full Code Here

                                + changedProp.getPropertyName() + "=" + values);

                colIndex = changedProp.isCollectionProperty() ? (i + 1) : 0;

                if (isRelationship) {
                    final Info relatedObject = lookUpRelatedObject(info, changedProp, colIndex);
                    relatedOid = relatedObject == null ? null : findObjectId(relatedObject);
                    relatedPropertyType = changedProp.getPropertyType().getTargetPropertyOid();
                } else {
                    // it's a self property, lets update the value on the property table
                    relatedOid = null;
View Full Code Here

    }

    public <T extends Info> T getById(final String id, final Class<T> type) {
        Assert.notNull(id, "id");

        Info info = null;
        try {
            final Callable<? extends Info> valueLoader;
            if (CatalogInfo.class.isAssignableFrom(type)) {
                valueLoader = new CatalogLoader(id);
            } else {
                valueLoader = new ConfigLoader(id);
            }

            info = cache.get(id, valueLoader);

        } catch (CacheLoader.InvalidCacheLoadException notFound) {
            return null;
        } catch (ExecutionException e) {
            Throwables.propagate(e.getCause());
        }

        if (info == null) {
            return null;
        }
        if (info instanceof CatalogInfo) {
            info = resolveCatalog((CatalogInfo) info);
        }
        else if (info instanceof ServiceInfo) {
            resolveTransient((ServiceInfo)info);
        }

        if (type.isAssignableFrom(info.getClass())) {
            // use ModificationProxy only in this case as returned object is cached. saveInternal
            // follows suite checking whether the object being saved is a mod proxy, but that's not
            // mandatory in this implementation and should only be the case when the object was
            // obtained by id
            return ModificationProxy.create(type.cast(info), type);
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.Info

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.