Examples of GridType


Examples of net.opengis.gml.GridType

                "</GetCoverage>";

        GetCoverageType gc = (GetCoverageType) reader.read(null, new StringReader(request), null);
        assertEquals(1, gc.getRangeSubset().getAxisSubset().size());

        GridType grid = (GridType) gc.getDomainSubset().getSpatialSubset().getGrid().get(0);
        assertEquals(grid.getSrsName(), "EPSG:4326");
        assertEquals(grid.getAxisName().get(0), "Column");
        assertEquals(grid.getAxisName().get(1), "Row");

        GridEnvelope gridLimits = grid.getLimits();
        assertEquals(0, gridLimits.getLow(0));
        assertEquals(0, gridLimits.getLow(1));
        assertEquals(544, gridLimits.getHigh(0));
        assertEquals(489, gridLimits.getHigh(1));
View Full Code Here

Examples of org.geoserver.wcs.kvp.GridType

                gridCRS.setGridBaseCRS("urn:x-ogc:def:crs:EPSG:" + code);
            }

            // check grid type makes sense and apply default otherwise
            String gridTypeValue = gridCRS.getGridType();
            GridType type = GridType.GT2dGridIn2dCrs;
            if (gridTypeValue != null) {
                type = null;
                for (GridType gt : GridType.values()) {
                    if (gt.getXmlConstant().equalsIgnoreCase(gridTypeValue))
                        type = gt;
                }
                if (type == null)
                    throw new WcsException("Unknown grid type " + gridTypeValue,
                            InvalidParameterValue, "GridType");
                else if (type == GridType.GT2dGridIn3dCrs)
                    throw new WcsException("Unsupported grid type " + gridTypeValue,
                            InvalidParameterValue, "GridType");
            }
            gridCRS.setGridType(type.getXmlConstant());

            // check gridcs and apply only value we know about
            String gridCS = gridCRS.getGridCS();
            if (gridCS != null) {
                if (!gridCS.equalsIgnoreCase(GridCS.GCSGrid2dSquare.getXmlConstant()))
                    throw new WcsException("Unsupported grid cs " + gridCS, InvalidParameterValue,
                            "GridCS");
            }
            gridCRS.setGridCS(GridCS.GCSGrid2dSquare.getXmlConstant());

            // check the grid origin and set defaults
            CoordinateReferenceSystem crs = null;
            try {
                crs = CRS.decode(gridCRS.getGridBaseCRS());
            } catch (Exception e) {
                throw new WcsException("Could not understand crs " + gridCRS.getGridBaseCRS(),
                        WcsExceptionCode.InvalidParameterValue, "GridBaseCRS");
            }
            if (!gridCRS.isSetGridOrigin() || gridCRS.getGridOrigin() == null) {
                // if not set, we have a default of "0 0" as a string, since I
                // cannot
                // find a way to make it default to new Double[] {0 0} I'll fix
                // it here
                Double[] origin = new Double[type.getOriginArrayLength()];
                Arrays.fill(origin, 0.0);
                gridCRS.setGridOrigin(origin);
            } else {
                Double[] gridOrigin = (Double[]) gridCRS.getGridOrigin();
                // make sure the origin dimension matches the output crs
                // dimension
                if (gridOrigin.length != type.getOriginArrayLength())
                    throw new WcsException("Grid origin size (" + gridOrigin.length
                            + ") inconsistent with grid type " + type.getXmlConstant()
                            + " that requires (" + type.getOriginArrayLength() + ")",
                            WcsExceptionCode.InvalidParameterValue, "GridOrigin");
                gridCRS.setGridOrigin(gridOrigin);
            }

            // perform same checks on the offsets
            Double[] gridOffsets = (Double[]) gridCRS.getGridOffsets();
            if (gridOffsets != null) {
                // make sure the origin dimension matches the grid type
                if (type.getOffsetArrayLength() != gridOffsets.length)
                    throw new WcsException("Invalid offsets lenght, grid type "
                            + type.getXmlConstant() + " requires " + type.getOffsetArrayLength(),
                            InvalidParameterValue, "GridOffsets");
            } else {
                gridCRS.setGridOffsets(null);
            }
        }
View Full Code Here

Examples of org.hibernate.ogm.type.GridType

      Tuple tuple = tuples.next();
      Object[] entry = new Object[queryReturnTypes.length];

      int i = 0;
      for ( Type type : queryReturnTypes ) {
        GridType gridType = typeTranslator.getType( type );
        entry[i] = gridType.nullSafeGet( tuple, scalarColumns.get( i ), session, null );
        i++;
      }

      if ( entry.length == 1 ) {
        results.add( entry[0] );
View Full Code Here

Examples of org.hibernate.ogm.type.GridType

      associationPersister.flushToCache();
    }
  }

  private Object getReferencedEntity(int propertyIndex) {
    GridType propertyType = gridPropertyTypes[propertyIndex];
    Serializable id = (Serializable) propertyType.hydrate(
        resultset, persister.getPropertyColumnNames( propertyIndex ), session, null
    );

    if ( id != null ) {
      EntityPersister hostingEntityPersister = session.getFactory().getEntityPersister(
          propertyType.getReturnedClass().getName()
      );

      return session.getPersistenceContext().getEntity(
          session.generateEntityKey( id, hostingEntityPersister )
      );
View Full Code Here

Examples of org.hibernate.ogm.type.GridType

      String propertyName,
      Object uniqueKey,
      SessionImplementor session) throws HibernateException {
    //we get the property type for an associated entity
    final int propertyIndex = getPropertyIndex( propertyName );
    final GridType gridUniqueKeyType = getUniqueKeyTypeFromAssociatedEntity( propertyIndex, propertyName );
    //get the associated property index (to get its column names)
    //find the ids per unique property name
    AssociationKeyMetadata associationKeyMetadata = associationKeyMetadataPerPropertyName.get( propertyName );
    if ( associationKeyMetadata == null ) {
      throw new AssertionFailure( "loadByUniqueKey on a non EntityType:" + propertyName );
View Full Code Here

Examples of org.hibernate.ogm.type.GridType

              + " value: " + uniqueKey );
    }
  }

  private GridType getUniqueKeyTypeFromAssociatedEntity(int propertyIndex, String propertyName) {
    GridType gridUniqueKeyType;//get the unique key type and if it's an entity type, get it's identifier type
    final Type uniqueKeyType = getPropertyTypes()[propertyIndex];
    if ( uniqueKeyType.isEntityType() ) {
      //we run under the assumption that we are fully in an OGM world
      EntityType entityType = (EntityType) uniqueKeyType;
      final OgmEntityPersister entityPersister = (OgmEntityPersister) entityType.getAssociatedJoinable( getFactory() );
View Full Code Here

Examples of org.hibernate.ogm.type.GridType

          for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
            boolean include = includeOldField[i] &&
                isPropertyOfTable( i, j ) &&
                versionability[i]; //TODO: is this really necessary????
            if ( include ) {
              final GridType type = types[i];
              //FIXME what do do with settable?
              boolean[] settable = type.toColumnNullness( oldFields[i], factory );
              final Object snapshotValue = type.nullSafeGet(
                  resultset, getPropertyColumnNames( i ), session, object
              );
              comparePropertyAndRaiseSOSE(
                  id,
                  oldFields[i],
                  factory,
                  !type.isEqual( oldFields, snapshotValue, factory )
              );

            }
          }
        }
View Full Code Here

Examples of org.hibernate.ogm.type.GridType

        GridType[] types = gridPropertyTypes;

        for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
          boolean include = isPropertyOfTable( i, j ) && versionability[i];
          if ( include ) {
            final GridType type = types[i];
            final Object snapshotValue = type.nullSafeGet(
                resultset, getPropertyColumnNames( i ), session, object
            );
            //TODO support other entity modes
            if ( ! type.isEqual( loadedState[i], snapshotValue, factory ) ) {
              if ( factory.getStatistics().isStatisticsEnabled() ) {
                factory.getStatisticsImplementor()
                    .optimisticFailure( getEntityName() );
              }
              throw new StaleObjectStateException( getEntityName(), id );
View Full Code Here

Examples of org.hibernate.ogm.type.GridType

        for ( Return queryReturn : customQuery.getCustomQueryReturns() ) {
          ScalarReturn scalarReturn = (ScalarReturn) queryReturn;
          Type type = scalarReturn.getType();

          if ( type != null ) {
            GridType gridType = typeTranslator.getType( type );
            entry[i++] = gridType.nullSafeGet( tuple, scalarReturn.getColumnAlias(), session, null );
          }
          else {
            entry[i++] = tuple.get( scalarReturn.getColumnAlias() );
          }
        }
View Full Code Here

Examples of org.hibernate.ogm.type.GridType

    Map<String, Object> parameterValues = new HashMap<String, Object>( queryParameters.getNamedParameters().size() );
    Tuple dummy = new Tuple();
    TypeTranslator typeTranslator = serviceRegistry.getService( TypeTranslator.class );

    for ( Entry<String, TypedValue> parameter : queryParameters.getNamedParameters().entrySet() ) {
      GridType gridType = typeTranslator.getType( parameter.getValue().getType() );
      gridType.nullSafeSet( dummy, parameter.getValue().getValue(), new String[]{ parameter.getKey() }, null );
      parameterValues.put( parameter.getKey(), dummy.get( parameter.getKey() ) );
    }

    return parameterValues;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.