/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008 Sun Microsystems, Inc.
* Portions copyright 2013 ForgeRock, AS.
*/
/**
* The table model used to display all the base DNs.
*
*/
implements Comparator<BaseDNDescriptor>
{
private boolean isAuthenticated;
private boolean sortAscending = true;
private boolean displayReplicationInformation;
/**
* Key value to identify the case of a value not available because the server
* is down.
*/
/**
* Key value to identify the case of a value not available because
* authentication is required.
*/
"NOT_AVAILABLE_AUTHENTICATION_REQUIRED";
/**
* Key value to identify the case of a value not available.
*/
/**
* Constructor for this table model.
* @param displayReplicationInformation whether to display replication.
* monitoring information or not.
*/
{
this(displayReplicationInformation, true);
}
/**
* Constructor for this table model.
* @param displayReplicationInformation whether to display replication.
* @param wrapHeader whether to wrap the headers or not.
* monitoring information or not.
*/
boolean wrapHeader)
{
if (wrapHeader)
{
COLUMN_NAMES = new String[] {
};
}
else
{
COLUMN_NAMES = new String[] {
};
}
}
/**
* Sets the data for this table model.
* @param newData the data for this table model.
* @param status the server status.
* @param isAuthenticated whether the user provided authentication or not.
*/
{
(this.isAuthenticated != isAuthenticated))
{
this.isAuthenticated = isAuthenticated;
}
}
/**
* Updates the table model contents and sorts its contents depending on the
* sort options set by the user.
*/
public void forceResort()
{
}
/**
* Comparable implementation.
* @param desc1 the first replica descriptor to compare.
* @param desc2 the second replica descriptor to compare.
* @return 1 if according to the sorting options set by the user the first
* base DN descriptor must be put before the second descriptor, 0 if they
* are equivalent in terms of sorting and -1 if the second descriptor must
* be put before the first descriptor.
*/
{
int result = 0;
if (sortColumn == 0)
{
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
}
if (sortColumn == 1)
{
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
}
else if (sortColumn == 2)
{
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
}
else if (sortColumn == 3)
{
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
}
else if (sortColumn == 4)
{
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
}
else if (sortColumn == 5)
{
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
if (result == 0)
{
}
}
if (!sortAscending)
{
}
return result;
}
/**
* {@inheritDoc}
*/
public int getColumnCount()
{
}
/**
* {@inheritDoc}
*/
public int getRowCount()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Updates the array data. This includes resorting it.
*/
private void updateDataArray()
{
{
}
}
/**
* {@inheritDoc}
*/
return COLUMN_NAMES[col];
}
/**
* Returns whether the sort is ascending or descending.
* @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE>
* otherwise.
*/
public boolean isSortAscending()
{
return sortAscending;
}
/**
* Sets whether to sort ascending of descending.
* @param sortAscending whether to sort ascending or descending.
*/
{
this.sortAscending = sortAscending;
}
/**
* Returns the column index used to sort.
* @return the column index used to sort.
*/
public int getSortColumn()
{
return sortColumn;
}
/**
* Sets the column index used to sort.
* @param sortColumn column index used to sort..
*/
{
this.sortColumn = sortColumn;
}
/*
* Several comparison methods to be able to sort the table model.
*/
{
}
{
}
{
{
return 0;
}
{
return 1;
}
return -1;
}
{
{
return 0;
}
{
return 1;
}
return -1;
}
{
}
{
}
{
}
{
}
/**
* Returns the Object describing the number of entries of a given Base DN.
* The Object will be an Integer.
* @param rep the Base DN object to handle.
* @return the Object describing the number of entries of a given Base DN.
*/
{
{
}
else if (!isAuthenticated)
{
}
else
{
{
}
else
{
}
}
return returnValue;
}
/**
* Returns the Object describing the number of missing changes of a given Base
* DN. The Object will be a String unless the base DN is
* replicated and we could not find a valid value (in this case we return
* an Integer with the invalid value).
* @param rep the Base DN object to handle.
* @return the Object describing the number of missing changes of
* a given Base DN.
*/
{
{
{
}
else if (!isAuthenticated)
{
}
else
{
{
}
else
{
}
}
}
else
{
}
return returnValue;
}
/**
* Returns the Object describing the age of oldest missing change of
* a given Base DN. The Object will be a String unless the base DN is
* replicated and we could not find a valid value (in this case we return
* an Integer with the invalid value).
* @param rep the Base DN object to handle.
* @return the Object describing the age of oldest missing change of
* a given Base DN.
*/
{
{
{
}
else if (!isAuthenticated)
{
}
else
{
if (age > 0)
{
}
else
{
// Not available
}
}
}
else
{
}
return returnValue;
}
/**
* Returns the localized String describing the replication state of
* a given Base DN.
* @param rep the Base DN object to handle.
* @return the localized String describing the replication state of
* a given Base DN.
*/
{
Message s;
{
s = INFO_BASEDN_REPLICATED_LABEL.get();
}
{
}
else
{
s = INFO_BASEDN_DISABLED_LABEL.get();
}
return s.toString();
}
}