Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ru.gammalabs.ice.publishing
Class IE  view IE download IE.java

java.lang.Object
  extended byru.gammalabs.ice.publishing.IE
All Implemented Interfaces:
java.lang.Comparable

public class IE
extends java.lang.Object
implements java.lang.Comparable

Represents information element. The information element stores all information about article, breif article, news, report, interview and others objects of such type.


Field Summary
private  java.util.Map fields
          The map of fields of information element.
private  ru.gammalabs.ice.publishing.framework.Id id
          The identifier of information element.
private  IEFieldGetter ieFieldManager
           
private  java.util.Map oldFields
           
private  ru.gammalabs.ice.iemanagement.IEType type
          The type of information element.
 
Constructor Summary
IE(IEFieldGetter ieFieldManager)
          Empty constructor constructs null identifier and empty fields.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with another, and returns a numerical result based on the comparison.
 boolean equals(java.lang.Object o)
          Determine whether this Object is semantically equal to another Object.
 java.util.Set getAllNotNullFields()
          Returns set of IFType of all not null fields in this ie.
 AbstractIF getField(ru.gammalabs.ice.iemanagement.IFType name)
          Returns value of field name in this ie, If this field is not defined or not exist in this ie, returns null.
 ru.gammalabs.ice.publishing.framework.Id getId()
          Returns identifier of this ie object, if identifier is not defined, returns identifier of null object, not null identifier.
 java.lang.String getName()
           
 AbstractIF getOldField(ru.gammalabs.ice.iemanagement.IFType name)
          Gets old field value, if specified field is invalid.
 IEStatus getOldStatus()
          Gets information element's old status.
 java.util.Set getPartitionIds()
          Returns set partitions this ie linked to.
 IEStatus getStatus()
           
 ru.gammalabs.ice.iemanagement.IEType getType()
          Returns this ie type IEType.
 long getViewCount()
           
 void initialize(java.util.Locale locale)
          Initialize new ie not in data base.
private  void invalidateField(ru.gammalabs.ice.iemanagement.IFType field)
          При изменении поля ИЭ если он не новый, сохраняем старое (валидное) значение.
 boolean isNew()
          Check IE is new (not created in database).
 void logAccess(ru.gammalabs.ice.security.Person activePerson)
           
 void reduceToType(java.util.Locale locale)
          Makes valid all fields in this ie according to its type and default values of its type and removes all fields in ie which are not defined in ie type.
 void removeField(ru.gammalabs.ice.iemanagement.IFType field)
          Removes value of field field if this ie has it, field can be null.
 void setField(ru.gammalabs.ice.iemanagement.IFType field, AbstractIF value, java.util.Locale locale)
          Sets new value of field field, if value is null, removes this field.
 void setId(ru.gammalabs.ice.publishing.framework.Id id)
          Sets identifier to this ie.
 void setType(ru.gammalabs.ice.iemanagement.IEType type)
          Sets new type to this ie.
 java.lang.String toString()
          Returns the string describing this ie.
 void validate()
          Validate information element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ieFieldManager

private IEFieldGetter ieFieldManager

id

private ru.gammalabs.ice.publishing.framework.Id id
The identifier of information element.


type

private ru.gammalabs.ice.iemanagement.IEType type
The type of information element.


fields

private java.util.Map fields
The map of fields of information element. Keys are IFType objects, values are AbstractIF objects.


oldFields

private java.util.Map oldFields
Constructor Detail

IE

public IE(IEFieldGetter ieFieldManager)
Empty constructor constructs null identifier and empty fields.

Method Detail

getId

public ru.gammalabs.ice.publishing.framework.Id getId()
Returns identifier of this ie object, if identifier is not defined, returns identifier of null object, not null identifier.


getType

public ru.gammalabs.ice.iemanagement.IEType getType()
Returns this ie type IEType. Returns null if type of this ie is not defined.


getOldField

public AbstractIF getOldField(ru.gammalabs.ice.iemanagement.IFType name)
Gets old field value, if specified field is invalid. Retuns null if it is valid.


getField

public AbstractIF getField(ru.gammalabs.ice.iemanagement.IFType name)
Returns value of field name in this ie, If this field is not defined or not exist in this ie, returns null.


getAllNotNullFields

public java.util.Set getAllNotNullFields()
Returns set of IFType of all not null fields in this ie. Some fields can exist in data base for this ie, but is not exist in this set.


toString

public java.lang.String toString()
Returns the string describing this ie.


setId

public void setId(ru.gammalabs.ice.publishing.framework.Id id)
Sets identifier to this ie.


setType

public void setType(ru.gammalabs.ice.iemanagement.IEType type)
Sets new type to this ie.


removeField

public void removeField(ru.gammalabs.ice.iemanagement.IFType field)
Removes value of field field if this ie has it, field can be null.


setField

public void setField(ru.gammalabs.ice.iemanagement.IFType field,
                     AbstractIF value,
                     java.util.Locale locale)
              throws ru.gammalabs.ice.publishing.framework.NullValueException,
                     AttachmentListException,
                     ru.gammalabs.ice.publishing.framework.LongValueException
Sets new value of field field, if value is null, removes this field.


invalidateField

private void invalidateField(ru.gammalabs.ice.iemanagement.IFType field)
При изменении поля ИЭ если он не новый, сохраняем старое (валидное) значение.


validate

public void validate()
Validate information element.


initialize

public void initialize(java.util.Locale locale)
Initialize new ie not in data base. Makes all fields in this ie according to its type and default value.


reduceToType

public void reduceToType(java.util.Locale locale)
                  throws ru.gammalabs.ice.publishing.framework.NullValueException,
                         ru.gammalabs.ice.publishing.framework.LongValueException,
                         AttachmentListException
Makes valid all fields in this ie according to its type and default values of its type and removes all fields in ie which are not defined in ie type. Checks all mandatory fields.


isNew

public boolean isNew()
Check IE is new (not created in database).


getStatus

public IEStatus getStatus()

getOldStatus

public IEStatus getOldStatus()
Gets information element's old status.


getPartitionIds

public java.util.Set getPartitionIds()
Returns set partitions this ie linked to. Set is setof Long objects.


getName

public java.lang.String getName()

compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object o)
Description copied from class: java.lang.Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

  • It must be transitive. If a.equals(b) and b.equals(c), then a.equals(c) must be true as well.
  • It must be symmetric. a.equals(b) and b.equals(a) must have the same value.
  • It must be reflexive. a.equals(a) must always be true.
  • It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
  • a.equals(null) must be false.
  • It must be consistent with hashCode(). That is, a.equals(b) must imply a.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.

This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.


logAccess

public void logAccess(ru.gammalabs.ice.security.Person activePerson)

getViewCount

public long getViewCount()