Class Job

    • Constructor Detail

      • Job

        public Job()
    • Method Detail

      • createItem

        protected Item createItem​(SessionContext ctx,
                                  ComposedType type,
                                  Item.ItemAttributeMap allAttributes)
                           throws JaloBusinessException
        Description copied from class: Item
        Has to be implemented for each concrete subtype of item. This method is responsible for creating a new item instance ( by calling managers, ejb homes, etc. ) during ComposedType.newInstance(Map).

        In case this method uses any of the attribute values during creation it is required to override Item.getNonInitialAttributes(SessionContext, ItemAttributeMap) too.
        Sn example:

        
         public static final String MY_ATTRIBUTE = "someAttribute"; ... protected Item createItem(SessionContext
         ctx, ComposedType type, Map allAttributes ) throws JaloBusinessException { MyManager man = ... return
         man.createMyItem( (String)allAttributes.get(MY_ATTRIBUTE) );
         // here MY_ATTRIBUTE is used for creation, so it must not be set again } protected Map getNonInitialAttributes(
         SessionContext ctx, Map allAttributes ) { // let superclass remove its own initial attributes Map ret =
         super.getNonInitialAttributes( ctx, allAttributes );
         // remove MY_ATTRIBUTE from all attributes since if has already been set ret.remove(MY_ATTRIBUTE); return ret; }
        
         
        Overrides:
        createItem in class GenericItem
        Parameters:
        ctx - the current session context which this item is created within
        type - the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )
        Returns:
        the new item instance
        Throws:
        JaloBusinessException - indicates an error during creation - any changes will be rollbacked
      • setCronJobs

        @Deprecated
        public void setCronJobs​(SessionContext ctx,
                                java.util.Collection<CronJob> cronJobs)
        Deprecated.
        since ages - not supported anymore
        Assigns the specified Collection of CronJobs to this Job. All CronJobs, which where assigned to the Job before and which are not part of the specified Collection will be deleted.
        Parameters:
        ctx - The SessionContext, which will be used
        cronJobs - the Collection of CronJobs, which will be assigned to the Job
      • getCronJobsByCode

        @Deprecated
        public java.util.Collection<CronJob> getCronJobsByCode​(java.lang.String code)
        Deprecated.
        since ages - useCronJobService.getCronJob(String) instead
        Returns all assigned CronJobs which match the specified code (The code of a Job is not necessarily unique!).
        Parameters:
        code - The code of the searched Cronjobs
        Returns:
        all assigned CronJobs which match the specified code
      • getCronJobsByCode

        @Deprecated
        public java.util.Collection<CronJob> getCronJobsByCode​(SessionContext ctx,
                                                               java.lang.String code)
        Deprecated.
        since ages - useCronJobService.getCronJob(String) instead
        Returns all assigned CronJobs which match the specified code (The code of a Job is not necessarily unique!).
        Parameters:
        ctx - The SessionContext, which will be used
        code - The code of the searched Cronjobs
        Returns:
        all assigned CronJobs which match the specified code
      • canUndo

        @Deprecated
        protected boolean canUndo​(CronJob cronJob)
        Deprecated.
        since ages - no counterpart in servicelayer available
        Returns true, if the specified CronJob can be undone. Overwrite this method of you want to undo your CronJob. Default value is false
        Parameters:
        cronJob - the CronJob to undo changes for
        Returns:
        true if this Job is undoable, false otherwise.
      • isUndoable

        @Deprecated
        public boolean isUndoable​(CronJob cronJob)
        Deprecated.
        since ages - obsolete feature won't be supported in the future
        Tests whether the given CronJob instance can be undone.
        Parameters:
        cronJob - the CronJob to undo
        Returns:
        whether this CronJob is undoable or not
      • canPerform

        @Deprecated
        protected boolean canPerform​(CronJob cronJob)
        Deprecated.
        since ages - no available counterpart in servicelayer
        This method is called before a Job is performed. If you override this method you can check the things that are necessary for the performing of your Job. Default value is true.
        Parameters:
        cronJob - the actual CronJob
        Returns:
        true if this Job is performable, false otherwise. de.hybris.platform.servicelayer.cronjob.CronJobService
      • isPerformable

        @Deprecated
        public boolean isPerformable​(CronJob cronJob)
        Tests whether the given CronJob instance can be performed. Internal the methods canPerform( final CronJob cronJob ) and canPerformInternal( final CronJob cronJob ) are called. Only if both methods returning true, this method also return true Returns true, if this Job can be performed using the specified Cronjob. Otherwise false is returned.
        Parameters:
        cronJob - which should be performed
        Returns:
        true, if this Job can be performed using the specified Cronjob. Otherwise false is returned
      • perform

        @Deprecated
        public final void perform​(CronJob cronJob,
                                  boolean synchronous)
        Performs this Job using the specified Cronjob. If synchronous is true, the Job will be performed synchronous, which means that this method will return the control to its caller as recently as this Job is performed. Synchronous execution is especially useful for short Jobs or testing purpose (JUnit tests for example).
        If synchronous is false, the Job will be performed asynchronous by executing the Job in a separate Thread.
        Parameters:
        cronJob - which will be used to perform this Job
        synchronous - true if this Job should be performed synchronously, false if this Job should be performed asynchronously
      • switchDataSource

        protected void switchDataSource​(CronJob cronjob)
      • unsetAlternativeDataSource

        protected void unsetAlternativeDataSource()
      • setCurrentLogContainer

        protected static final void setCurrentLogContainer​(Job.JobFileLogContainer logContainer)
      • unsetCurrentLogContainer

        protected static final void unsetCurrentLogContainer()
      • jobIsCurrentlyRunning

        protected static final boolean jobIsCurrentlyRunning()
      • logToFile

        protected void logToFile​(java.lang.String message,
                                 org.apache.log4j.Level level)
        Proxy method to write cronjob logs to file too.
      • log

        public void log​(java.lang.String message,
                        org.apache.log4j.Level level)
      • debug

        @Deprecated
        public void debug​(java.lang.String message)
        Deprecated.
        since ages
      • info

        @Deprecated
        public void info​(java.lang.String message)
        Deprecated.
        since ages
      • warn

        @Deprecated
        public void warn​(java.lang.String message)
        Deprecated.
        since ages
      • error

        @Deprecated
        public void error​(java.lang.String message)
        Deprecated.
        since ages
      • fatal

        @Deprecated
        public void fatal​(java.lang.String message)
        Deprecated.
        since ages
      • isEnabledFor

        @Deprecated
        public boolean isEnabledFor​(org.apache.log4j.Level level)
        Deprecated.
        since ages
      • isDebugEnabled

        @Deprecated
        public boolean isDebugEnabled()
        Deprecated.
        since ages
      • isInfoEnabled

        @Deprecated
        public boolean isInfoEnabled()
        Deprecated.
        since ages
      • isWarnEnabled

        @Deprecated
        public boolean isWarnEnabled()
        Deprecated.
        since ages
      • isErrorEnabled

        @Deprecated
        public boolean isErrorEnabled()
        Deprecated.
        since ages
      • undo

        @Deprecated
        public final void undo​(CronJob cronJob)
        Deprecated.
        since ages - obsolete feature won't be supported in the future
        Undos this Job asynchronous in a separate Thread using the specified Cronjob.
        Parameters:
        cronJob - which is used to perform this Job
      • undo

        @Deprecated
        public final void undo​(CronJob cronJob,
                               boolean synchronous)
        Deprecated.
        since ages - obsolete feature won't be supported in the future
        Undos this Job using the specified Cronjob. If synchronous is true, the Job will be undone synchronous, which means that this method will return the control to its caller as recently as this Job is undone. Synchronous undo is especially useful for short Jobs or testing purpose (JUnit tests for example).
        If synchronous is false, the Job will be undone asynchronous by executing it in a separate Thread.
        Parameters:
        cronJob - which will ne used to undo this Job
        synchronous - true if this Job should be undone synchronously, false if this Job should be undone asynchronously
      • undoCronJob

        @Deprecated
        protected CronJob.CronJobResult undoCronJob​(CronJob cronJob)
        Deprecated.
        this feature is not available since 4.3
        Overwrite this method to undo changes made in your job. This method is called, if you decide to undo your job.
        Parameters:
        cronJob - the CronJob to undo
        Returns:
        a CronJobResult that indicates whether the undo of your Job was successful or not
      • stopOwnSession

        protected void stopOwnSession​(JaloSession previousSession,
                                      CronJob cronJob)
        Deactivates the own session and re-activates the previous session if available.
        Parameters:
        previousSession -
        cronJob -
      • setCode

        public void setCode​(SessionContext ctx,
                            java.lang.String code)
        Description copied from class: GeneratedJob
        Generated method - Setter of the Job.code attribute.
        Overrides:
        setCode in class GeneratedJob
        code - the code
        Since:
        2.10
      • getConfigAttributes

        @Deprecated
        protected java.util.Map<java.lang.String,​java.lang.String> getConfigAttributes​(CronJob cronjob)
        Deprecated.
        since ages - useCronJobFactory mechanism instead, refer to appropriate wiki document
      • getEffectiveLogLevel

        protected org.apache.log4j.Level getEffectiveLogLevel​(CronJob cronjob)