Skip navigation links

Oracle® Information Rights Management Server Java API Reference
11g Release 1 (11.1.1)

E12907-03


oracle.irm.engine.core.general
Class LabelOperationsInstance

java.lang.Object
  extended by oracle.irm.engine.core.general.LabelOperationsInstance


public final class LabelOperationsInstance
extends Object

Operations on labels. Provides utilities for working with labels and collections of labels.

This class provides static methods for a set of procedural style methods. The methods can be made to appear as global methods by using import static. e.g.

import static oracle.irm.engine.core.general.LabelOperationsInstance.*;

Method Summary
static Collection<Label> copyLabels(Collection<Label> labels, int length)
          Copy a set of labels.
static Label getLabel(Collection<Label> labels, Locale[] locales)
          Get a label from a collection.
static Label getUnknownLabel(Locale locale)
          Get the unknown label.
static Collection<Label> sortLabels(Collection<Label> labels, Locale[] locales)
          Sort labels into a locale preference order.
static void validateLabel(Label label, int name, int description)
          Validate the name and description lengths of a label.
static void validateLabels(Collection<Label> labels, int name, int description)
          Validate the name and description lengths of a set of label values.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

getLabel

public static Label getLabel(Collection<Label> labels,
                             Locale[] locales)
Get a label from a collection. Give a set of locales, find the most appropriate label.
Parameters:
labels - the set of labels. This parameter is optional, it is valid to pass null or an empty collection.
locales - locales. The labels are searched in the same order as the provided array.
Returns:
the matched label. If no label is available the 'unknown' label is returned. This method will never return null.

getUnknownLabel

public static Label getUnknownLabel(Locale locale)
Get the unknown label. The unknown label is a default label with the words no label available. The unknown label can be used if a label is not available for an object.
Parameters:
locale - locale. The locale required.
Returns:
the unknown label. This method will never return null.

copyLabels

public static Collection<Label> copyLabels(Collection<Label> labels,
                                           int length)
Copy a set of labels. Performs a deep copy of the label attributes. The Name property is also changed to reflect the label has been copied. For example, in English, the label Top Secret would turn into Copy Of Top Secret. If the new label name exceeds the maximum length provided the copied name is truncated.
Parameters:
labels - the set of labels to copy. This parameter is optional, it is valid to pass null or an empty collection.
length - maximum label name size. Set the size to 0 if there is no limit of the length of the name.
Returns:
the copied labels. If applicable, this method will return an empty collection rather than null to indicate no results.

sortLabels

public static Collection<Label> sortLabels(Collection<Label> labels,
                                           Locale[] locales)
Sort labels into a locale preference order. This method allows a set of labels to be sorted based on a locale preference order. The desktop uses the label order as a fall back mechanism when displaying classification details. If there is no appropriate label to display to the user the first label is displayed.
Parameters:
labels - the set of labels to sort. This parameter is optional, it is valid to pass null or an empty collection.
locales - the locale(s) sort order. If no locales are specified, the default locale is used as the only sort criteria. This parameter is optional, it is valid to pass null.
Returns:
the sorted labels. If applicable, this method will return an empty collection rather than null to indicate no results.

validateLabels

public static void validateLabels(Collection<Label> labels,
                                  int name,
                                  int description)
                           throws IllegalArgumentException
Validate the name and description lengths of a set of label values.
Parameters:
labels - labels to validate. This parameter is optional, it is valid to pass null or an empty collection.
name - maximum name size.
description - maximum description size. Ignored if a label does not have a maximum size.
Throws:
IllegalArgumentException - if either the name or description have invalid lengths.

validateLabel

public static void validateLabel(Label label,
                                 int name,
                                 int description)
                          throws IllegalArgumentException
Validate the name and description lengths of a label.
Parameters:
label - label to validate.
name - maximum name size.
description - maximum description size. Ignored if a label does not have a description.
Throws:
IllegalArgumentException - if either the name or description have invalid lengths.

Skip navigation links

Oracle® Information Rights Management Server Java API Reference
11g Release 1 (11.1.1)

E12907-03


Copyright © 2011, Oracle. All rights reserved.