(no commit message)
[cdmlib.git] / cdmlibrary / src / main / java / eu / etaxonomy / cdm / aspectj / PropertyChangeAspect.aj
index 1d444b49803c8c3fc55e56d3c181a29f5b11ef0b..40c5030348a8b4f4783725605cbd40adfac0da9c 100644 (file)
@@ -31,14 +31,13 @@ public aspect PropertyChangeAspect {
                Field property = getFieldOfSetter( thisJoinPointStaticPart.getSignature() );
                property.setAccessible(true);
                String propertyName = property.getName();
-               logger.debug("execSetter: The property is ["+propertyName+"]");
+               //logger.debug("execSetter: The property is ["+propertyName+"]");
                try {
                        // use property attribute directly, not through get method.
                        // get method might modify things, like setting a UUID when called for the first time.
                        // Also get methods for booleans start with "is" or "has"
                        Object oldValue = property.get(cb);
                        proceed( cb );
-                       //fireLoggingPropertyChange( cb, propertyName, oldValue, property.get(cb));
                        cb.firePropertyChange( propertyName, oldValue, property.get(cb));
                } catch (NoSuchMethodException e) {
                        e.printStackTrace();
@@ -64,7 +63,7 @@ public aspect PropertyChangeAspect {
                private Field getFieldOfSetter( Signature signature ){
                        Field field = null;
                        String propertyName = "";
-                       logger.debug( "Getting the field name of setter ["+signature.getName() + "]" );
+                       //logger.debug( "Getting the field name of setter ["+signature.getName() + "]" );
                        try{
                                String methodName = signature.getName();
                                propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
@@ -91,52 +90,11 @@ public aspect PropertyChangeAspect {
                                Object oldval,
                                Object newval) {
 
-                       logger.debug( "Event: The property is [" + property + "]");
-                       logger.debug( "Event: The old value is [" + oldval + "]");
-                       logger.debug( "Event: The new value is [" + newval + "]");
+                       //logger.debug( "PropertyChangeEvent: property [" + property + "], old value [" + oldval + "], new value [" + newval + "]");
                        // call firePropertyChange in original class. Method defined in CdmBase superclass!
                        cb.firePropertyChange( property,
                                        ( oldval == null ) ? oldval : oldval.toString(),
                                        ( newval == null ) ? newval : newval.toString());
                }
                
-
-       // *************** SET Version **********************/
-//             pointcut setAttribut(CdmBase cb): target(cb) && set(* CdmBase+.*) && withincode(void CdmBase+.set*(..));
-//             void around(CdmBase cb) : setAttribut(cb)  {
-//                     logger.setLevel(Level.DEBUG);
-//                     Field property = getField( thisJoinPointStaticPart.getSignature() );
-//                     property.setAccessible(true);
-//                     String propertyName = property.getName();
-//                     logger.debug("The property is ["+propertyName+"]");
-//                     try {
-//                             // use property attribute directly, not through get method.
-//                             // get method might modify things, like setting a UUID when called for the first time.
-//                             // Also get methods for booleans start with "is" or "has"
-//                             Object oldValue = property.get(cb);
-//                             proceed( cb );
-//                             cb.firePropertyChange( propertyName, oldValue, property.get(cb));
-//                     } catch (Exception e) {
-//                             e.printStackTrace();
-//                             proceed( cb );
-//                     } 
-//             }
-//             
-//             /**
-//              * @param signature
-//              * Return the Field object that belongs to the signature of a setter method
-//              * Removes first 3 characters of method name to find property name
-//              */
-//             private Field getField( Signature signature ){
-//                     Field field = null;
-//                     logger.debug( "Getting the field name of attribute ["+signature.getName() + "]" );
-//                     try{
-//                             String propertyName = signature.getName();
-//                             field = signature.getDeclaringType().getDeclaredField( propertyName );
-//                     }catch( NoSuchFieldException nsfe ){
-//                             nsfe.printStackTrace();
-//                     }
-//                             return field;
-//                     }       
-               
 }