use of org.talend.components.jira.Resource in project components by Talend.
the class TJiraInputProperties method refreshLayout.
/**
* {@inheritDoc}
*/
@Override
public void refreshLayout(Form form) {
super.refreshLayout(form);
Resource resourceValue = resource.getValue();
if (form.getName().equals(Form.MAIN)) {
// refresh after resource changed
switch(resourceValue) {
case PROJECT:
{
form.getWidget(jql.getName()).setHidden(true);
form.getWidget(projectId.getName()).setHidden(false);
break;
}
case ISSUE:
{
form.getWidget(jql.getName()).setHidden(false);
form.getWidget(projectId.getName()).setHidden(true);
break;
}
}
}
if (form.getName().equals(Form.ADVANCED)) {
// refresh after resource changed
switch(resourceValue) {
case PROJECT:
{
form.getWidget(batchSize.getName()).setHidden(true);
break;
}
case ISSUE:
{
form.getWidget(batchSize.getName()).setHidden(false);
break;
}
}
}
}
use of org.talend.components.jira.Resource in project components by Talend.
the class TJiraOutputProperties method refreshLayout.
/**
* {@inheritDoc}
*/
@Override
public void refreshLayout(Form form) {
super.refreshLayout(form);
Action actionValue = action.getValue();
Resource resourceValue = resource.getValue();
if (form.getName().equals(Form.MAIN)) {
// sets corresponding schema property for chosen action
switch(actionValue) {
case DELETE:
{
schema.schema.setValue(deleteSchema);
break;
}
case INSERT:
{
schema.schema.setValue(insertSchema);
break;
}
case UPDATE:
{
schema.schema.setValue(updateSchema);
break;
}
}
}
if (form.getName().equals(Form.ADVANCED)) {
// deleteSubtasks property visibility
if (DELETE.equals(actionValue) && ISSUE.equals(resourceValue)) {
form.getWidget(deleteSubtasks.getName()).setHidden(false);
} else {
form.getWidget(deleteSubtasks.getName()).setHidden(true);
}
}
}
use of org.talend.components.jira.Resource in project components by Talend.
the class TJiraInputPropertiesTest method testSetupProperties.
/**
* Checks {@link TJiraInputProperties#setupProperties()} sets correct initial property values
*/
@Test
public void testSetupProperties() {
TJiraInputProperties properties = new TJiraInputProperties("root");
properties.setupProperties();
Resource resourceValue = properties.resource.getValue();
String jqlValue = properties.jql.getValue();
String projectIdValue = properties.projectId.getValue();
int batchSizeValue = properties.batchSize.getValue();
assertThat(resourceValue, equalTo(Resource.ISSUE));
assertThat(jqlValue, equalTo("summary ~ \\\"some word\\\" AND project=PROJECT_ID"));
assertThat(projectIdValue, equalTo(""));
assertThat(batchSizeValue, equalTo(50));
}
use of org.talend.components.jira.Resource in project components by Talend.
the class TJiraOutputPropertiesTest method testSetupProperties.
/**
* Checks {@link TJiraOutputProperties#setupProperties()} sets correct initial property values
*/
@Test
public void testSetupProperties() {
AvroRegistry registry = new AvroRegistry();
Schema stringSchema = registry.getConverter(String.class).getSchema();
Schema.Field jsonField = new Schema.Field("json", stringSchema, null, null, Order.ASCENDING);
Schema expectedSchema = Schema.createRecord("jira", null, null, false, Collections.singletonList(jsonField));
expectedSchema.addProp(TALEND_IS_LOCKED, "true");
TJiraOutputProperties properties = new TJiraOutputProperties("root");
properties.setupProperties();
Action actionValue = properties.action.getValue();
Resource resourceValue = properties.resource.getValue();
boolean deleteSubtasksValue = properties.deleteSubtasks.getValue();
Mode modeValue = properties.mode.getValue();
Schema schema = properties.schema.schema.getValue();
assertThat(actionValue, equalTo(Action.INSERT));
assertThat(resourceValue, equalTo(Resource.ISSUE));
assertThat(deleteSubtasksValue, equalTo(true));
assertThat(modeValue, equalTo(Mode.ADVANCED));
assertThat(schema, equalTo(expectedSchema));
}