Search in sources :

Example 11 with MdAttributeConcreteDAOIF

use of com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF in project geoprism-registry by terraframe.

the class MasterListExcelExporter method writeRow.

public void writeRow(Row row, Business object, CellStyle dateStyle) {
    int col = 0;
    // Write the row
    MdAttributeConcreteDAOIF mdGeometry = mdBusiness.definesAttribute(RegistryConstants.GEOMETRY_ATTRIBUTE_NAME);
    if (mdGeometry instanceof MdAttributePointDAOIF) {
        Point point = (Point) object.getObjectValue(mdGeometry.definesAttribute());
        if (point != null) {
            row.createCell(col++).setCellValue(point.getX());
            row.createCell(col++).setCellValue(point.getY());
        }
    }
    for (MdAttributeConcreteDAOIF mdAttribute : mdAttributes) {
        String attributeName = mdAttribute.definesAttribute();
        Object value = object.getObjectValue(attributeName);
        Cell cell = row.createCell(col++);
        if (value != null) {
            if (value instanceof String) {
                cell.setCellValue((String) value);
            } else if (value instanceof Date) {
                cell.setCellValue((Date) value);
                cell.setCellStyle(dateStyle);
            } else if (value instanceof Number) {
                cell.setCellValue(((Number) value).doubleValue());
            } else if (value instanceof Boolean) {
                cell.setCellValue((Boolean) value);
            }
        }
    }
}
Also used : MdAttributePointDAOIF(com.runwaysdk.gis.dataaccess.MdAttributePointDAOIF) Point(com.vividsolutions.jts.geom.Point) Cell(org.apache.poi.ss.usermodel.Cell) Point(com.vividsolutions.jts.geom.Point) Date(java.util.Date) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)

Example 12 with MdAttributeConcreteDAOIF

use of com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF in project geoprism-registry by terraframe.

the class MasterListExcelExporter method createDataDictionarySheet.

private void createDataDictionarySheet(Workbook workbook) {
    Sheet sheet = workbook.createSheet(getSheetName(workbook, "masterlist.data.dictionary"));
    Locale locale = Session.getCurrentLocale();
    int rowNumber = 0;
    for (MdAttributeConcreteDAOIF mdAttribute : mdAttributes) {
        if (customAttributeLabels != null && this.customAttributeLabels.containsKey(mdAttribute.definesAttribute())) {
            this.createRow(sheet, rowNumber++, this.customAttributeLabels.get(mdAttribute.definesAttribute()), mdAttribute.getDescription(locale));
        } else {
            this.createRow(sheet, locale, rowNumber++, mdAttribute, mdAttribute.getDescription(locale));
        }
    }
}
Also used : Locale(java.util.Locale) Sheet(org.apache.poi.ss.usermodel.Sheet) Point(com.vividsolutions.jts.geom.Point) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)

Example 13 with MdAttributeConcreteDAOIF

use of com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF in project geoprism-registry by terraframe.

the class MasterListExcelExporter method writeHeader.

public void writeHeader(CellStyle boldStyle, Row header) {
    int col = 0;
    Locale locale = Session.getCurrentLocale();
    MdAttributeConcreteDAOIF mdGeometry = mdBusiness.definesAttribute(RegistryConstants.GEOMETRY_ATTRIBUTE_NAME);
    if (mdGeometry instanceof MdAttributePointDAOIF) {
        Cell longitude = header.createCell(col++);
        longitude.setCellStyle(boldStyle);
        longitude.setCellValue(LocalizationFacade.getFromBundles(GeoObjectImportConfiguration.LONGITUDE_KEY));
        Cell latitude = header.createCell(col++);
        latitude.setCellStyle(boldStyle);
        latitude.setCellValue(LocalizationFacade.getFromBundles(GeoObjectImportConfiguration.LATITUDE_KEY));
    }
    for (MdAttributeConcreteDAOIF mdAttribute : this.mdAttributes) {
        Cell cell = header.createCell(col++);
        cell.setCellStyle(boldStyle);
        cell.setCellValue(mdAttribute.getDisplayLabel(locale));
    }
}
Also used : Locale(java.util.Locale) MdAttributePointDAOIF(com.runwaysdk.gis.dataaccess.MdAttributePointDAOIF) Cell(org.apache.poi.ss.usermodel.Cell) Point(com.vividsolutions.jts.geom.Point) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)

Example 14 with MdAttributeConcreteDAOIF

use of com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF in project geoprism-registry by terraframe.

the class ServerGeoObjectType method deleteMdAttributeFromAttributeType.

/**
 * Delete the {@link MdAttributeConcreteDAOIF} from the given {
 *
 * @param type
 *          TODO
 * @param mdBusiness
 * @param attributeName
 */
@Transaction
public void deleteMdAttributeFromAttributeType(String attributeName) {
    MdAttributeConcreteDAOIF mdAttributeConcreteDAOIF = getMdAttribute(this.mdBusiness, attributeName);
    if (mdAttributeConcreteDAOIF != null) {
        if (mdAttributeConcreteDAOIF instanceof MdAttributeTermDAOIF || mdAttributeConcreteDAOIF instanceof MdAttributeMultiTermDAOIF) {
            String attributeTermKey = TermConverter.buildtAtttributeKey(this.mdBusiness.getTypeName(), mdAttributeConcreteDAOIF.definesAttribute());
            try {
                Classifier attributeTerm = Classifier.getByKey(attributeTermKey);
                attributeTerm.delete();
            } catch (DataNotFoundException e) {
            }
        }
        mdAttributeConcreteDAOIF.getBusinessDAO().delete();
        Optional<AttributeType> optional = this.type.getAttribute(attributeName);
        if (optional.isPresent()) {
            ListType.deleteMdAttribute(this.universal, optional.get());
        }
    }
    MdAttributeDAOIF mdAttributeDAO = this.mdVertex.definesAttribute(attributeName);
    if (mdAttributeDAO != null) {
        mdAttributeDAO.getBusinessDAO().delete();
    }
}
Also used : DataNotFoundException(com.runwaysdk.dataaccess.cache.DataNotFoundException) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) MdAttributeTermDAOIF(com.runwaysdk.dataaccess.MdAttributeTermDAOIF) Classifier(net.geoprism.ontology.Classifier) MdAttributeMultiTermDAOIF(com.runwaysdk.dataaccess.MdAttributeMultiTermDAOIF) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 15 with MdAttributeConcreteDAOIF

use of com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF in project geoprism-registry by terraframe.

the class VertexServerGeoObject method getValue.

@Override
public Object getValue(String attributeName, Date date) {
    if (attributeName.equals(DefaultAttribute.CODE.getName())) {
        return this.getCode();
    } else if (attributeName.equals(DefaultAttribute.UID.getName())) {
        return this.getUid();
    } else if (attributeName.equals(DefaultAttribute.DISPLAY_LABEL.getName())) {
        return this.getDisplayLabel(date);
    } else if (attributeName.equals(DefaultAttribute.CREATE_DATE.getName())) {
        return this.getCreateDate();
    } else if (attributeName.equals(DefaultAttribute.EXISTS.getName())) {
        return this.getExists(date);
    }
    DefaultAttribute defaultAttr = DefaultAttribute.getByAttributeName(attributeName);
    if (defaultAttr != null && !defaultAttr.isChangeOverTime()) {
        return this.vertex.getObjectValue(attributeName);
    }
    MdAttributeConcreteDAOIF mdAttribute = this.vertex.getMdAttributeDAO(attributeName);
    Object value = this.vertex.getObjectValue(attributeName, date);
    if (value != null && mdAttribute instanceof MdAttributeTermDAOIF) {
        return Classifier.get((String) value);
    }
    return value;
}
Also used : MdAttributeTermDAOIF(com.runwaysdk.dataaccess.MdAttributeTermDAOIF) GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) VertexObject(com.runwaysdk.business.graph.VertexObject) EdgeObject(com.runwaysdk.business.graph.EdgeObject) AbstractServerGeoObject(net.geoprism.registry.model.AbstractServerGeoObject) GraphObject(com.runwaysdk.business.graph.GraphObject) DefaultAttribute(org.commongeoregistry.adapter.constants.DefaultAttribute) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)

Aggregations

MdAttributeConcreteDAOIF (com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)36 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)18 JsonObject (com.google.gson.JsonObject)16 Date (java.util.Date)12 BusinessQuery (com.runwaysdk.business.BusinessQuery)11 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)11 Point (com.vividsolutions.jts.geom.Point)11 SimpleDateFormat (java.text.SimpleDateFormat)11 JsonArray (com.google.gson.JsonArray)10 MdAttributePointDAOIF (com.runwaysdk.gis.dataaccess.MdAttributePointDAOIF)10 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)9 MdAttributeLineString (com.runwaysdk.system.gis.metadata.MdAttributeLineString)9 MdAttributeMultiLineString (com.runwaysdk.system.gis.metadata.MdAttributeMultiLineString)9 IOException (java.io.IOException)9 ParseException (java.text.ParseException)9 Locale (java.util.Locale)9 Business (com.runwaysdk.business.Business)8 MdBusinessDAO (com.runwaysdk.dataaccess.metadata.MdBusinessDAO)8 InputStream (java.io.InputStream)8 List (java.util.List)8