当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionCode.FEATURE_MODEL_PROBLEM属性代码示例

本文整理汇总了Java中org.geomajas.global.ExceptionCode.FEATURE_MODEL_PROBLEM属性的典型用法代码示例。如果您正苦于以下问题:Java ExceptionCode.FEATURE_MODEL_PROBLEM属性的具体用法?Java ExceptionCode.FEATURE_MODEL_PROBLEM怎么用?Java ExceptionCode.FEATURE_MODEL_PROBLEM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.geomajas.global.ExceptionCode的用法示例。


在下文中一共展示了ExceptionCode.FEATURE_MODEL_PROBLEM属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChildCollection

@Override
public EntityCollection getChildCollection(String name) throws LayerException {
	Type type = metadata.getPropertyType(name);
	if (type instanceof CollectionType) {
		CollectionType ct = (CollectionType) type;
		Collection coll = (Collection) metadata.getPropertyValue(object, name, EntityMode.POJO);
		if (coll == null) {
			// normally should not happen, hibernate instantiates it automatically
			coll = (Collection) ct.instantiate(0);
			metadata.setPropertyValue(object, name, coll, EntityMode.POJO);
		}
		String entityName = ct.getAssociatedEntityName((SessionFactoryImplementor) sessionFactory);
		ClassMetadata childMetadata = sessionFactory.getClassMetadata(entityName);
		return new HibernateEntityCollection(metadata, childMetadata, object, coll);
	} else {
		throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:18,代码来源:HibernateEntityMapper.java

示例2: BeanEntity

public BeanEntity(String dataSourceName, Object id) throws LayerException {
	try {
		bean = Class.forName(dataSourceName).newInstance();
		// hard-coded
		if (bean instanceof ManyToOneAttributeBean) {
			List values = ManyToOneAttributeBean.manyToOneValues();
			for (Object value : values) {
				ManyToOneAttributeBean b = (ManyToOneAttributeBean) value;
				if (b.getId().equals(id)) {
					bean = b;
				}
			}
		}
	} catch (Exception e) { // NOSONAR
		throw new LayerException(e, ExceptionCode.FEATURE_MODEL_PROBLEM, "Could not instantiate entity");
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:17,代码来源:BeanEntityMapper.java

示例3: readProperty

private Object readProperty(Object object, String name) throws LayerException {
	if (object != null) {
		PropertyDescriptor d = BeanUtils.getPropertyDescriptor(object.getClass(), name);
		if (d != null && d.getReadMethod() != null) {
			BeanUtils.getPropertyDescriptor(object.getClass(), name);
			Method m = d.getReadMethod();
			if (!Modifier.isPublic(m.getDeclaringClass().getModifiers())) {
				m.setAccessible(true);
			}
			Object value;
			try {
				value = m.invoke(object);
			} catch (Throwable t) {
				throw new LayerException(t, ExceptionCode.FEATURE_MODEL_PROBLEM);
			}
			return value;
		} else {
			return null;
		}
	} else {
		return null;
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:23,代码来源:BeanEntityMapper.java

示例4: writeProperty

private void writeProperty(Object object, String name, Object value) throws LayerException {
	if (object != null) {
		PropertyDescriptor d = BeanUtils.getPropertyDescriptor(object.getClass(), name);
		if (d != null && d.getWriteMethod() != null) {
			Method m = d.getWriteMethod();
			if (!Modifier.isPublic(m.getDeclaringClass().getModifiers())) {
				m.setAccessible(true);
			}
			try {
				m.invoke(object, value);
			} catch (Throwable t) {
				throw new LayerException(t, ExceptionCode.FEATURE_MODEL_PROBLEM);
			}
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:16,代码来源:BeanEntityMapper.java

示例5: getGeometry

public Geometry getGeometry(Object feature) throws LayerException {
	Entity entity = entityMapper.asEntity(feature);
	Object geometry = entity.getAttribute(getGeometryAttributeName());
	if (!wkt || null == geometry) {
		log.debug("bean.getGeometry {}", geometry);
		return (Geometry) geometry;
	} else {
		try {
			WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(), srid));
			Geometry geom = reader.read((String) geometry);
			log.debug("bean.getGeometry {}", geom);
			return geom;
		} catch (Throwable t) {
			throw new LayerException(t, ExceptionCode.FEATURE_MODEL_PROBLEM, geometry);
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:17,代码来源:BeanFeatureModel.java

示例6: getBounds

/**
 * Retrieve the bounds of the specified features.
 *
 * @param filter filter
 * @return the bounds of the specified features
 * @throws LayerException cannot read features
 */
public Envelope getBounds(Filter filter) throws LayerException {
	try {
		FeatureCollection<SimpleFeatureType, SimpleFeature> fc = getFeatureSource().getFeatures(filter);
		return fc.getBounds();
	} catch (IOException ioe) {
		throw new LayerException(ioe, ExceptionCode.FEATURE_MODEL_PROBLEM);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:15,代码来源:ShapeInMemLayer.java

示例7: initFeatures

/**
 * Finish initializing the layer.
 *
 * @throws LayerException oops
 */
@PostConstruct
protected void initFeatures() throws LayerException {
	crs = geoService.getCrs2(layerInfo.getCrs());
	try {
		setFeatureSourceName(layerInfo.getFeatureInfo().getDataSourceName());
		featureModel = new ShapeInMemFeatureModel(getDataStore(), layerInfo.getFeatureInfo().getDataSourceName(),
				geoService.getSridFromCrs(layerInfo.getCrs()), converterService);
		featureModel.setLayerInfo(layerInfo);
		FeatureCollection<SimpleFeatureType, SimpleFeature> col = getFeatureSource().getFeatures();
		FeatureIterator<SimpleFeature> iterator = col.features();
		int lastIndex = 0;
		while (iterator.hasNext()) {
			SimpleFeature feature = iterator.next();
			String id = featureModel.getId(feature);
			features.put(id, feature);
			int intId = Integer.parseInt(id.substring(id.lastIndexOf('.') + 1));
			if (intId > lastIndex) {
				lastIndex = intId;
			}
		}
		iterator.close();
		((ShapeInMemFeatureModel) featureModel).setNextId(++lastIndex);
	} catch (NumberFormatException nfe) {
		throw new LayerException(nfe, ExceptionCode.FEATURE_MODEL_PROBLEM, url);
	} catch (MalformedURLException e) {
		throw new LayerException(e, ExceptionCode.INVALID_SHAPE_FILE_URL, url);
	} catch (IOException ioe) {
		throw new LayerException(ioe, ExceptionCode.CANNOT_CREATE_LAYER_MODEL, url);
	} catch (GeomajasException ge) {
		throw new LayerException(ge, ExceptionCode.CANNOT_CREATE_LAYER_MODEL, url);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:37,代码来源:ShapeInMemLayer.java

示例8: asEntity

@Override
public Entity asEntity(Object object) throws LayerException {
	if (object == null) {
		throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM);
	}
	return new HibernateEntity(object);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:7,代码来源:HibernateEntityMapper.java

示例9: BeanFeatureModel

public BeanFeatureModel(VectorLayerInfo vectorLayerInfo, int srid, EntityAttributeService entityMappingService)
		throws LayerException {
	this.vectorLayerInfo = vectorLayerInfo;
	this.entityMappingService = entityMappingService;

	try {
		beanClass = Class.forName(vectorLayerInfo.getFeatureInfo().getDataSourceName());
	} catch (ClassNotFoundException e) {
		throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM, "Feature class "
				+ vectorLayerInfo.getFeatureInfo().getDataSourceName() + " was not found", e);
	}
	this.srid = srid;
	PropertyDescriptor d = BeanUtils.getPropertyDescriptor(beanClass, getGeometryAttributeName());
	Class geometryClass = d.getPropertyType();
	if (Geometry.class.isAssignableFrom(geometryClass)) {
		wkt = false;
	} else if (geometryClass == String.class) {
		wkt = true;
	} else {
		throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM, "Feature "
				+ vectorLayerInfo.getFeatureInfo().getDataSourceName() + " has no valid geometry attribute");
	}

	FeatureInfo featureInfo = vectorLayerInfo.getFeatureInfo();
	for (AbstractAttributeInfo info : featureInfo.getAttributes()) {
		addAttribute(null, info);
	}
	entityMapper = new BeanEntityMapper();
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:29,代码来源:BeanFeatureModel.java

示例10: getAttributes

public Map<String, Attribute> getAttributes(Object feature) throws LayerException {
	try {
		Map<String, Attribute> attribs = new HashMap<String, Attribute>();
		for (AbstractAttributeInfo attribute : getFeatureInfo().getAttributes()) {
			String name = attribute.getName();
			if (!name.equals(getGeometryAttributeName())) {
				Attribute value = this.getAttribute(feature, name);
				attribs.put(name, value);
			}
		}
		return attribs;
	} catch (Exception e) { // NOSONAR
		throw new LayerException(e, ExceptionCode.FEATURE_MODEL_PROBLEM);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:15,代码来源:BeanFeatureModel.java

示例11: newInstance

public Object newInstance() throws LayerException {
	try {
		Object o = beanClass.newInstance();
		if (o instanceof FeatureModelAware) {
			((FeatureModelAware) o).setFeatureModel(this);
		}
		return o;
	} catch (Throwable t) {
		throw new LayerException(t, ExceptionCode.FEATURE_MODEL_PROBLEM);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:11,代码来源:BeanFeatureModel.java


注:本文中的org.geomajas.global.ExceptionCode.FEATURE_MODEL_PROBLEM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。