Search in sources :

Example 1 with UnsupportedOperationException

use of com.amazonaws.services.kms.model.UnsupportedOperationException 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 2 with UnsupportedOperationException

use of com.amazonaws.services.kms.model.UnsupportedOperationException in project geoprism-registry by terraframe.

the class ListTypeVersion method create.

@Transaction
public static ListTypeVersion create(ListTypeEntry listEntry, boolean working, int versionNumber, JsonObject metadata) {
    ListType listType = listEntry.getListType();
    ListTypeVersion version = new ListTypeVersion();
    version.setEntry(listEntry);
    version.setListType(listType);
    version.setForDate(listEntry.getForDate());
    version.setVersionNumber(versionNumber);
    version.setWorking(working);
    if (metadata != null) {
        version.parse(metadata);
    }
    ServerGeoObjectType type = listType.getGeoObjectType();
    if (type.getIsPrivate() && (version.getListVisibility().equals(ListType.PUBLIC) || version.getGeospatialVisibility().equals(ListType.PUBLIC))) {
        throw new UnsupportedOperationException("A list version cannot be public if the Geo-Object Type is private");
    }
    TableMetadata tableMetadata = null;
    tableMetadata = version.createTable();
    version.setMdBusiness(tableMetadata.getMdBusiness());
    version.apply();
    if (tableMetadata != null) {
        Map<MdAttribute, MdAttribute> pairs = tableMetadata.getPairs();
        Set<Entry<MdAttribute, MdAttribute>> entries = pairs.entrySet();
        for (Entry<MdAttribute, MdAttribute> entry : entries) {
            ListTypeAttributeGroup.create(version, entry.getValue(), entry.getKey());
        }
    }
    ListTypeVersion.assignDefaultRolePermissions(version.getMdBusiness());
    return version;
}
Also used : TableMetadata(net.geoprism.registry.masterlist.TableMetadata) Entry(java.util.Map.Entry) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) MdAttribute(com.runwaysdk.system.metadata.MdAttribute) UnsupportedOperationException(com.amazonaws.services.kms.model.UnsupportedOperationException) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 3 with UnsupportedOperationException

use of com.amazonaws.services.kms.model.UnsupportedOperationException in project aws-sdk-android by aws-amplify.

the class UnsupportedOperationExceptionUnmarshaller method unmarshall.

@Override
public AmazonServiceException unmarshall(JsonErrorResponse error) throws Exception {
    UnsupportedOperationException e = (UnsupportedOperationException) super.unmarshall(error);
    e.setErrorCode("UnsupportedOperationException");
    return e;
}
Also used : UnsupportedOperationException(com.amazonaws.services.kms.model.UnsupportedOperationException)

Aggregations

UnsupportedOperationException (com.amazonaws.services.kms.model.UnsupportedOperationException)3 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)1 MdAttribute (com.runwaysdk.system.metadata.MdAttribute)1 MdAttributeBoolean (com.runwaysdk.system.metadata.MdAttributeBoolean)1 MdAttributeCharacter (com.runwaysdk.system.metadata.MdAttributeCharacter)1 MdAttributeConcrete (com.runwaysdk.system.metadata.MdAttributeConcrete)1 MdAttributeDateTime (com.runwaysdk.system.metadata.MdAttributeDateTime)1 MdAttributeDouble (com.runwaysdk.system.metadata.MdAttributeDouble)1 MdAttributeLong (com.runwaysdk.system.metadata.MdAttributeLong)1 MdBusiness (com.runwaysdk.system.metadata.MdBusiness)1 Locale (java.util.Locale)1 Entry (java.util.Map.Entry)1 TableMetadata (net.geoprism.registry.masterlist.TableMetadata)1 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)1 AttributeClassificationType (org.commongeoregistry.adapter.metadata.AttributeClassificationType)1 AttributeFloatType (org.commongeoregistry.adapter.metadata.AttributeFloatType)1 AttributeLocalType (org.commongeoregistry.adapter.metadata.AttributeLocalType)1 AttributeTermType (org.commongeoregistry.adapter.metadata.AttributeTermType)1