Search in sources :

Example 1 with PropertyXMLBuilder

use of com.sun.identity.console.property.PropertyXMLBuilder in project OpenAM by OpenRock.

the class MAPCreateDeviceModelImpl method getCreateDevicePropertyXML.

/**
     * Returns the XML for create device property sheet.
     *
     * @param clientType Name of Client Type.
     * @param style Name of Style.
     * @throws AMConsoleException if there are no attributes to display.
     * @return XML for create device property sheet.
     */
public String getCreateDevicePropertyXML(String clientType, String style) throws AMConsoleException {
    String xml = "";
    createDeviceReqAttrs = getReqAttributeSchemas();
    if ((createDeviceReqAttrs != null) && !createDeviceReqAttrs.isEmpty()) {
        getCreateDeviceDefaultValues(createDeviceReqAttrs, clientType, style);
        String serviceName = getClientCapDataIntInstance().getServiceName();
        try {
            PropertyXMLBuilder builder = new PropertyXMLBuilder(serviceName, this, createDeviceReqAttrs);
            xml = builder.getXML();
        } catch (SMSException e) {
            debug.warning("MAPCreateDeviceModelImpl.getCreateDevicePropertyXML", e);
        } catch (SSOException e) {
            debug.warning("MAPCreateDeviceModelImpl.getCreateDevicePropertyXML", e);
        }
    }
    return xml;
}
Also used : SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) PropertyXMLBuilder(com.sun.identity.console.property.PropertyXMLBuilder)

Example 2 with PropertyXMLBuilder

use of com.sun.identity.console.property.PropertyXMLBuilder in project OpenAM by OpenRock.

the class AbstractAuditModel method getAddEventHandlerPropertyXML.

/**
     * Get the JATO XML configuration for generation the UI used to add event handlers.
     *
     * @param schemaId The event handler schema ID.
     * @return The JATO XML configuration for generation the UI.
     * @throws AMConsoleException If an error occurs during the XML creation.
     */
public String getAddEventHandlerPropertyXML(String schemaId) throws AMConsoleException {
    try {
        ServiceSchema handlerSchema = getServiceSchema().getSubSchema(schemaId);
        updateHandlerResourceBundle(handlerSchema);
        xmlBuilder = new PropertyXMLBuilder(handlerSchema, this, handlerResourceBundle, getSectionsForHandler(schemaId), schemaId + SECTION_FILE_NAME_SUFFIX);
        xmlBuilder.setSupportSubConfig(false);
        String xml = xmlBuilder.getXML();
        String attributeNameXML = AMAdminUtils.getStringFromInputStream(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/propertyAuditEventHandlerName.xml"));
        return PropertyXMLBuilder.prependXMLProperty(xml, attributeNameXML);
    } catch (SMSException | SSOException e) {
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) PropertyXMLBuilder(com.sun.identity.console.property.PropertyXMLBuilder)

Example 3 with PropertyXMLBuilder

use of com.sun.identity.console.property.PropertyXMLBuilder in project OpenAM by OpenRock.

the class IDRepoModelImpl method getPropertyXMLString.

/**
     * Returns property sheet XML for ID Repo Profile.
     *
     * @param realmName Name of Realm.
     * @param viewbeanClassName Class Name of View Bean.
     * @param type Type of ID Repo.
     * @param bCreate <code>true</code> for creation operation.
     * @return property sheet XML for ID Repo Profile.
     */
public String getPropertyXMLString(String realmName, String viewbeanClassName, String type, boolean bCreate) throws AMConsoleException {
    try {
        ServiceSchemaManager schemaMgr = new ServiceSchemaManager(IdConstants.REPO_SERVICE, getUserSSOToken());
        ServiceSchema orgSchema = schemaMgr.getOrganizationSchema();
        ServiceSchema ss = orgSchema.getSubSchema(type);
        DelegationConfig dConfig = DelegationConfig.getInstance();
        boolean canModify = dConfig.hasPermission(realmName, null, AMAdminConstants.PERMISSION_MODIFY, this, viewbeanClassName);
        Set attributeSchemas = ss.getAttributeSchemas();
        PropertyXMLBuilder.removeAttributeSchemaWithoutI18nKey(attributeSchemas);
        PropertyXMLBuilder builder = new PropertyXMLBuilder(IdConstants.REPO_SERVICE, this, attributeSchemas, SchemaType.ORGANIZATION);
        if (!bCreate && !canModify) {
            builder.setAllAttributeReadOnly(true);
        }
        String xml = builder.getXML();
        String xmlFile = (bCreate) ? "com/sun/identity/console/propertyRMIDRepoAdd.xml" : "com/sun/identity/console/propertyRMIDRepoEdit.xml";
        String header = AMAdminUtils.getStringFromInputStream(getClass().getClassLoader().getResourceAsStream(xmlFile));
        xml = PropertyXMLBuilder.prependXMLProperty(xml, header);
        return xml;
    } catch (SMSException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) DelegationConfig(com.sun.identity.console.delegation.model.DelegationConfig) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) PropertyXMLBuilder(com.sun.identity.console.property.PropertyXMLBuilder) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 4 with PropertyXMLBuilder

use of com.sun.identity.console.property.PropertyXMLBuilder in project OpenAM by OpenRock.

the class MAPDeviceProfileModelImpl method getProfilePropertyXML.

/**
     * Returns the property XML for profile view.
     *
     * @param clientType Client Type.
     * @param classification Device attribute classification.
     * @throws AMConsoleException if there are no attribute to display.
     * @return the property XML for profile view.
     */
public String getProfilePropertyXML(String clientType, String classification) throws AMConsoleException {
    String xml = "";
    Set attributeNames = getAttributeNames(clientType, classification);
    Set attributeSchemas = getAttributeSchemas(attributeNames);
    try {
        PropertyXMLBuilder builder = new PropertyXMLBuilder(mapServiceName, this, attributeSchemas);
        xml = builder.getXML(getReadOnlyAttributeNames(clientType, attributeNames));
    } catch (SMSException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        throw new AMConsoleException(getErrorString(e));
    }
    return xml;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) PropertyXMLBuilder(com.sun.identity.console.property.PropertyXMLBuilder)

Example 5 with PropertyXMLBuilder

use of com.sun.identity.console.property.PropertyXMLBuilder in project OpenAM by OpenRock.

the class EntitiesModelImpl method getServicePropertySheetXML.

/**
     * Returns the XML for property sheet view component.
     *
     * @param realmName Name of Realm.
     * @param serviceName Name of service.
     * @param idType type of Identity.
     * @param bCreate true if the property sheet is for identity creation.
     * @param viewbeanClassName Class Name of View Bean.
     * @return the XML for property sheet view component.
     * @throws AMConsoleException if XML cannot be created.
     */
public String getServicePropertySheetXML(String realmName, String serviceName, IdType idType, boolean bCreate, String viewbeanClassName) throws AMConsoleException {
    setLocationDN(realmName);
    DelegationConfig dConfig = DelegationConfig.getInstance();
    try {
        ServiceSchema serviceSchema = AMAdminUtils.getSchemaSchema(serviceName, idType);
        Set set = new HashSet(2);
        set.add(serviceSchema.getServiceType());
        PropertyXMLBuilder xmlBuilder = new PropertyXMLBuilder(serviceName, set, this);
        if (!bCreate) {
            boolean canModify = dConfig.hasPermission(realmName, serviceName, AMAdminConstants.PERMISSION_MODIFY, this, viewbeanClassName);
            if (!canModify) {
                xmlBuilder.setAllAttributeReadOnly(true);
            }
        }
        String xml = xmlBuilder.getXML();
        if (idType.equals(IdType.ROLE)) {
            String cosPriority = AMAdminUtils.getStringFromInputStream(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/propertyEntitiesCOSPriority.xml"));
            if (xml != null) {
                xml = PropertyXMLBuilder.appendXMLProperty(xml, cosPriority);
            } else {
                xml = PropertyXMLBuilder.formPropertySheetXML(cosPriority, true);
            }
        }
        return xml;
    } catch (SMSException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) SMSException(com.sun.identity.sm.SMSException) DelegationConfig(com.sun.identity.console.delegation.model.DelegationConfig) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) PropertyXMLBuilder(com.sun.identity.console.property.PropertyXMLBuilder) HashSet(java.util.HashSet)

Aggregations

SSOException (com.iplanet.sso.SSOException)7 PropertyXMLBuilder (com.sun.identity.console.property.PropertyXMLBuilder)7 SMSException (com.sun.identity.sm.SMSException)7 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)6 DelegationConfig (com.sun.identity.console.delegation.model.DelegationConfig)4 ServiceSchema (com.sun.identity.sm.ServiceSchema)4 Set (java.util.Set)4 HashSet (java.util.HashSet)3 IdRepoException (com.sun.identity.idm.IdRepoException)1 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)1