use of net.geoprism.registry.conversion.AttributeTypeConverter in project geoprism-registry by terraframe.
the class BusinessType method getAttributeMap.
public Map<String, AttributeType> getAttributeMap() {
AttributeTypeConverter converter = new AttributeTypeConverter();
MdVertexDAOIF mdVertex = this.getMdVertexDAO();
return mdVertex.definesAttributes().stream().filter(attr -> {
return !attr.isSystem() && !attr.definesAttribute().equals(BusinessType.SEQ) && !attr.definesAttribute().equals(BusinessType.GEO_OBJECT);
}).map(attr -> converter.build(attr)).collect(Collectors.toMap(AttributeType::getName, attr -> attr));
}
use of net.geoprism.registry.conversion.AttributeTypeConverter in project geoprism-registry by terraframe.
the class BusinessType method getAttribute.
public AttributeType getAttribute(String name) {
AttributeTypeConverter converter = new AttributeTypeConverter();
MdVertexDAOIF mdVertex = this.getMdVertexDAO();
MdAttributeConcreteDAOIF mdAttribute = (MdAttributeConcreteDAOIF) mdVertex.definesAttribute(name);
return converter.build(mdAttribute);
}
use of net.geoprism.registry.conversion.AttributeTypeConverter in project geoprism-registry by terraframe.
the class ServerGeoObjectType method updateAttributeType.
public AttributeType updateAttributeType(String attributeTypeJSON) {
JsonObject attrObj = JsonParser.parseString(attributeTypeJSON).getAsJsonObject();
AttributeType attrType = AttributeType.parse(attrObj);
MdAttributeConcrete mdAttribute = ServerGeoObjectType.updateMdAttributeFromAttributeType(this.mdBusiness, attrType);
attrType = new AttributeTypeConverter().build(MdAttributeConcreteDAO.get(mdAttribute.getOid()));
this.type.addAttribute(attrType);
// If this did not error out then add to the cache
this.refreshCache();
return attrType;
}
use of net.geoprism.registry.conversion.AttributeTypeConverter in project geoprism-registry by terraframe.
the class ServerGeoObjectType method createAttributeType.
public AttributeType createAttributeType(AttributeType attributeType) {
MdAttributeConcrete mdAttribute = this.createMdAttributeFromAttributeType(attributeType);
attributeType = new AttributeTypeConverter().build(MdAttributeConcreteDAO.get(mdAttribute.getOid()));
this.type.addAttribute(attributeType);
// If this did not error out then add to the cache
this.refreshCache();
// Refresh the users session
if (Session.getCurrentSession() != null) {
((Session) Session.getCurrentSession()).reloadPermissions();
}
return attributeType;
}
use of net.geoprism.registry.conversion.AttributeTypeConverter in project geoprism-registry by terraframe.
the class RegistryService method refreshAttributeTermTypeInCache.
/**
* Returns the {@link AttributeTermType}s that use the given term.
*
* @param term
* @return
*/
private void refreshAttributeTermTypeInCache(List<MdAttributeConcrete> mdAttrList) {
for (MdAttributeConcrete mdAttribute : mdAttrList) {
String geoObjectTypeCode = mdAttribute.getDefiningMdClass().getTypeName();
Optional<ServerGeoObjectType> optional = ServiceFactory.getMetadataCache().getGeoObjectType(geoObjectTypeCode);
if (optional.isPresent()) {
ServerGeoObjectType geoObjectType = optional.get();
AttributeType attributeType = new AttributeTypeConverter().build((MdAttributeConcreteDAOIF) BusinessFacade.getEntityDAO(mdAttribute));
geoObjectType.getType().addAttribute(attributeType);
ServiceFactory.getMetadataCache().addGeoObjectType(geoObjectType);
}
}
}
Aggregations