atg.svc.repository.beans.methods
Class SolutionFieldMethods

java.lang.Object
  extended by atg.svc.repository.beans.methods.BaseMethods
      extended by atg.svc.repository.beans.methods.SolutionFieldMethods

public class SolutionFieldMethods
extends BaseMethods

Defines extension methods for the SolutionField object.


Field Summary
static java.lang.String CLASS_VERSION
           
static SolutionFieldValue[] EMPTY_FIELDVALUE_ARRAY
           
 
Constructor Summary
SolutionFieldMethods()
           
 
Method Summary
 SolutionFieldValue createSolutionFieldValue(SolutionField pField)
          Creates a SolutionFieldValue for the given SolutionField.
 atg.svc.repository.beans.SolutionClassFieldDefinition getComputedSolutionClassFieldDefinition(SolutionField pField)
          Fix for bug 157924.
 java.lang.String getDisplayName(SolutionField pField)
          Gets the display name for the field.
 java.util.List getExternallyVisibleFieldValues(SolutionField pSolutionField)
          Gets the list of values that are visible to everyone external.
 boolean getIsContent(SolutionField pField)
          Returns true if this field is a Content field, false if this field is a Property field.
 boolean getIsEditable(SolutionField pField)
          Returns true if this field is editable.
 boolean getIsExternallyVisibleToEveryone(SolutionField pField)
          Returns true if this field is always externally visible.
 boolean getIsExternallyVisibleToSegment(java.lang.String pSegment, SolutionField pField)
          Returns true if this field is externally visible to the given segment.
 boolean getIsVisible(SolutionField pField)
          Returns true if this field is visible.
 java.lang.String getName(SolutionField pField)
          Gets the name of the field.
 atg.svc.repository.beans.Solution getSolution(SolutionField pField)
          Gets the parent Solution of the SolutionField.
 java.lang.Object getValue(SolutionField pField)
          Gets the value of the field.
 void setValue(java.lang.Object pValue, SolutionField pField)
          Sets the value of the SolutionField.
 
Methods inherited from class atg.svc.repository.beans.methods.BaseMethods
getServiceFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
See Also:
Constant Field Values

EMPTY_FIELDVALUE_ARRAY

public static final SolutionFieldValue[] EMPTY_FIELDVALUE_ARRAY
Constructor Detail

SolutionFieldMethods

public SolutionFieldMethods()
Method Detail

getValue

public java.lang.Object getValue(SolutionField pField)
Gets the value of the field. If the field is a content field the array of SolutionFieldValue beans will be returned. If the field is a property field and has more than one value an array of values will be returned. If the field is a property field and has just a single value the value itself is returned.

Parameters:
pField - The field to get the value from.
Returns:
The value of the field as described above.

setValue

public void setValue(java.lang.Object pValue,
                     SolutionField pField)
Sets the value of the SolutionField. If the value is an array each array value is turned into a SolutionFieldValue and set on the field. If the value is a single value the single value is turned into a SolutionFieldValue. If the value is an array of SolutionFieldValue objects those are copied into the field. For content fields the value given must be of type SolutionFieldValue[]. If the passed value is null that will remove the current value from the field.

Parameters:
pValue - The value to set. To remove the old values on the field and set it to null pass null.
pField - The field to set the value on.
Throws:
java.lang.IllegalArgumentException - If the field being set is a content field and the value argument is not of type SolutionFieldValue[].
atg.core.exception.ContainerRuntimeException - If the old value(s) on the field cannot be deleted before the new value(s) are set.

getIsVisible

public boolean getIsVisible(SolutionField pField)
Returns true if this field is visible. Visibility is determined by the privileges of the current user.

Parameters:
pField - The field to check.
Returns:
True if the field is visible else false.

getIsExternallyVisibleToEveryone

public boolean getIsExternallyVisibleToEveryone(SolutionField pField)
Returns true if this field is always externally visible.

Parameters:
pField - The field to check.
Returns:
True if the field is externally visible to everyone else false.

getIsExternallyVisibleToSegment

public boolean getIsExternallyVisibleToSegment(java.lang.String pSegment,
                                               SolutionField pField)
Returns true if this field is externally visible to the given segment.

Parameters:
pSegment - The segment to check.
pField - The field to check.
Returns:
True if the field is externally visible to the given segment.

getIsEditable

public boolean getIsEditable(SolutionField pField)
Returns true if this field is editable. Editability is determined by the privileges of the current user.

Parameters:
pField - The field to check.
Returns:
True if the field is editable else false.

getIsContent

public boolean getIsContent(SolutionField pField)
Returns true if this field is a Content field, false if this field is a Property field.

Parameters:
pField - The field to check.
Returns:
True if this field is a Content field, false if this field is a Property field.

getSolution

public atg.svc.repository.beans.Solution getSolution(SolutionField pField)
                                              throws ObjectNotFoundException
Gets the parent Solution of the SolutionField.

Parameters:
pField - The field to find the parent Solution for.
Returns:
The parent Solution or null if the given field is a bean without an id.
Throws:
ObjectNotFoundException

getExternallyVisibleFieldValues

public java.util.List getExternallyVisibleFieldValues(SolutionField pSolutionField)
Gets the list of values that are visible to everyone external.

Parameters:
pSolutionField - The field to get the values from.
Returns:
A List of SolutionFieldValue objects visible to everyone external or an empty List is there are none.

getDisplayName

public java.lang.String getDisplayName(SolutionField pField)
Gets the display name for the field. The display name is the computed display name of the field's solutionClassFieldDefinition property.

Parameters:
pField - The field to get the display name from.
Returns:
A String with the display name.
See Also:
SolutionClassFieldDefinition

getName

public java.lang.String getName(SolutionField pField)
Gets the name of the field. This is the unique name the represents the field in the solution field map.

Parameters:
pField - The field to get the field name from.
Returns:
The name that can be use to retrieve the SolutionField value from the Solution DynamicBean.

getComputedSolutionClassFieldDefinition

public atg.svc.repository.beans.SolutionClassFieldDefinition getComputedSolutionClassFieldDefinition(SolutionField pField)
Fix for bug 157924. If a FieldDefinition is removed from a SolutionClass, the SolutionField.SolutionClassFieldDefinition is nulled. If the FieldDefinition is added back into the SolutionClass, its created with a new id but still references the same field name. There is logic to filter out fields that no longer exist in the solution class, but that logic checks the field name which hasn't changed. That is most likely what has happened in this case. We can recover though. We need to find the current SolutionClassFieldDefinition We can do that by looking up the SolutionClassFieldDefinition for the field name and solution class for this field.

Parameters:
pField - The field to get the field name from.
Returns:
The value of the solutionClassFieldDefinition. If null, looks up the SolutionClassFieldDefintion in the SolutionClass by field name. if a match is found, returns that SolutionClassFieldDefinition. Otherwise returns null.

createSolutionFieldValue

public SolutionFieldValue createSolutionFieldValue(SolutionField pField)
                                            throws javax.ejb.CreateException
Creates a SolutionFieldValue for the given SolutionField.

Parameters:
pField - The field to create the SolutionFieldValue for.
Returns:
The SolutionFieldValue impl.
Throws:
javax.ejb.CreateException - If the SolutionFieldValue is a repository bean and the creation of that bean fails.