Formatierungen und Kommentierungen.

git-svn-id: https://svn.libreccm.org/ccm/trunk@540 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2010-09-22 19:02:19 +00:00
parent 1d86f7e869
commit e37d4ae055
5 changed files with 86 additions and 93 deletions

View File

@ -663,7 +663,7 @@ public class PageState {
* Set the control event. The control event is a <i>delayed</i> event * Set the control event. The control event is a <i>delayed</i> event
* that only gets acted on when another request to this <code>Page</code> * that only gets acted on when another request to this <code>Page</code>
* is made. It is used to set which component should receive the * is made. It is used to set which component should receive the
* submission and lets the component set one comonent-specific name-value * submission and lets the component set one component-specific name-value
* pair to be used in the submission. * pair to be used in the submission.
* <p> * <p>
* After calling this method links and hidden form controls generated * After calling this method links and hidden form controls generated

View File

@ -39,18 +39,18 @@ import org.apache.log4j.Logger;
* @see com.arsdigita.kernel.KernelConfig * @see com.arsdigita.kernel.KernelConfig
* @see com.arsdigita.kernel.KernelContext * @see com.arsdigita.kernel.KernelContext
* @see com.arsdigita.kernel.KernelExcursion * @see com.arsdigita.kernel.KernelExcursion
*
* @version $Id: Kernel.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class Kernel { public class Kernel {
public static final String versionId =
"$Id: Kernel.java 287 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +
"$DateTime: 2004/08/16 18:10:38 $";
/** Private logger instance for debugging */
private static final Logger s_log = Logger.getLogger(Kernel.class); private static final Logger s_log = Logger.getLogger(Kernel.class);
// The ID of the user that represents "the public", i.e. a non-logged-in user. /** The ID of the user that represents "the public", i.e. a non-logged-in
// Created by insert-users.sql. * user. Created by insert-users.sql (during load step) . */
private static final BigDecimal PUBLIC_USER_ID = new BigDecimal(-200); private static final BigDecimal PUBLIC_USER_ID = new BigDecimal(-200);
/** Public (i.e. a non-logged-in) User object (retrieved by PUBLIC_USER_ID) */
private static User s_publicUser; private static User s_publicUser;
private static KernelContext s_initialContext; private static KernelContext s_initialContext;
@ -138,11 +138,11 @@ public class Kernel {
public static final User getPublicUser() { public static final User getPublicUser() {
init(); init();
if (s_publicUser == null) { if (s_publicUser == null) {
// We could synchronize this method, but we don't really care if the User // We could synchronize this method, but we don't really care if the
// object gets loaded more than once. // User object gets loaded more than once.
s_publicUser = User.retrieve(PUBLIC_USER_ID); s_publicUser = User.retrieve(PUBLIC_USER_ID);
// Disconnect the object so we can use it across multiple transactions, and // Disconnect the object so we can use it across multiple transactions,
// so it cannot be modified/deleted. // and so it cannot be modified/deleted.
s_publicUser.disconnect(); s_publicUser.disconnect();
} }

View File

@ -41,18 +41,16 @@ import org.apache.log4j.Logger;
/** /**
* A utility class for controlling user access to domain/data objects. * A utility class for controlling user access to domain/data objects.
* @see com.arsdigita.kernel.permissions.PermissionDescriptor
* *
* @author Oumi Mehrotra * @author Oumi Mehrotra
* @author Michael Bryzek * @author Michael Bryzek
* @version 1.0 * @version 1.0
* @see com.arsdigita.kernel.permissions.PermissionDescriptor * @version $Id: PermissionService.java 287 2005-02-22 00:29:02Z sskracic $
**/ */
public class PermissionService extends DomainService { public class PermissionService extends DomainService {
public static final String versionId =
"$Id: PermissionService.java 287 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +
"$DateTime: 2004/08/16 18:10:38 $";
/** Private logger instance for debugging purpose */
private static final Logger s_log = Logger.getLogger(PermissionService.class); private static final Logger s_log = Logger.getLogger(PermissionService.class);
// Reference to the PermissionManager to use for permissions checks. // Reference to the PermissionManager to use for permissions checks.
@ -95,8 +93,7 @@ public class PermissionService extends DomainService {
* *
* @return True if permission checks are currently enabled, false if they * @return True if permission checks are currently enabled, false if they
* are disabled. * are disabled.
**/ */
public static final boolean isEnabled() { public static final boolean isEnabled() {
return s_enabled; return s_enabled;
} }
@ -107,8 +104,7 @@ public class PermissionService extends DomainService {
* *
* @param value If value is false then permission wide system checks are * @param value If value is false then permission wide system checks are
* disabled. * disabled.
**/ */
public static final void setEnabled(boolean value) { public static final void setEnabled(boolean value) {
s_enabled = value; s_enabled = value;
} }
@ -118,7 +114,7 @@ public class PermissionService extends DomainService {
* given PermissionDescriptor is false. * given PermissionDescriptor is false.
* *
* @param permission the {@link PermissionDescriptor} to check * @param permission the {@link PermissionDescriptor} to check
**/ */
public static void assertPermission(PermissionDescriptor permission) { public static void assertPermission(PermissionDescriptor permission) {
if (!isEnabled()) { return; } if (!isEnabled()) { return; }
if (!checkPermission(permission)) { if (!checkPermission(permission)) {
@ -136,7 +132,7 @@ public class PermissionService extends DomainService {
* *
* @return <code>true</code> if the PermissionDescriptor's base object has the * @return <code>true</code> if the PermissionDescriptor's base object has the
* specified permission; <code>false</code> otherwise. * specified permission; <code>false</code> otherwise.
**/ */
public static boolean checkPermission(PermissionDescriptor permission) { public static boolean checkPermission(PermissionDescriptor permission) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("checking " + permission.getPrivilegeDescriptor() s_log.debug("checking " + permission.getPrivilegeDescriptor()
@ -159,7 +155,7 @@ public class PermissionService extends DomainService {
* *
* @see com.arsdigita.kernel.ACSObject * @see com.arsdigita.kernel.ACSObject
* @see com.arsdigita.kernel.permissions.PrivilegeDescriptor * @see com.arsdigita.kernel.permissions.PrivilegeDescriptor
**/ */
public static void grantPermission(PermissionDescriptor permission) { public static void grantPermission(PermissionDescriptor permission) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("granting " + permission.getPrivilegeDescriptor() s_log.debug("granting " + permission.getPrivilegeDescriptor()
@ -179,7 +175,7 @@ public class PermissionService extends DomainService {
* *
* @see com.arsdigita.kernel.ACSObject * @see com.arsdigita.kernel.ACSObject
* @see com.arsdigita.kernel.permissions.PrivilegeDescriptor * @see com.arsdigita.kernel.permissions.PrivilegeDescriptor
**/ */
public static void revokePermission(PermissionDescriptor permission) { public static void revokePermission(PermissionDescriptor permission) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("revoking " + permission.getPrivilegeDescriptor() s_log.debug("revoking " + permission.getPrivilegeDescriptor()
@ -203,7 +199,7 @@ public class PermissionService extends DomainService {
* *
* @see com.arsdigita.kernel.ACSObject * @see com.arsdigita.kernel.ACSObject
* @see com.arsdigita.persistence.OID * @see com.arsdigita.persistence.OID
**/ */
public static DataObject getContext(OID oid) { public static DataObject getContext(OID oid) {
return getPermissionManager().getContext(oid); return getPermissionManager().getContext(oid);
} }
@ -223,7 +219,7 @@ public class PermissionService extends DomainService {
* *
* @see com.arsdigita.kernel.ACSObject * @see com.arsdigita.kernel.ACSObject
* @see com.arsdigita.persistence.OID * @see com.arsdigita.persistence.OID
**/ */
public static DataObject getContext(ACSObject acsObject) { public static DataObject getContext(ACSObject acsObject) {
return getPermissionManager().getContext(acsObject); return getPermissionManager().getContext(acsObject);
} }
@ -298,7 +294,6 @@ public class PermissionService extends DomainService {
* *
* @param acsObject the object whose permission context is being * @param acsObject the object whose permission context is being
* set * set
*
*/ */
public static void clonePermissions(ACSObject acsObject) public static void clonePermissions(ACSObject acsObject)
throws PersistenceException throws PersistenceException
@ -317,7 +312,6 @@ public class PermissionService extends DomainService {
* *
* @param acsObjectOID the object whose permission context is being * @param acsObjectOID the object whose permission context is being
* set * set
*
*/ */
public static void clonePermissions(OID acsObjectOID) public static void clonePermissions(OID acsObjectOID)
throws PersistenceException throws PersistenceException
@ -356,7 +350,8 @@ public class PermissionService extends DomainService {
* *
* @return the permissions that have been granted on the specified * @return the permissions that have been granted on the specified
* object (direct permissions followed by inherited * object (direct permissions followed by inherited
* permisions). */ * permisions).
*/
public static ObjectPermissionCollection public static ObjectPermissionCollection
getDirectGrantedPermissions(OID acsObjectOID) getDirectGrantedPermissions(OID acsObjectOID)
{ {
@ -390,7 +385,6 @@ public class PermissionService extends DomainService {
* a collection of type ACSObject. * a collection of type ACSObject.
* @param privilege the required privilege * @param privilege the required privilege
* @param userOID the OID of the user whose access is being filtered * @param userOID the OID of the user whose access is being filtered
*
*/ */
public static void filterObjects(DataCollection dataCollection, public static void filterObjects(DataCollection dataCollection,
PrivilegeDescriptor privilege, PrivilegeDescriptor privilege,
@ -408,7 +402,6 @@ public class PermissionService extends DomainService {
* @param domainCollection the collection to filter * @param domainCollection the collection to filter
* @param privilege the required privilege * @param privilege the required privilege
* @param userOID the OID of the user whose access is being filtered * @param userOID the OID of the user whose access is being filtered
*
*/ */
public static void filterObjects(DomainCollection domainCollection, public static void filterObjects(DomainCollection domainCollection,
PrivilegeDescriptor privilege, PrivilegeDescriptor privilege,
@ -433,7 +426,6 @@ public class PermissionService extends DomainService {
* @param privilege the required privilege * @param privilege the required privilege
* *
* @param userOID the OID of the user whose access is being filtered * @param userOID the OID of the user whose access is being filtered
*
*/ */
public static void filterQuery(DataQuery dataQuery, public static void filterQuery(DataQuery dataQuery,
String propertyName, String propertyName,
@ -468,7 +460,6 @@ public class PermissionService extends DomainService {
* @param privilege the required privilege * @param privilege the required privilege
* *
* @param objectOID the OID of the object that the users are trying to access * @param objectOID the OID of the object that the users are trying to access
*
*/ */
public static void objectFilterQuery(DataQuery dataQuery, public static void objectFilterQuery(DataQuery dataQuery,
String propertyName, String propertyName,
@ -500,7 +491,8 @@ public class PermissionService extends DomainService {
* @param partyOID the OID of the user whose access is being filtered * @param partyOID the OID of the user whose access is being filtered
* *
* @return a filter which is true if the user has the required permission * @return a filter which is true if the user has the required permission
* on the specified property */ * on the specified property
*/
public static Filter getFilterQuery(FilterFactory factory, public static Filter getFilterQuery(FilterFactory factory,
String propertyName, String propertyName,
PrivilegeDescriptor privilege, PrivilegeDescriptor privilege,
@ -524,7 +516,7 @@ public class PermissionService extends DomainService {
* *
* @param object the OID of the specified object * @param object the OID of the specified object
* @param party the OID of the specified party * @param party the OID of the specified party
**/ */
public static Iterator getDirectPrivileges(OID object, OID party) { public static Iterator getDirectPrivileges(OID object, OID party) {
checkType(object, ACSObject.BASE_DATA_OBJECT_TYPE); checkType(object, ACSObject.BASE_DATA_OBJECT_TYPE);
checkType(party, Party.BASE_DATA_OBJECT_TYPE); checkType(party, Party.BASE_DATA_OBJECT_TYPE);
@ -551,7 +543,7 @@ public class PermissionService extends DomainService {
* @param party the OID of the party that privileges are to be returned for * @param party the OID of the party that privileges are to be returned for
* *
* @return an iterator of PrivilegeDescriptors. * @return an iterator of PrivilegeDescriptors.
**/ */
public static Iterator getPrivileges(OID object, OID party) { public static Iterator getPrivileges(OID object, OID party) {
return getPermissionManager().getPrivileges(object, party); return getPermissionManager().getPrivileges(object, party);
} }
@ -568,7 +560,7 @@ public class PermissionService extends DomainService {
* @return an iterator of PrivilegeDescriptors. * @return an iterator of PrivilegeDescriptors.
* *
* @see #getPrivileges(OID, OID) * @see #getPrivileges(OID, OID)
**/ */
public static Iterator getImpliedPrivileges(OID object, OID party) { public static Iterator getImpliedPrivileges(OID object, OID party) {
return getPermissionManager().getImpliedPrivileges(object, party); return getPermissionManager().getImpliedPrivileges(object, party);
} }
@ -578,7 +570,7 @@ public class PermissionService extends DomainService {
* Revoke all permissions belonging to the specified party. * Revoke all permissions belonging to the specified party.
* *
* @param partyOID OID of the party whose permissions are to be revoked. * @param partyOID OID of the party whose permissions are to be revoked.
**/ */
public static void revokePartyPermissions(OID partyOID) { public static void revokePartyPermissions(OID partyOID) {
DataOperation revoke = getDataOperation("RevokePartyPermissions"); DataOperation revoke = getDataOperation("RevokePartyPermissions");
revoke.setParameter("partyID", partyOID.get("id")); revoke.setParameter("partyID", partyOID.get("id"));
@ -592,7 +584,7 @@ public class PermissionService extends DomainService {
* @param baseTypeName the type the OID is checked for * @param baseTypeName the type the OID is checked for
* @throws RuntimeException when specified OID is not an instance of the * @throws RuntimeException when specified OID is not an instance of the
* specified type. * specified type.
**/ */
private static void checkType(OID objectOID, String baseTypeName) { private static void checkType(OID objectOID, String baseTypeName) {
try { try {
ObjectType.verifySubtype(baseTypeName, ObjectType.verifySubtype(baseTypeName,

View File

@ -221,6 +221,7 @@ public class PrivilegeDescriptor {
* Equivalent to getName(). * Equivalent to getName().
* @return the privilege name * @return the privilege name
*/ */
@Override
public String toString() { public String toString() {
return getName(); return getName();
} }

View File

@ -36,14 +36,11 @@ import org.w3c.dom.Attr;
* <code>org.jdom.Element</code> using <code>org.w3c.dom.Element</code>. * <code>org.jdom.Element</code> using <code>org.w3c.dom.Element</code>.
* *
* @author Patrick McNeill * @author Patrick McNeill
* @version $Revision: #17 $ $Date: 2004/08/16 $
* @since ACS 4.5a * @since ACS 4.5a
* @version $Revision: #17 $ $Date: 2004/08/16 $
* @version $Id: Element.java 1372 2006-11-13 09:22:54Z chrisgilbert23 $
*/ */
public class Element { public class Element {
public static final String versionId =
"$Id: Element.java 1372 2006-11-13 09:22:54Z chrisgilbert23 $" +
"$Author: chrisgilbert23 $" +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = Logger.getLogger private static final Logger s_log = Logger.getLogger
(Element.class.getName()); (Element.class.getName());
@ -57,6 +54,7 @@ public class Element {
private org.w3c.dom.Document m_doc; private org.w3c.dom.Document m_doc;
private static ThreadLocal s_localDocument = new ThreadLocal() { private static ThreadLocal s_localDocument = new ThreadLocal() {
@Override
public Object initialValue() { public Object initialValue() {
try { try {
DocumentBuilderFactory builder = DocumentBuilderFactory builder =
@ -513,11 +511,11 @@ public class Element {
while (childElements.hasNext()) { while (childElements.hasNext()) {
Element el = (Element) childElements.next(); Element el = (Element) childElements.next();
unsortedList.addAll(el.getXMLFragments()); unsortedList.addAll(el.getXMLFragments());
} }
return unsortedList; return unsortedList;
} }
/** /**
* retrieve a string that is an ordered concatenation of all information describing * retrieve a string that is an ordered concatenation of all information describing
* this node and its subnodes, suitable as the basis of a hashCode or equals * this node and its subnodes, suitable as the basis of a hashCode or equals
@ -540,6 +538,7 @@ public class Element {
return xml.toString(); return xml.toString();
} }
@Override
public int hashCode() { public int hashCode() {
Date start = new Date(); Date start = new Date();
String hashString = getXMLHashString(); String hashString = getXMLHashString();
@ -552,6 +551,7 @@ public class Element {
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
s_log.debug("equals invoked"); s_log.debug("equals invoked");
Date start = new Date(); Date start = new Date();