09-19-2007 04:55 PM
String PARAM_TO = "to";
String PARAM_TO_MANY = "to_many";
String PARAM_SUBJECT = "subject";
String PARAM_TEXT = "text";
String PARAM_FROM = "from";
String PARAM_TEMPLATE = "template";
Store STORE =
new Store(Constants.WORKSPACE_STORE, "SpacesStore");
String xPath = "/app:company_home";
Reference reference = new Reference(STORE, null, xPath);
String[] ruleTypeNames = new String[]{"outbound"};
String subject = "Test Alfresco";
String from = "someEmail";
String to = "someEmail";
String text = "Changed occured.";
// Create action parameters
NamedValue[] parameters = null;
NamedValue valueTo =
new NamedValue(PARAM_TO, new Boolean(false), to, null);
NamedValue valueFrom =
new NamedValue(PARAM_FROM, new Boolean(false), from, null);
NamedValue valueSubject =
new NamedValue(PARAM_SUBJECT, new Boolean(false), subject, null);
NamedValue valueText =
new NamedValue(PARAM_TEXT, new Boolean(false), text, null);
NamedValue valueTemplate =
new NamedValue(PARAM_TEMPLATE, new Boolean(false), null, null);
parameters =
new NamedValue[]{valueTo, valueFrom, valueSubject, valueTemplate, valueText};
// Create the action
Action action = new Action();
action.setActionName("mail");
action.setTitle("Send an email to specified users.");
action.setDescription("");
action.setParameters(parameters);
action.setActionReference(reference);
// Create the rule
Rule rule = new Rule();
rule.setRuleTypes(ruleTypeNames);
rule.setTitle("Notify User");
rule.setDescription("");
rule.setAction(action);
try {
// Authentication
WebServiceClient.startSession("admin", "admin");
// Save the rule
WebServiceClient.getActionService().saveRules(
reference, new Rule[]{rule});
} catch (Exception e) {
e.printStackTrace();
} finally {
WebServiceClient.endSession();
}
09-20-2007 04:59 PM
<bean id="outbound" class="org.alfresco.repo.rule.RuleTypeImpl" parent="rule-type-base">
<constructor-arg>
<list>
<ref bean="on-delete-child-association-trigger"/>
<ref bean="on-delete-node-trigger"/>
</list>
</constructor-arg>
</bean>
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.