Package com.atlassian.jira.rest.client.api.domain

Examples of com.atlassian.jira.rest.client.api.domain.AuditAssociatedItem


        this.objectItem = objectItem;
        return this;
    }

    public AuditRecordBuilder setObject(@Nullable final String id, final String name, final String typeName) {
        this.objectItem = new AuditAssociatedItem(id, name, typeName, null, null);
        return this;
    }
View Full Code Here


        final String name = json.getString("name");
        final String typeName = json.getString("typeName");
        final String parentId = JsonParseUtil.getOptionalString(json, "parentId");
        final String parentName = JsonParseUtil.getOptionalString(json, "parentName");

        return new AuditAssociatedItem(id, name, typeName, parentId, parentName);
    }
View Full Code Here

            final DateTime created = JsonParseUtil.parseDateTime(json, "created");
            final String category = json.getString("category");
            final String eventSource = json.getString("eventSource");
            final String authorKey = json.getString("authorKey");
            final String remoteAddress = JsonParseUtil.getOptionalString(json, "remoteAddress");
            final AuditAssociatedItem objectItem = JsonParseUtil.getOptionalJsonObject(json, "objectItem", associatedItemJsonParser);
            final OptionalIterable<AuditAssociatedItem> associatedItem = JsonParseUtil.parseOptionalJsonArray(json.optJSONArray("associatedItems"), associatedItemJsonParser);
            final OptionalIterable<AuditChangedValue> changedValues = JsonParseUtil.parseOptionalJsonArray(json.optJSONArray("changedValues"), changedValueJsonParser);

            return new AuditRecord(id, summary, remoteAddress, created, category, eventSource, authorKey, objectItem, associatedItem, changedValues);
        }
View Full Code Here

        assertThat(firstRecord.getObjectItem().getName(), is("jira-developers"));
        assertThat(firstRecord.getObjectItem().getTypeName(), is("GROUP"));
        assertThat(firstRecord.getObjectItem().getParentId(), nullValue());
        assertThat(firstRecord.getObjectItem().getParentName(), nullValue());

        final AuditAssociatedItem firstItem = firstRecord.getAssociatedItems().iterator().next();
        assertThat(firstItem.getId(), is("admin"));
        assertThat(firstItem.getName(), is("admin"));
        assertThat(firstItem.getTypeName(), is("USER"));
        assertThat(firstItem.getParentId(), is("1"));
        assertThat(firstItem.getParentName(), is("JIRA Internal Directory"));

        assertThat(firstRecord.getChangedValues(), notNullValue());

        final Iterator<AuditChangedValue> iterator = firstRecord.getChangedValues().iterator();
        final AuditChangedValue valueItem1 = iterator.next();
        assertThat(valueItem1.getFieldName(), is("Username"));
        assertThat(valueItem1.getChangedFrom(), nullValue());
        assertThat(valueItem1.getChangedTo(), is("admin"));

        final AuditChangedValue valueItem2 = iterator.next();
        assertThat(valueItem2.getFieldName(), is("Full Name"));
        assertThat(valueItem2.getChangedFrom(), is("administrator"));
        assertThat(valueItem2.getChangedTo(), is("admin"));

        final AuditChangedValue valueItem3 = iterator.next();
        assertThat(valueItem3.getFieldName(), is("Email"));
        assertThat(valueItem3.getChangedTo(), is("admin@local.com"));

        final AuditChangedValue valueItem4 = iterator.next();
        assertThat(valueItem4.getFieldName(), is("Active / Inactive"));
        assertThat(valueItem4.getChangedTo(), is("Active"));

        //check second firstRecord which does not contain optional fields
        final AuditRecord secondRecord = recordsIterator.next();
        assertThat(secondRecord.getSummary(), is("User added to group"));
        assertThat(secondRecord.getRemoteAddress(), nullValue());
        assertThat(secondRecord.getCreated().toInstant(), is(SAMPLE_DATE));
        assertThat(secondRecord.getCategory(), is("group management"));
        assertThat(secondRecord.getEventSource(), is("Other connect plugin"));
        assertThat(secondRecord.getAuthorKey(), is("admin"));

        assertThat(secondRecord.getObjectItem().getId(), nullValue());
        assertThat(secondRecord.getObjectItem().getName(), is("jira-developers"));
        assertThat(secondRecord.getObjectItem().getTypeName(), is("GROUP"));
        assertThat(secondRecord.getObjectItem().getParentId(), nullValue());
        assertThat(secondRecord.getObjectItem().getParentName(), nullValue());

        final AuditAssociatedItem secondItem = secondRecord.getAssociatedItems().iterator().next();
        assertThat(secondItem.getName(), is("admin"));
        assertThat(secondItem.getTypeName(), is("USER"));
        assertThat(secondItem.getId(),  nullValue());
        assertThat(secondItem.getParentId(), nullValue());
        assertThat(secondItem.getParentName(), nullValue());

        assertThat(secondRecord.getChangedValues().iterator().hasNext(), is(false));
    }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.api.domain.AuditAssociatedItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.