本文整理汇总了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);
}
}
示例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");
}
}
示例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;
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例8: asEntity
@Override
public Entity asEntity(Object object) throws LayerException {
if (object == null) {
throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM);
}
return new HibernateEntity(object);
}
示例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();
}
示例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);
}
}
示例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);
}
}