Search in sources :

Example 71 with MissingResourceException

use of java.util.MissingResourceException in project processdash by dtuma.

the class WBSModelMergeConflictNotificationFactory method refineAttributeNotification.

private static boolean refineAttributeNotification(MergeConflictNotification mcn, DataModelSource dms) {
    if (!(mcn.getMergeWarning() instanceof AttributeMergeWarning))
        return false;
    ModelType modelType = mcn.getModelType();
    AttributeMergeWarning amw = (AttributeMergeWarning) mcn.getMergeWarning();
    DataTableModel dataModel = dms.getDataModel(modelType);
    ConflictCapableDataColumn column = findColumnForAttribute(dataModel, amw.getAttributeName());
    if (column == null)
        return false;
    String columnId = column.getColumnID().replace(' ', '_');
    mcn.putAttribute(COLUMN_ID, columnId);
    mcn.putAttribute(COLUMN_NAME, column.getColumnName());
    String explicitMessageKey = modelType.name() + ".Attribute." + columnId;
    String nullDisplay;
    try {
        nullDisplay = resources.getHTML(explicitMessageKey + ".Blank");
    } catch (MissingResourceException mre) {
        nullDisplay = resources.getHTML("WBSNode_Attribute.Blank");
    }
    WBSNode baseNode = mcn.getAttribute(MergeConflictNotification.BASE_NODE);
    String baseValue = (String) amw.getBaseValue();
    Object baseDisp = (//
    baseNode == null ? //
    baseValue : column.getConflictDisplayValue(baseValue, baseNode));
    if (baseDisp == null)
        baseDisp = nullDisplay;
    WBSNode mainNode = mcn.getAttribute(MergeConflictNotification.MAIN_NODE);
    String mainValue = (String) amw.getMainValue();
    Object mainDisp = (//
    mainNode == null ? //
    mainValue : column.getConflictDisplayValue(mainValue, mainNode));
    if (mainDisp == null)
        mainDisp = nullDisplay;
    WBSNode incNode = mcn.getAttribute(MergeConflictNotification.INCOMING_NODE);
    String incValue = (String) amw.getIncomingValue();
    Object incDisp = (//
    incNode == null ? //
    incValue : column.getConflictDisplayValue(incValue, incNode));
    if (incDisp == null)
        incDisp = nullDisplay;
    mcn.putValueAttributes(baseDisp, mainDisp, incDisp);
    boolean supportsOverride;
    if (MergeConflictNotification.definesDescription(explicitMessageKey)) {
        // this column has explicitly defined a message it wants to
        // display, so we will use that message.
        mcn.setMessageKey(explicitMessageKey);
        // see if this column has defined a message for the
        // 'override' option.
        supportsOverride = mcn.definesMessageForUserOption(MergeConflictNotification.OVERRIDE);
    } else {
        // use a generic message.
        mcn.setMessageKey("WBSNode_Attribute");
        supportsOverride = true;
    }
    // Add "accept" as an option that is always present
    mcn.addUserOption(MergeConflictNotification.ACCEPT, null);
    // Add an "alter" option if it is supported
    if (supportsOverride)
        mcn.addUserOption(MergeConflictNotification.OVERRIDE, new WbsNodeAttributeHandler(dataModel, column));
    // give the column a final chance to tweak the configuration
    column.adjustConflictNotification(mcn);
    return true;
}
Also used : MissingResourceException(java.util.MissingResourceException) ModelType(teamdash.merge.ModelType) AttributeMergeWarning(teamdash.merge.AttributeMergeWarning)

Example 72 with MissingResourceException

use of java.util.MissingResourceException in project processdash by dtuma.

the class OpenDocument method getProp.

private String getProp(Element e, String resName, String defValue) {
    if (e == null)
        return defValue;
    Document doc = e.getOwnerDocument();
    if (doc == null)
        return defValue;
    Resources bundle = (Resources) resourceMap.get(doc);
    if (bundle == null)
        return defValue;
    resName = resName.replace(' ', '_');
    try {
        return resolveMetaReferences(bundle.getString(resName));
    } catch (MissingResourceException mre) {
    }
    return defValue;
}
Also used : MissingResourceException(java.util.MissingResourceException) Resources(net.sourceforge.processdash.i18n.Resources) Document(org.w3c.dom.Document)

Example 73 with MissingResourceException

use of java.util.MissingResourceException in project processdash by dtuma.

the class TeamMemberListMergeConflictNotificationFactory method create.

public static MergeConflictNotification create(TeamMemberListMerger merger, MergeWarning<Integer> mw) {
    MergeConflictNotification result = new MergeConflictNotification(ModelType.TeamList, mw);
    result.putNodeAttributes(merger.main.findTeamMemberByID(mw.getMainNodeID()), merger.incoming.findTeamMemberByID(mw.getIncomingNodeID()));
    result.addUserOption(MergeConflictNotification.DISMISS, null);
    try {
        result.formatDescription();
        return result;
    } catch (MissingResourceException mre) {
        System.err.println("Unexpected merge conflict key for " + "team member list: " + mre.getKey());
        return null;
    }
}
Also used : MissingResourceException(java.util.MissingResourceException) MergeConflictNotification(teamdash.merge.ui.MergeConflictNotification)

Example 74 with MissingResourceException

use of java.util.MissingResourceException in project processdash by dtuma.

the class TinyCGIBase method parseResourceFile.

protected void parseResourceFile(String context, String filename) throws IOException {
    String bundleName = resolveRelativeURI(context, filename);
    int pos = bundleName.indexOf("//");
    if (pos != -1)
        bundleName = bundleName.substring(pos + 1);
    pos = bundleName.lastIndexOf('.');
    if (pos != -1 && bundleName.indexOf('/', pos) == -1)
        bundleName = bundleName.substring(0, pos);
    try {
        Resources bundle = Resources.getTemplateBundle(bundleName);
        getInterpolator().addResources(bundle);
    } catch (MissingResourceException mre) {
        System.out.println("Couldn't find resource file: " + bundleName);
        System.out.println("(Specified as '" + filename + "' from '" + context + "')");
    }
}
Also used : MissingResourceException(java.util.MissingResourceException) Resources(net.sourceforge.processdash.i18n.Resources)

Example 75 with MissingResourceException

use of java.util.MissingResourceException in project uPortal by Jasig.

the class XmlChannelPublishingDefinitionDao method loadChannelPublishingDefinition.

private PortletPublishingDefinition loadChannelPublishingDefinition(int channelTypeId) {
    // if the CPD is not already in the cache, determine the CPD URI
    final String cpdUri;
    if (channelTypeId >= 0) {
        final IPortletType type = this.portletTypeRegistry.getPortletType(channelTypeId);
        if (type == null) {
            throw new IllegalArgumentException("No ChannelType registered with id: " + channelTypeId);
        }
        cpdUri = type.getCpdUri();
    } else {
        throw new IllegalArgumentException("No ChannelType registered with id: " + channelTypeId);
    }
    // read and parse the CPD
    final PortletPublishingDefinition def;
    final Resource cpdResource = this.resourceLoader.getResource("classpath:" + cpdUri);
    if (!cpdResource.exists()) {
        throw new MissingResourceException("Failed to find CPD '" + cpdUri + "' for channel type " + channelTypeId, this.getClass().getName(), cpdUri);
    }
    final InputStream cpdStream;
    try {
        cpdStream = cpdResource.getInputStream();
    } catch (IOException e) {
        throw new MissingResourceException("Failed to load CPD '" + cpdUri + "' for channel type " + channelTypeId, this.getClass().getName(), cpdUri);
    }
    try {
        def = (PortletPublishingDefinition) this.unmarshaller.unmarshal(cpdStream);
        final List<Step> sharedParameters = this.getSharedParameters();
        def.getSteps().addAll(sharedParameters);
        // add the CPD to the cache and return it
        this.cpdCache.put(channelTypeId, def);
        return def;
    } catch (JAXBException e) {
    } finally {
        IOUtils.closeQuietly(cpdStream);
    }
    return null;
}
Also used : IPortletType(org.apereo.portal.portlet.om.IPortletType) InputStream(java.io.InputStream) MissingResourceException(java.util.MissingResourceException) JAXBException(javax.xml.bind.JAXBException) Resource(org.springframework.core.io.Resource) PortletPublishingDefinition(org.apereo.portal.portletpublishing.xml.PortletPublishingDefinition) IOException(java.io.IOException) Step(org.apereo.portal.portletpublishing.xml.Step)

Aggregations

MissingResourceException (java.util.MissingResourceException)163 ResourceBundle (java.util.ResourceBundle)85 Locale (java.util.Locale)67 ArrayList (java.util.ArrayList)13 IOException (java.io.IOException)10 MessageFormat (java.text.MessageFormat)8 HashMap (java.util.HashMap)8 Map (java.util.Map)8 File (java.io.File)7 PropertyResourceBundle (java.util.PropertyResourceBundle)7 SMSException (com.sun.identity.sm.SMSException)6 Secure.getString (android.provider.Settings.Secure.getString)5 SSOException (com.iplanet.sso.SSOException)5 Iterator (java.util.Iterator)5 Set (java.util.Set)5 InputStream (java.io.InputStream)4 HashSet (java.util.HashSet)4 ISResourceBundle (com.sun.identity.common.ISResourceBundle)3 SimpleDateFormat (java.text.SimpleDateFormat)3 Enumeration (java.util.Enumeration)3