Search in sources :

Example 1 with AttributeTypeConverter

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));
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) JsonObject(com.google.gson.JsonObject) Operation(com.runwaysdk.business.rbac.Operation) Transaction(com.runwaysdk.dataaccess.transaction.Transaction) MdGeoVertexInfo(com.runwaysdk.gis.constants.MdGeoVertexInfo) MdAttributeTermDAOIF(com.runwaysdk.dataaccess.MdAttributeTermDAOIF) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonParser(com.google.gson.JsonParser) MdAttributeLocalInfo(com.runwaysdk.constants.MdAttributeLocalInfo) MdAttributeBooleanInfo(com.runwaysdk.constants.MdAttributeBooleanInfo) MdVertex(com.runwaysdk.system.metadata.MdVertex) ServiceFactory(net.geoprism.registry.service.ServiceFactory) Classifier(net.geoprism.ontology.Classifier) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF) DefaultAttribute(org.commongeoregistry.adapter.constants.DefaultAttribute) IndexTypes(com.runwaysdk.constants.IndexTypes) MdAttributeCharacterInfo(com.runwaysdk.constants.MdAttributeCharacterInfo) LocalizedValueConverter(net.geoprism.registry.conversion.LocalizedValueConverter) Map(java.util.Map) QueryFactory(com.runwaysdk.query.QueryFactory) RoleDAO(com.runwaysdk.business.rbac.RoleDAO) Collector(java.util.stream.Collector) JsonSerializable(net.geoprism.registry.view.JsonSerializable) MdAttributeConcrete(com.runwaysdk.system.metadata.MdAttributeConcrete) TermConverter(net.geoprism.registry.conversion.TermConverter) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) MdAttributeCharacterDAO(com.runwaysdk.dataaccess.metadata.MdAttributeCharacterDAO) MdAttributeConcreteDAO(com.runwaysdk.dataaccess.metadata.MdAttributeConcreteDAO) GeoVertex(net.geoprism.registry.graph.GeoVertex) Roles(com.runwaysdk.system.Roles) AttributeTypeConverter(net.geoprism.registry.conversion.AttributeTypeConverter) MdAttributeConcreteInfo(com.runwaysdk.constants.MdAttributeConcreteInfo) Collectors(java.util.stream.Collectors) BusinessFacade(com.runwaysdk.business.BusinessFacade) MdVertexDAO(com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO) OIterator(com.runwaysdk.query.OIterator) Page(net.geoprism.registry.view.Page) MdAttributeGraphReferenceInfo(com.runwaysdk.constants.MdAttributeGraphReferenceInfo) MdAttributeMultiTermDAOIF(com.runwaysdk.dataaccess.MdAttributeMultiTermDAOIF) MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) List(java.util.List) JsonArray(com.google.gson.JsonArray) DataNotFoundException(com.runwaysdk.dataaccess.cache.DataNotFoundException) MdVertexInfo(com.runwaysdk.constants.graph.MdVertexInfo) Session(com.runwaysdk.session.Session) MdAttributeGraphReferenceDAO(com.runwaysdk.dataaccess.metadata.MdAttributeGraphReferenceDAO) BusinessTypePageQuery(net.geoprism.registry.query.graph.BusinessTypePageQuery) AttributeTypeConverter(net.geoprism.registry.conversion.AttributeTypeConverter)

Example 2 with AttributeTypeConverter

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);
}
Also used : MdVertexDAOIF(com.runwaysdk.dataaccess.MdVertexDAOIF) AttributeTypeConverter(net.geoprism.registry.conversion.AttributeTypeConverter) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)

Example 3 with AttributeTypeConverter

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;
}
Also used : AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) AttributeTypeConverter(net.geoprism.registry.conversion.AttributeTypeConverter) JsonObject(com.google.gson.JsonObject) MdAttributeConcrete(com.runwaysdk.system.metadata.MdAttributeConcrete)

Example 4 with AttributeTypeConverter

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;
}
Also used : AttributeTypeConverter(net.geoprism.registry.conversion.AttributeTypeConverter) MdAttributeConcrete(com.runwaysdk.system.metadata.MdAttributeConcrete) Session(com.runwaysdk.session.Session)

Example 5 with AttributeTypeConverter

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);
        }
    }
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) AttributeTypeConverter(net.geoprism.registry.conversion.AttributeTypeConverter) MdAttributeConcrete(com.runwaysdk.system.metadata.MdAttributeConcrete)

Aggregations

AttributeTypeConverter (net.geoprism.registry.conversion.AttributeTypeConverter)5 MdAttributeConcrete (com.runwaysdk.system.metadata.MdAttributeConcrete)4 JsonObject (com.google.gson.JsonObject)2 MdAttributeConcreteDAOIF (com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)2 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)2 Session (com.runwaysdk.session.Session)2 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)2 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)2 JsonArray (com.google.gson.JsonArray)1 JsonParser (com.google.gson.JsonParser)1 BusinessFacade (com.runwaysdk.business.BusinessFacade)1 Operation (com.runwaysdk.business.rbac.Operation)1 RoleDAO (com.runwaysdk.business.rbac.RoleDAO)1 IndexTypes (com.runwaysdk.constants.IndexTypes)1 MdAttributeBooleanInfo (com.runwaysdk.constants.MdAttributeBooleanInfo)1 MdAttributeCharacterInfo (com.runwaysdk.constants.MdAttributeCharacterInfo)1 MdAttributeConcreteInfo (com.runwaysdk.constants.MdAttributeConcreteInfo)1 MdAttributeGraphReferenceInfo (com.runwaysdk.constants.MdAttributeGraphReferenceInfo)1 MdAttributeLocalInfo (com.runwaysdk.constants.MdAttributeLocalInfo)1 MdVertexInfo (com.runwaysdk.constants.graph.MdVertexInfo)1