12-04-2008 08:23 AM
List<String> valeurs = (List<String>)nodeService.getProperty(nodeRef, MonModel.PROP_VALEURS);
mais cela n'a pas l'air de marcher car il ne me renvoie rien sur l'instruction :logger.debug("valeurs.size() = "+valeurs.size());
Les logger sont bien activé sur cette classe mais malgré ça, je n'ai pas de message d'erreur.12-04-2008 09:14 AM
12-04-2008 09:27 AM
12-04-2008 09:36 AM
12-04-2008 09:48 AM
12-04-2008 10:14 AM
package be.etnic.alfresco.repo.courrier;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import be.etnic.alfresco.model.EtnicModel;
/**
* This class contains the behaviour behind the 'etnic:etape' type.
*
*/
public class EtapeType implements NodeServicePolicies.OnUpdatePropertiesPolicy {
private static Log logger = LogFactory.getLog(EtapeType.class);
private PolicyComponent policyComponent;
private NodeService nodeService;
private PermissionService permissionService;
private ServiceRegistry registre;
/**
* Spring initilaise method used to register the policy behaviours
*/
public void initialise() {
logger.debug("initialisation Etape Type…");
// Register the policy behaviour
JavaBehaviour javaBehaviour = new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT);
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), EtnicModel.TYPE_ETAPE, javaBehaviour);
logger.debug("initialisation terminee");
}
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{
SearchService searchService = registre.getSearchService();
Date dateAction = null;
dateAction = (Date)nodeService.getProperty(nodeRef, EtnicModel.PROP_ETAPE_DATE_ACTION);
logger.debug("dateAction = "+dateAction.toString());
if(dateAction != null)
{
logger.debug("Si etapeDateAction != null");
List etapeSuivantes = (List)nodeService.getProperty(nodeRef, EtnicModel.PROP_ETAPE_SUIVANTES);
logger.debug("etapeSuivantes.size() = "+etapeSuivantes.size());
if(etapeSuivantes != null && etapeSuivantes.size()!= 0)
{
StoreRef store = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
NodeRef nodeRefParent = nodeService.getPrimaryParent(nodeRef).getParentRef();
Path pathParent = nodeService.getPath(nodeRefParent);
String cheminParent = pathParent.toDisplayPath(nodeService, permissionService);
for(Object etapeSuivante : etapeSuivantes)
{
String requete = "+PATH:\""+cheminParent+"/*\" +TYPE:\"etnic:etape\" -@cm\\:title:\""+etapeSuivante.toString()+"\"";
ResultSet resultat = searchService.query(store, SearchService.LANGUAGE_LUCENE, requete);
if(resultat != null && resultat.length() > 0)
{
Integer delta3 = (Integer)nodeService.getProperty(resultat.getNodeRef(0), EtnicModel.PROP_ETAPE_DELTA3);
if(delta3 != null && delta3 != 0)
{
Date dateLimite = new Date(dateAction.getTime()+ delta3*24*60*60*1000);
nodeService.setProperty(resultat.getNodeRef(0), EtnicModel.PROP_ETAPE_DATE_LIMITE, dateLimite);
}
resultat.close();
}
}
}
}
}
protected void applyPermission(NodeRef nodeRef, String authority, String permission) {
if (authority != null) {
permissionService.setPermission(nodeRef, authority, permission, true);
} else {
logger.debug("Authority is null. Ignored.");
}
}
public void setPolicyComponent(PolicyComponent policyComponent) {
this.policyComponent = policyComponent;
}
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
public void setPermissionService(PermissionService permissionService) {
this.permissionService = permissionService;
}
public void setRegistre(ServiceRegistry registre) {
this.registre = registre;
}
}
et voici le résultat dans la console :15:33:36,156 WARN [org.springframework.remoting.rmi.RmiRegistryFactoryBean] Could not detect RMI registry - creating new one
15:33:36,484 DEBUG [org.alfresco.repo.jscript] preRegister called. Server=com.sun.jmx.mbeanserver.JmxMBeanServer@16bf0aa, name=log4j:logger=org.alfresco.repo.jscript
15:33:36,484 DEBUG [be.etnic.alfresco.repo.courrier.EtapeType] preRegister called. Server=com.sun.jmx.mbeanserver.JmxMBeanServer@16bf0aa, name=log4j:logger=be.etnic.alfresco.repo.courrier.EtapeType
15:33:38,561 DEBUG [be.etnic.alfresco.repo.courrier.EtapeType] initialisation Etape Type…
15:33:38,561 DEBUG [be.etnic.alfresco.repo.courrier.EtapeType] initialisation terminee
15:33:38,905 INFO [org.alfresco.repo.domain.schema.SchemaBootstrap] Schema managed by database dialect org.hibernate.dialect.MySQLInnoDBDialect.
15:33:40,389 INFO [org.alfresco.repo.domain.schema.SchemaBootstrap] Aucune modification na été apportée au schéma.
15:33:42,075 WARN [org.alfresco.repo.admin.ConfigurationChecker] La propriété 'dir.root' d'Alfresco est défini par un chemin relatif '{0}'. 'dir.root' devrait être surchargée pour pointer sur un dossier spécifique.
15:33:42,075 INFO [org.alfresco.repo.admin.ConfigurationChecker] Le répertoire racine de données d'Alfresco ('dir.root') est : .\alf_data
15:33:42,107 INFO [org.alfresco.repo.admin.patch.PatchExecuter] Vérification des correctifs à appliquer …
15:33:42,232 INFO [org.alfresco.repo.admin.patch.PatchExecuter] Aucun correctif requis.
15:33:42,247 INFO [org.alfresco.repo.module.ModuleServiceImpl] 1 module(s) trouvé(s).
15:33:42,310 INFO [org.alfresco.repo.module.ModuleServiceImpl] Démarrage du module 'courrier' version 0.7.
15:33:42,356 WARN [org.alfresco.repo.module.ModuleServiceImpl] Un module préalablement installé '{0}' (version 1) est absent de votre distribution.
15:33:42,919 INFO [org.alfresco.service.descriptor.DescriptorService] Alfresco JVM - v1.6.0_02-b06; maximum heap size 493,063MB
15:33:42,919 WARN [org.alfresco.service.descriptor.DescriptorService] Alfresco JVM - WARNING - maximum heap size 493,063MB is less than recommended 512MB
15:33:42,919 INFO [org.alfresco.service.descriptor.DescriptorService] Alfresco license: Enterprise Network granted to Developer (does not expire)
15:33:42,919 INFO [org.alfresco.service.descriptor.DescriptorService] Alfresco started (Enterprise Network): Current version 2.2.1 (233) schema 89 - Installed version 2.1.1 (193) schema 77
15:34:17,762 DEBUG [be.etnic.alfresco.repo.courrier.EtapeType] dateAction = Thu Dec 04 15:34:17 CET 2008
15:34:17,777 DEBUG [be.etnic.alfresco.repo.courrier.EtapeType] Si etapeDateAction != null
12-04-2008 11:17 AM
15:33:42,919 INFO [org.alfresco.service.descriptor.DescriptorService] Alfresco license: Enterprise Network granted to Developer (does not expire)
15:33:42,919 INFO [org.alfresco.service.descriptor.DescriptorService] Alfresco started (Enterprise Network): Current version 2.2.1 (233) schema 89 - Installed version 2.1.1 (193) schema 77
12-05-2008 03:00 AM
Vous disposez d'un support entreprise peut être ?Oui effectivement, je dispose d'un support entreprise.
Est ce moi ou bien vous avez un mix de versions installées ?Réponse de nouveau affirmative, en effet nous sommes partis d'une version 2.1.1 que nous avons migré récemment en 2.2.1.
12-05-2008 04:23 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.