/** * return the notice message */ public String getMessage() { if (this.message != null) { return this.message.getKey(); } return null; }
/** * * Parameterize this translate key by specifying * dictionary parameters. This will not modify the * current translate object but instead create a * cloned copy that has been parameterized. * * @param dictionaryParameters The dictionary parameters */ public Message parameterize(Object ... dictionaryParameters) { return new ParameterizedMessage(catalogue,key,dictionaryParameters); }
/** * Generate a specialized name based on the callers name. This is typically * used in situations where two namespaces are being merged together so that * each namespace is prepended with the current scope's name. * * @param name * A locally unique name that distinguished this element from * among it's siblings. */ public String generateName(String name) { return combine(componentName, name); }
/** * Set up the transformer so that it can build a feeder Wing document and * merge it into the main document * * FIXME: Update document: - this method must be called to initialize the * framework. It must be called after the component's setup has been called * and the implementing object setup. * */ public void setupWing() throws WingException { this.wingContext = new WingContext(); this.wingContext.setLogger(this.getLogger()); this.wingContext.setComponentName(this.getComponentName()); this.wingContext.setObjectManager(this.getObjectManager()); feederDocument = this.createWingDocument(wingContext); this.stack = new Stack<WingMergeableElement>(); }
ObjectManager objectManager = context.getObjectManager(); throw new WingException( "Unable to reference object because no object manager has been defined."); if (!objectManager.manageObject(object)) throw new WingException( "The available object manager is unable to manage the give object."); this.url = objectManager.getObjectURL(object); this.repository = objectManager.getRepositoryIdentifier(object); this.type = objectManager.getObjectType(object);
/** * Another variation of the put method to convert boolean values into * strings. The values "yes" or "no" will be used in replacement of the * boolean value. * * @param key * @param value * @return */ public String put(String key, boolean value) { return this.put(key, (value ? "yes" : "no")); } }
/** * Construct a new RepositoryMeta * * @param context * (Required) The context this element is contained in, such as * where to route SAX events and what i18n catalogue to use. */ protected RepositoryMeta(WingContext context) throws WingException { super(context); ObjectManager objectManager = context.getObjectManager(); if (!(objectManager == null)) { this.repositories = objectManager.getAllManagedRepositories(); } }
/** * This is a short cut method for creating a new message object, this * allows them to be created with one simple method call that uses * the default catalogue. * * @param key * The catalogue key used to look up a message. * @return A new message object. */ public static Message message(String key) { return message(getDefaultMessageCatalogue(), key); }
/** * This is a short cut method for creating a new message object. This * version allows the callie to specify a particular catalogue overriding * the default catalogue supplied. * * @param catalogue * The catalogue where translations will be located. * @param key * The catalogue key used to look up a translation within the * catalogue. * @return A new message object. */ public static Message message(String catalogue, String key) { return new Message(catalogue, key); }
/** * Check to make sure that the boolean test value is true. * * @param test * A true value. * @param message * The exception message thrown if "test" is invalid. */ protected void requireTrue(boolean test, String message) throws WingInvalidArgument { if (!test) { throw new WingInvalidArgument(message); } }
/** * Recyle */ public void recycle() { this.objectModel = null; this.context = null; this.contextPath = null; this.servletPath = null; this.sitemapURI = null; this.url=null; this.parameters=null; this.eperson=null; this.knot=null; this.objectManager=null; super.recycle(); }
/** * Dispose */ public void dispose() { this.objectModel = null; this.context = null; this.contextPath = null; this.servletPath = null; this.sitemapURI = null; this.url=null; this.parameters=null; this.eperson=null; this.knot=null; this.objectManager=null; super.dispose(); }
/** * Receive notification of the end of a document. */ public void endDocument() throws SAXException { wingContext.dispose(); super.endDocument(); }
/** * Return the notice header */ public String getHeader() { if (this.header != null) { return this.header.getKey(); } return null; }
/** * Another variation of the put method to convert integer values into * strings. * * @param key * The attribute's name. * @param value * The value of the attribute. * @return */ public String put(String key, int value) { return this.put(key, String.valueOf(value)); }
/** * Check to make sure that the boolean test value is false. * * @param test * A false value. * @param message * The exception message thrown if "test" is invalid. */ protected void requireFalse(boolean test, String message) throws WingInvalidArgument { if (test) { throw new WingInvalidArgument(message); } }
/** * Generate a unique id with a sub name. Like the other form of generateID * this will append another sub-name. This is typically used for when * duplicate names are used but further identification is needed for * globally unique names. * * @param application * The application of this element, typically this is the element * type that is being identified. Such as p, div, table, field, * etc... * @param name * A locally unique name that distinguished this element from * among its siblings. * @param subName * An additional name to the original name to further identify it * in cases when just the name alone does not accomplish this. * @return */ public String generateID(String application, String name, String subName) { return combine(componentName, application, name, subName); }
/** * Check to make sure the parameter is not null or an empty string. * * @param parameter * A non null and none empty string * @param message * The exception message thrown if parameter is invalid. */ protected void require(Message parameter, String message) throws WingInvalidArgument { if (parameter == null) { throw new WingInvalidArgument(message); } }
/** * Check to make sure that the parameter is GREATER THAN (note: not equal * to) the given greater variable. * * @param parameter * An int who's value is greater than greater. * @param greater * An int who's value is lesser that greater. * @param message * The exception message thrown if the parameter is invalid. */ protected void greater(int parameter, int greater, String message) throws WingInvalidArgument { if (parameter <= greater) { throw new WingInvalidArgument(message); } }
/** * Check to make sure that the parameter is LESS THAN (note: not equal to) * the given lesser variable. * * @param parameter * An int who's value is less than lesser. * @param lesser * An int who's value is greater that lesser. * @param message * The exception message thrown if the parameter is invalid. */ protected void lesser(int parameter, int lesser, String message) throws WingInvalidArgument { if (parameter >= lesser) { throw new WingInvalidArgument(message); } }