use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.
the class ActionFormProcessorTest method testGenerateFormWithSpecificLocale.
/**
* REPO-2253 Community: ALF-21854 Action parameter lookup for "de_DE" falls back to "root" locale instead of "de"
*/
@Test
public void testGenerateFormWithSpecificLocale() {
final Locale originalLocale = I18NUtil.getLocale();
try {
// de-DE
I18NUtil.setLocale(Locale.GERMANY);
transactionHelper.doInTransaction(() -> {
Form form = formService.getForm(new Item(ActionFormProcessor.ITEM_KIND, "transform"));
// Field definitions keyed by name.
Map<String, FieldDefinition> fieldDefMap = form.getFieldDefinitions().stream().collect(Collectors.toMap(FieldDefinition::getName, Function.identity()));
assertEquals("Zielordner", fieldDefMap.get(TransformActionExecuter.PARAM_DESTINATION_FOLDER).getLabel());
assertEquals("MIME-Type", fieldDefMap.get(TransformActionExecuter.PARAM_MIME_TYPE).getLabel());
return null;
});
} finally {
I18NUtil.setLocale(originalLocale);
}
}
use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.
the class TaskFormProcessorTest method testGenerateTransitions.
public void testGenerateTransitions() throws Exception {
// Check empty transitions
String fieldName = TransitionFieldProcessor.KEY;
Form form = processForm(fieldName);
String transitionValues = "";
checkSingleProperty(form, fieldName, transitionValues);
// Set up transitions
WorkflowTransition transition1 = makeTransition("id1", "title1");
WorkflowTransition transition2 = makeTransition("id2", "title2");
WorkflowTransition transition3 = makeTransition("id3", "title3");
task = makeTask(transition1, transition2, transition3);
// Hide transition with id3.
Serializable hiddenValue = (Serializable) Collections.singletonList("id3");
task.getProperties().put(PROP_HIDDEN_TRANSITIONS, hiddenValue);
form = processForm(fieldName);
transitionValues = "id1|title1,id2|title2";
checkSingleProperty(form, fieldName, transitionValues);
}
use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.
the class TaskFormProcessorTest method testGenerateMessage.
public void testGenerateMessage() throws Exception {
String message = NO_MESSAGE;
String fieldName = MessageFieldProcessor.KEY;
Form form = processForm(fieldName);
checkSingleProperty(form, fieldName, message);
// add a description to the task and check it comes back
message = "This is some text the user may have entered";
this.task.getProperties().put(PROP_DESCRIPTION, message);
form = processForm(fieldName);
checkSingleProperty(form, fieldName, message);
// set the description to the same as the task title
// and make sure the message comes back as null
this.task.getProperties().put(PROP_DESCRIPTION, this.task.getTitle());
form = processForm(fieldName);
checkSingleProperty(form, fieldName, NO_MESSAGE);
}
use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.
the class TaskFormProcessorTest method testGenerateTaskOwner.
public void testGenerateTaskOwner() throws Exception {
// check the task owner is null
String fieldName = TaskOwnerFieldProcessor.KEY;
Form form = processForm(fieldName);
checkSingleProperty(form, fieldName, null);
// set task owner
this.task.getProperties().put(ContentModel.PROP_OWNER, "admin");
// check the task owner property is correct
form = processForm(fieldName);
checkSingleProperty(form, fieldName, "admin|System|Administrator");
}
use of org.alfresco.repo.forms.Form in project records-management by Alfresco.
the class RM1727Test method testRM1727.
public void testRM1727() {
doTestInTransaction(new Test<Void>() {
@Override
public Void run() {
// set read and file permissions for folder
filePlanPermissionService.setPermission(folder, myUser, RMPermissionModel.FILING);
return null;
}
});
doTestInTransaction(new Test<Void>() {
@Override
public Void run() {
Item item = new Item("node", folder.toString());
item.setType("rma:recordFolder");
form = new Form(item);
nodeFormFilter.afterGenerate(folder, null, null, form, null);
return null;
}
}, myUser);
doTestInTransaction(new Test<Void>() {
@Override
public Void run() {
Item item = new Item("node", record.toString());
item.setType("rma:record");
form = new Form(item);
nodeFormFilter.afterGenerate(record, null, null, form, null);
return null;
}
}, myUser);
}
Aggregations