Search in sources :

Example 1 with MdBusiness

use of com.runwaysdk.system.metadata.MdBusiness in project geoprism-registry by terraframe.

the class ListTypeVersion method publishRecord.

@Transaction
public void publishRecord(ServerGeoObjectIF object) {
    // Only working lists can be updated from changes to the graph objects
    if (this.getWorking()) {
        object.setDate(this.getForDate());
        // Delete tile cache
        ListTileCache.deleteTiles(this);
        ListType masterlist = this.getListType();
        MdBusinessDAO mdBusiness = MdBusinessDAO.get(this.getMdBusinessOid()).getBusinessDAO();
        Collection<Locale> locales = LocalizationFacade.getInstalledLocales();
        // Add the type ancestor fields
        ServerGeoObjectType type = ServerGeoObjectType.get(masterlist.getUniversal());
        Map<ServerHierarchyType, List<ServerGeoObjectType>> ancestorMap = masterlist.getAncestorMap(type);
        Set<ServerHierarchyType> hierarchiesOfSubTypes = type.getHierarchiesOfSubTypes();
        Collection<AttributeType> attributes = type.getAttributeMap().values();
        Business business = new Business(mdBusiness.definesType());
        this.publish(masterlist, type, object, business, attributes, ancestorMap, hierarchiesOfSubTypes, locales);
    }
}
Also used : Locale(java.util.Locale) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) MdBusinessDAO(com.runwaysdk.dataaccess.metadata.MdBusinessDAO) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) List(java.util.List) LinkedList(java.util.LinkedList) MdBusiness(com.runwaysdk.system.metadata.MdBusiness) Business(com.runwaysdk.business.Business) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 2 with MdBusiness

use of com.runwaysdk.system.metadata.MdBusiness in project geoprism-registry by terraframe.

the class ListTypeVersion method updateRecord.

@Transaction
public void updateRecord(ServerGeoObjectIF object) {
    // Only working lists can be updated from changes to the graph objects
    if (this.getWorking()) {
        object.setDate(this.getForDate());
        // Delete tile cache
        ListTileCache.deleteTiles(this);
        ListType masterlist = this.getListType();
        MdBusinessDAO mdBusiness = MdBusinessDAO.get(this.getMdBusinessOid()).getBusinessDAO();
        Collection<Locale> locales = LocalizationFacade.getInstalledLocales();
        // Add the type ancestor fields
        ServerGeoObjectType type = ServerGeoObjectType.get(masterlist.getUniversal());
        Set<ServerHierarchyType> hierarchiesOfSubTypes = type.getHierarchiesOfSubTypes();
        Map<ServerHierarchyType, List<ServerGeoObjectType>> ancestorMap = masterlist.getAncestorMap(type);
        Collection<AttributeType> attributes = type.getAttributeMap().values();
        BusinessQuery query = new QueryFactory().businessQuery(mdBusiness.definesType());
        query.WHERE(query.aCharacter(DefaultAttribute.CODE.getName()).EQ(object.getCode()));
        List<Business> records = query.getIterator().getAll();
        for (Business record : records) {
            try {
                record.appLock();
                this.publish(masterlist, type, object, record, attributes, ancestorMap, hierarchiesOfSubTypes, locales);
            } finally {
                record.unlock();
            }
        }
    }
}
Also used : Locale(java.util.Locale) BusinessQuery(com.runwaysdk.business.BusinessQuery) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) QueryFactory(com.runwaysdk.query.QueryFactory) MdBusinessDAO(com.runwaysdk.dataaccess.metadata.MdBusinessDAO) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) List(java.util.List) LinkedList(java.util.LinkedList) MdBusiness(com.runwaysdk.system.metadata.MdBusiness) Business(com.runwaysdk.business.Business) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 3 with MdBusiness

use of com.runwaysdk.system.metadata.MdBusiness in project geoprism-registry by terraframe.

the class ListTypeVersion method createMdAttributeFromAttributeType.

protected static void createMdAttributeFromAttributeType(TableMetadata metadata, AttributeType attributeType, ServerGeoObjectType type, Collection<Locale> locales) {
    MdBusiness mdBusiness = metadata.getMdBusiness();
    if (!(attributeType instanceof AttributeTermType || attributeType instanceof AttributeClassificationType || attributeType instanceof AttributeLocalType)) {
        MdAttributeConcrete mdAttribute = null;
        if (attributeType.getType().equals(AttributeCharacterType.TYPE)) {
            mdAttribute = new MdAttributeCharacter();
            MdAttributeCharacter mdAttributeCharacter = (MdAttributeCharacter) mdAttribute;
            mdAttributeCharacter.setDatabaseSize(MdAttributeCharacterInfo.MAX_CHARACTER_SIZE);
        } else if (attributeType.getType().equals(AttributeDateType.TYPE)) {
            mdAttribute = new MdAttributeDateTime();
        } else if (attributeType.getType().equals(AttributeIntegerType.TYPE)) {
            mdAttribute = new MdAttributeLong();
        } else if (attributeType.getType().equals(AttributeFloatType.TYPE)) {
            AttributeFloatType attributeFloatType = (AttributeFloatType) attributeType;
            mdAttribute = new MdAttributeDouble();
            mdAttribute.setValue(MdAttributeDoubleInfo.LENGTH, Integer.toString(attributeFloatType.getPrecision()));
            mdAttribute.setValue(MdAttributeDoubleInfo.DECIMAL, Integer.toString(attributeFloatType.getScale()));
        } else if (attributeType.getType().equals(AttributeBooleanType.TYPE)) {
            mdAttribute = new MdAttributeBoolean();
        } else {
            throw new UnsupportedOperationException("Unsupported type [" + attributeType.getType() + "]");
        }
        mdAttribute.setAttributeName(attributeType.getName());
        LocalizedValueConverter.populate(mdAttribute.getDisplayLabel(), attributeType.getLabel());
        LocalizedValueConverter.populate(mdAttribute.getDescription(), attributeType.getDescription());
        mdAttribute.setDefiningMdClass(mdBusiness);
        mdAttribute.apply();
    } else if (attributeType instanceof AttributeTermType || attributeType instanceof AttributeClassificationType) {
        MdAttributeCharacter cloneAttribute = new MdAttributeCharacter();
        cloneAttribute.setValue(MdAttributeConcreteInfo.NAME, attributeType.getName());
        cloneAttribute.setValue(MdAttributeCharacterInfo.SIZE, "255");
        cloneAttribute.addIndexType(MdAttributeIndices.NON_UNIQUE_INDEX);
        LocalizedValueConverter.populate(cloneAttribute.getDisplayLabel(), attributeType.getLabel());
        LocalizedValueConverter.populate(cloneAttribute.getDescription(), attributeType.getDescription());
        cloneAttribute.setDefiningMdClass(mdBusiness);
        cloneAttribute.apply();
        metadata.addPair(cloneAttribute, cloneAttribute);
        MdAttributeCharacter mdAttributeDefaultLocale = new MdAttributeCharacter();
        mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.NAME, attributeType.getName() + DEFAULT_LOCALE);
        mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.SIZE, "255");
        mdAttributeDefaultLocale.setDefiningMdClass(mdBusiness);
        LocalizedValueConverter.populate(mdAttributeDefaultLocale.getDisplayLabel(), attributeType.getLabel(), " (defaultLocale)");
        LocalizedValueConverter.populate(mdAttributeDefaultLocale.getDescription(), attributeType.getDescription(), " (defaultLocale)");
        mdAttributeDefaultLocale.apply();
        metadata.addPair(mdAttributeDefaultLocale, cloneAttribute);
        for (Locale locale : locales) {
            MdAttributeCharacter mdAttributeLocale = new MdAttributeCharacter();
            mdAttributeLocale.setValue(MdAttributeCharacterInfo.NAME, attributeType.getName() + locale.toString());
            mdAttributeLocale.setValue(MdAttributeCharacterInfo.SIZE, "255");
            mdAttributeLocale.setDefiningMdClass(mdBusiness);
            LocalizedValueConverter.populate(mdAttributeLocale.getDisplayLabel(), attributeType.getLabel(), " (" + locale.toString() + ")");
            LocalizedValueConverter.populate(mdAttributeLocale.getDescription(), attributeType.getDescription());
            mdAttributeLocale.apply();
            metadata.addPair(mdAttributeLocale, cloneAttribute);
        }
    // MdAttributeUUID mdAttributeOid = new MdAttributeUUID();
    // mdAttributeOid.setValue(MdAttributeConcreteInfo.NAME,
    // attributeType.getName() + "Oid");
    // AbstractBuilder.populate(mdAttributeOid.getDisplayLabel(),
    // attributeType.getLabel());
    // AbstractBuilder.populate(mdAttributeOid.getDescription(),
    // attributeType.getDescription());
    // mdAttributeOid.setDefiningMdClass(mdBusiness);
    // mdAttributeOid.apply();
    } else if (attributeType instanceof AttributeLocalType) {
        boolean isDisplayLabel = attributeType.getName().equals(DefaultAttribute.DISPLAY_LABEL.getName());
        MdAttributeCharacter mdAttributeDefaultLocale = new MdAttributeCharacter();
        mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.NAME, attributeType.getName() + DEFAULT_LOCALE);
        mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.SIZE, "255");
        mdAttributeDefaultLocale.setDefiningMdClass(mdBusiness);
        LocalizedValueConverter.populate(mdAttributeDefaultLocale.getDisplayLabel(), isDisplayLabel ? type.getLabel() : attributeType.getLabel(), " (defaultLocale)");
        LocalizedValueConverter.populate(mdAttributeDefaultLocale.getDescription(), attributeType.getDescription(), " (defaultLocale)");
        mdAttributeDefaultLocale.apply();
        for (Locale locale : locales) {
            MdAttributeCharacter mdAttributeLocale = new MdAttributeCharacter();
            mdAttributeLocale.setValue(MdAttributeCharacterInfo.NAME, attributeType.getName() + locale.toString());
            mdAttributeLocale.setValue(MdAttributeCharacterInfo.SIZE, "255");
            mdAttributeLocale.setDefiningMdClass(mdBusiness);
            LocalizedValueConverter.populate(mdAttributeLocale.getDisplayLabel(), isDisplayLabel ? type.getLabel() : attributeType.getLabel(), " (" + locale.toString() + ")");
            LocalizedValueConverter.populate(mdAttributeLocale.getDescription(), attributeType.getDescription());
            mdAttributeLocale.apply();
        }
    }
}
Also used : Locale(java.util.Locale) MdAttributeCharacter(com.runwaysdk.system.metadata.MdAttributeCharacter) MdBusiness(com.runwaysdk.system.metadata.MdBusiness) MdAttributeDateTime(com.runwaysdk.system.metadata.MdAttributeDateTime) AttributeClassificationType(org.commongeoregistry.adapter.metadata.AttributeClassificationType) AttributeFloatType(org.commongeoregistry.adapter.metadata.AttributeFloatType) AttributeLocalType(org.commongeoregistry.adapter.metadata.AttributeLocalType) MdAttributeBoolean(com.runwaysdk.system.metadata.MdAttributeBoolean) MdAttributeConcrete(com.runwaysdk.system.metadata.MdAttributeConcrete) MdAttributeDouble(com.runwaysdk.system.metadata.MdAttributeDouble) AttributeTermType(org.commongeoregistry.adapter.metadata.AttributeTermType) MdAttributeLong(com.runwaysdk.system.metadata.MdAttributeLong) UnsupportedOperationException(com.amazonaws.services.kms.model.UnsupportedOperationException)

Example 4 with MdBusiness

use of com.runwaysdk.system.metadata.MdBusiness in project geoprism-registry by terraframe.

the class ListTypeVersion method createTable.

private TableMetadata createTable() {
    ListType masterlist = this.getListType();
    TableMetadata metadata = new TableMetadata();
    Locale currentLocale = Session.getCurrentLocale();
    String viewName = this.getTableName();
    // Create the MdTable
    MdBusinessDAO mdTableDAO = MdBusinessDAO.newInstance();
    mdTableDAO.setValue(MdTableInfo.NAME, viewName);
    mdTableDAO.setValue(MdTableInfo.PACKAGE, RegistryConstants.TABLE_PACKAGE);
    mdTableDAO.setStructValue(MdTableInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, masterlist.getDisplayLabel().getValue());
    mdTableDAO.setValue(MdTableInfo.TABLE_NAME, viewName);
    mdTableDAO.setValue(MdTableInfo.GENERATE_SOURCE, MdAttributeBooleanInfo.FALSE);
    mdTableDAO.apply();
    MdBusiness mdBusiness = (MdBusiness) BusinessFacade.get(mdTableDAO);
    MdAttributeUUIDDAO mdAttributeOriginalId = MdAttributeUUIDDAO.newInstance();
    mdAttributeOriginalId.setValue(MdAttributeCharacterInfo.NAME, ORIGINAL_OID);
    mdAttributeOriginalId.setValue(MdAttributeCharacterInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
    mdAttributeOriginalId.setStructValue(MdAttributeCharacterInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, "Original oid");
    mdAttributeOriginalId.apply();
    metadata.setMdBusiness(mdBusiness);
    Collection<Locale> locales = LocalizationFacade.getInstalledLocales();
    ServerGeoObjectType type = masterlist.getGeoObjectType();
    this.createMdAttributeFromAttributeType(mdBusiness, type.getGeometryType());
    Collection<AttributeType> attributeTypes = type.getAttributeMap().values();
    for (AttributeType attributeType : attributeTypes) {
        if (this.isValid(attributeType)) {
            createMdAttributeFromAttributeType(metadata, attributeType, type, locales);
        }
    }
    if ((type.getGeometryType().equals(GeometryType.MULTIPOINT) || type.getGeometryType().equals(GeometryType.POINT)) && masterlist.getIncludeLatLong()) {
        MdAttributeFloatDAO mdAttributeLatitude = MdAttributeFloatDAO.newInstance();
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.NAME, "latitude");
        mdAttributeLatitude.setStructValue(MdAttributeFloatInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, "Latitude");
        mdAttributeLatitude.setStructValue(MdAttributeFloatInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, "Latitude");
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.REQUIRED, MdAttributeBooleanInfo.FALSE);
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.IMMUTABLE, MdAttributeBooleanInfo.FALSE);
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.REJECT_ZERO, MdAttributeBooleanInfo.FALSE);
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.REJECT_NEGATIVE, MdAttributeBooleanInfo.FALSE);
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.REJECT_POSITIVE, MdAttributeBooleanInfo.FALSE);
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.LENGTH, "12");
        mdAttributeLatitude.setValue(MdAttributeFloatInfo.DECIMAL, "8");
        mdAttributeLatitude.apply();
        MdAttributeFloatDAO mdAttributeLongitude = MdAttributeFloatDAO.newInstance();
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.NAME, "longitude");
        mdAttributeLongitude.setStructValue(MdAttributeFloatInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, "Longitude");
        mdAttributeLongitude.setStructValue(MdAttributeFloatInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, "Longitude");
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.REQUIRED, MdAttributeBooleanInfo.FALSE);
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.IMMUTABLE, MdAttributeBooleanInfo.FALSE);
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.REJECT_ZERO, MdAttributeBooleanInfo.FALSE);
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.REJECT_NEGATIVE, MdAttributeBooleanInfo.FALSE);
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.REJECT_POSITIVE, MdAttributeBooleanInfo.FALSE);
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.LENGTH, "12");
        mdAttributeLongitude.setValue(MdAttributeFloatInfo.DECIMAL, "8");
        mdAttributeLongitude.apply();
    }
    JsonArray hierarchies = masterlist.getHierarchiesAsJson();
    for (int i = 0; i < hierarchies.size(); i++) {
        JsonObject hierarchy = hierarchies.get(i).getAsJsonObject();
        List<String> pCodes = masterlist.getParentCodes(hierarchy);
        if (pCodes.size() > 0) {
            String hCode = hierarchy.get("code").getAsString();
            ServerHierarchyType hierarchyType = ServiceFactory.getMetadataCache().getHierachyType(hCode).get();
            String hierarchyLabel = hierarchyType.getDisplayLabel().getValue(currentLocale);
            for (String pCode : pCodes) {
                ServerGeoObjectType got = ServerGeoObjectType.get(pCode);
                String typeLabel = got.getLabel().getValue(currentLocale);
                String attributeName = hCode.toLowerCase() + pCode.toLowerCase();
                String label = typeLabel + " (" + hierarchyLabel + ")";
                String codeDescription = LocalizationFacade.localize("masterlist.code.description");
                codeDescription = codeDescription.replaceAll("\\{typeLabel\\}", typeLabel);
                codeDescription = codeDescription.replaceAll("\\{hierarchyLabel\\}", hierarchyLabel);
                String labelDescription = LocalizationFacade.localize("masterlist.label.description");
                labelDescription = labelDescription.replaceAll("\\{typeLabel\\}", typeLabel);
                labelDescription = labelDescription.replaceAll("\\{hierarchyLabel\\}", hierarchyLabel);
                MdAttributeCharacterDAO mdAttributeCode = MdAttributeCharacterDAO.newInstance();
                mdAttributeCode.setValue(MdAttributeCharacterInfo.NAME, attributeName);
                mdAttributeCode.setValue(MdAttributeCharacterInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
                mdAttributeCode.setValue(MdAttributeCharacterInfo.SIZE, "255");
                mdAttributeCode.setStructValue(MdAttributeCharacterInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, label);
                mdAttributeCode.addItem(MdAttributeCharacterInfo.INDEX_TYPE, IndexTypes.NON_UNIQUE_INDEX.getOid());
                mdAttributeCode.setStructValue(MdAttributeCharacterInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, codeDescription);
                mdAttributeCode.apply();
                MdAttributeCharacterDAO mdAttributeDefaultLocale = MdAttributeCharacterDAO.newInstance();
                mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.NAME, attributeName + DEFAULT_LOCALE);
                mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
                mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.SIZE, "255");
                mdAttributeDefaultLocale.setStructValue(MdAttributeCharacterInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, label + " (defaultLocale)");
                mdAttributeDefaultLocale.setStructValue(MdAttributeCharacterInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, labelDescription.replaceAll("\\{locale\\}", "default"));
                mdAttributeDefaultLocale.apply();
                for (Locale locale : locales) {
                    MdAttributeCharacterDAO mdAttributeLocale = MdAttributeCharacterDAO.newInstance();
                    mdAttributeLocale.setValue(MdAttributeCharacterInfo.NAME, attributeName + locale.toString());
                    mdAttributeLocale.setValue(MdAttributeCharacterInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
                    mdAttributeLocale.setValue(MdAttributeCharacterInfo.SIZE, "255");
                    mdAttributeLocale.setStructValue(MdAttributeCharacterInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, label + " (" + locale + ")");
                    mdAttributeLocale.setStructValue(MdAttributeCharacterInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, labelDescription.replaceAll("\\{locale\\}", locale.toString()));
                    mdAttributeLocale.apply();
                }
            }
        }
    }
    JsonArray subtypeHierarchies = masterlist.getSubtypeHierarchiesAsJson();
    for (int i = 0; i < subtypeHierarchies.size(); i++) {
        JsonObject hierarchy = subtypeHierarchies.get(i).getAsJsonObject();
        if (hierarchy.has("selected") && hierarchy.get("selected").getAsBoolean()) {
            String hCode = hierarchy.get("code").getAsString();
            HierarchyType hierarchyType = ServiceFactory.getAdapter().getMetadataCache().getHierachyType(hCode).get();
            String hierarchyLabel = hierarchyType.getLabel().getValue(currentLocale);
            String attributeName = hCode.toLowerCase();
            String codeDescription = LocalizationFacade.localize("masterlist.code.description");
            codeDescription = codeDescription.replaceAll("\\{typeLabel\\}", "");
            codeDescription = codeDescription.replaceAll("\\{hierarchyLabel\\}", hierarchyLabel);
            String labelDescription = LocalizationFacade.localize("masterlist.label.description");
            labelDescription = labelDescription.replaceAll("\\{typeLabel\\}", "");
            labelDescription = labelDescription.replaceAll("\\{hierarchyLabel\\}", hierarchyLabel);
            MdAttributeCharacterDAO mdAttributeCode = MdAttributeCharacterDAO.newInstance();
            mdAttributeCode.setValue(MdAttributeCharacterInfo.NAME, attributeName);
            mdAttributeCode.setValue(MdAttributeCharacterInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
            mdAttributeCode.setValue(MdAttributeCharacterInfo.SIZE, "255");
            mdAttributeCode.setStructValue(MdAttributeCharacterInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, hierarchyLabel);
            mdAttributeCode.addItem(MdAttributeCharacterInfo.INDEX_TYPE, IndexTypes.NON_UNIQUE_INDEX.getOid());
            mdAttributeCode.setStructValue(MdAttributeCharacterInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, codeDescription);
            mdAttributeCode.apply();
            MdAttributeCharacterDAO mdAttributeDefaultLocale = MdAttributeCharacterDAO.newInstance();
            mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.NAME, attributeName + DEFAULT_LOCALE);
            mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
            mdAttributeDefaultLocale.setValue(MdAttributeCharacterInfo.SIZE, "255");
            mdAttributeDefaultLocale.setStructValue(MdAttributeCharacterInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, hierarchyLabel + " (defaultLocale)");
            mdAttributeDefaultLocale.setStructValue(MdAttributeCharacterInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, labelDescription.replaceAll("\\{locale\\}", "default"));
            mdAttributeDefaultLocale.apply();
            for (Locale locale : locales) {
                MdAttributeCharacterDAO mdAttributeLocale = MdAttributeCharacterDAO.newInstance();
                mdAttributeLocale.setValue(MdAttributeCharacterInfo.NAME, attributeName + locale.toString());
                mdAttributeLocale.setValue(MdAttributeCharacterInfo.DEFINING_MD_CLASS, mdTableDAO.getOid());
                mdAttributeLocale.setValue(MdAttributeCharacterInfo.SIZE, "255");
                mdAttributeLocale.setStructValue(MdAttributeCharacterInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, hierarchyLabel + " (" + locale + ")");
                mdAttributeLocale.setStructValue(MdAttributeCharacterInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, labelDescription.replaceAll("\\{locale\\}", locale.toString()));
                mdAttributeLocale.apply();
            }
        }
    }
    return metadata;
}
Also used : TableMetadata(net.geoprism.registry.masterlist.TableMetadata) Locale(java.util.Locale) MdAttributeFloatDAO(com.runwaysdk.dataaccess.metadata.MdAttributeFloatDAO) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) MdBusinessDAO(com.runwaysdk.dataaccess.metadata.MdBusinessDAO) MdBusiness(com.runwaysdk.system.metadata.MdBusiness) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonObject(com.google.gson.JsonObject) MdAttributeMultiLineString(com.runwaysdk.system.gis.metadata.MdAttributeMultiLineString) MdAttributeLineString(com.runwaysdk.system.gis.metadata.MdAttributeLineString) MdAttributeUUIDDAO(com.runwaysdk.dataaccess.metadata.MdAttributeUUIDDAO) MultiPoint(com.vividsolutions.jts.geom.MultiPoint) MdAttributePoint(com.runwaysdk.system.gis.metadata.MdAttributePoint) MdAttributeMultiPoint(com.runwaysdk.system.gis.metadata.MdAttributeMultiPoint) Point(com.vividsolutions.jts.geom.Point) JsonArray(com.google.gson.JsonArray) MdAttributeCharacterDAO(com.runwaysdk.dataaccess.metadata.MdAttributeCharacterDAO) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType)

Example 5 with MdBusiness

use of com.runwaysdk.system.metadata.MdBusiness in project geoprism-registry by terraframe.

the class ListTypeVersion method delete.

@Override
@Transaction
public void delete() {
    // Delete all jobs
    // List<ExecutableJob> jobs = this.getJobs();
    // 
    // for (ExecutableJob job : jobs)
    // {
    // job.delete();
    // }
    // Delete tile cache
    ListTileCache.deleteTiles(this);
    ListTypeAttributeGroup.deleteAll(this);
    MdBusiness mdTable = this.getMdBusiness();
    super.delete();
    if (mdTable != null) {
        MdBusinessDAO mdBusiness = MdBusinessDAO.get(this.getMdBusinessOid()).getBusinessDAO();
        mdBusiness.deleteAllRecords();
        mdTable.delete();
    }
    if (this.getGeospatialVisibility().equals(ListType.PUBLIC)) {
        new GeoserverRemoveWMSCommand(this).doIt();
    }
}
Also used : MdBusinessDAO(com.runwaysdk.dataaccess.metadata.MdBusinessDAO) MdBusiness(com.runwaysdk.system.metadata.MdBusiness) GeoserverRemoveWMSCommand(net.geoprism.registry.command.GeoserverRemoveWMSCommand) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

MdBusiness (com.runwaysdk.system.metadata.MdBusiness)28 MdBusinessDAO (com.runwaysdk.dataaccess.metadata.MdBusinessDAO)13 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)13 Locale (java.util.Locale)12 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)12 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)11 Business (com.runwaysdk.business.Business)10 LinkedList (java.util.LinkedList)10 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)10 QueryFactory (com.runwaysdk.query.QueryFactory)9 MdAttributeLineString (com.runwaysdk.system.gis.metadata.MdAttributeLineString)8 MdAttributeMultiLineString (com.runwaysdk.system.gis.metadata.MdAttributeMultiLineString)8 MdAttributeMultiPoint (com.runwaysdk.system.gis.metadata.MdAttributeMultiPoint)8 MdAttributePoint (com.runwaysdk.system.gis.metadata.MdAttributePoint)8 MdAttributeCharacter (com.runwaysdk.system.metadata.MdAttributeCharacter)8 List (java.util.List)8 MdAttributeBoolean (com.runwaysdk.system.metadata.MdAttributeBoolean)7 MdAttributeDouble (com.runwaysdk.system.metadata.MdAttributeDouble)7 MdAttributeLong (com.runwaysdk.system.metadata.MdAttributeLong)7 JsonArray (com.google.gson.JsonArray)6