Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public abstract class AbstractFoDScanSetupCommand<T> extends AbstractFoDJsonNode
protected String assessmentType; // Plain text name as custom assessment types can be created
@Mixin protected FoDEntitlementFrequencyTypeMixins.RequiredOption entitlementFrequencyTypeMixin;
@Option(names = {"--entitlement-id"})
protected Integer entitlementId;
protected Long entitlementId;

protected String assessmentTypeName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class FoDScanAssessmentTypeDescriptor {
private String name;
private String scanType;
private Integer scanTypeId;
private Integer entitlementId;
private Long entitlementId;
private String entitlementDescription;
private Integer frequencyTypeId;
private String frequencyType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public String getReleaseAndScanId() {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyy-MM-dd'T'hh:mm:ss")
private Date completedDateTime;

public Map<Integer, String> attributesAsMap() {
public Map<Long, String> attributesAsMap() {
if (attributes == null || attributes.isEmpty()) {
return Collections.emptyMap();
}
Map<Integer, String> attrMap = new HashMap<>();
Map<Long, String> attrMap = new HashMap<>();
for (FoDAttributeValueDescriptor attr : attributes) {
attrMap.put(attr.getId(), attr.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public static void validateScanDate(FoDScanDescriptor scanDescriptor, int retent

public static FoDScanAssessmentTypeDescriptor getEntitlementToUse(UnirestInstance unirest, String relId, FoDScanType scanType,
String assessmentType, FoDEnums.EntitlementFrequencyType entitlementFrequencyType,
int entitlementId) {
long entitlementId) {
FoDScanConfigDastAutomatedDescriptor currentSetup = FoDScanDastAutomatedHelper.getSetupDescriptor(unirest, relId);
Integer entitlementIdToUse = 0;
Long entitlementIdToUse = 0L;
Integer assessmentTypeId = 0;
LOG.info("Finding/Validating entitlement to use.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static class NetworkAuthenticationType {
}

public Integer assessmentTypeId;
public Integer entitlementId;
public Long entitlementId;
public FoDEnums.EntitlementFrequencyType entitlementFrequencyType; // ['SingleScan', 'Subscription']
@Builder.Default
public FoDEnums.DynamicScanEnvironmentFacingType dynamicScanEnvironmentFacingType = FoDEnums.DynamicScanEnvironmentFacingType.External; // ['Internal', 'External']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@Data @ToString
@EqualsAndHashCode(callSuper = true)
public class FoDScanDastDescriptor extends JsonNodeHolder {
private Integer scanId;
private Long scanId;
private String scanType;

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class FoDScanDastLegacyStartRequest {

private String startDate;
private Integer assessmentTypeId;
private Integer entitlementId;
private Long entitlementId;
private String entitlementFrequencyType;
private Boolean isRemediationScan;
//private Boolean isBundledAssessment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FoDScanMobileStartRequest {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy HH:mm")
private String startDate;
private Integer assessmentTypeId;
private Integer entitlementId;
private Long entitlementId;
private String entitlementFrequencyType;
private String timeZone;
private String frameworkType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public class FoDScanOssDescriptor extends JsonNodeHolder {
private Integer scanId;
private Long scanId;
private String scanType;

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public class FoDScanSastDescriptor extends JsonNodeHolder {
private Integer scanId;
private Long scanId;
private String scanType;

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public class FoDUserDescriptor extends JsonNodeHolder {
private Integer userId;
private Long userId;
private String userName;
private String firstName;
private String lastName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public class FoDUserGroupDescriptor extends JsonNodeHolder {
private Integer id;
private Long id;
private String name;
private Integer assignedUsersCount;
private Integer assignedApplicationsCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static final FoDUserGroupDescriptor createUserGroup(UnirestInstance unire
return FoDUserGroupHelper.getUserGroupDescriptor(unirest, groupId, true);
}

public static final FoDUserGroupDescriptor updateUserGroup(UnirestInstance unirest, Integer groupId, FoDUserGroupUpdateRequest userGroupUpdateRequest) {
public static final FoDUserGroupDescriptor updateUserGroup(UnirestInstance unirest, Long groupId, FoDUserGroupUpdateRequest userGroupUpdateRequest) {
ObjectNode body = objectMapper.valueToTree(userGroupUpdateRequest);
unirest.put(FoDUrls.USER_GROUP)
.routeParam("groupId", String.valueOf(groupId))
Expand Down Expand Up @@ -128,7 +128,7 @@ public static final FoDUserGroupDescriptor updateUserGroupMembership(UnirestInst
FoDEnums.UserGroupMembershipAction action) {
FoDUserDescriptor userDescriptor = FoDUserHelper.getUserDescriptor(unirest, userNameOrId, true);
FoDUserGroupDescriptor userGroupDescriptor = FoDUserGroupHelper.getUserGroupDescriptor(unirest, userGroupNameOrId, true);
ArrayList<Integer> userIds = new ArrayList<>();
ArrayList<Long> userIds = new ArrayList<>();
userIds.add(userDescriptor.getUserId());
FoDUserGroupMembersRequest userGroupMembersRequest = FoDUserGroupMembersRequest.builder().build();
if (action.equals(FoDEnums.UserGroupMembershipAction.Add)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
@Reflectable @NoArgsConstructor @AllArgsConstructor
@Data @Builder
public class FoDUserGroupMembersRequest {
private ArrayList<Integer> removeUsers;
private ArrayList<Integer> addUsers;
private ArrayList<Long> removeUsers;
private ArrayList<Long> addUsers;
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static final FoDUserDescriptor createUser(UnirestInstance unirest, FoDUse
return descriptor;
}

public static final FoDUserDescriptor updateUser(UnirestInstance unirest, Integer userId,
public static final FoDUserDescriptor updateUser(UnirestInstance unirest, Long userId,
FoDUserUpdateRequest userUpdateRequest) {
ObjectNode body = objectMapper.valueToTree(userUpdateRequest);
FoDUserDescriptor userDescriptor = getUserDescriptor(unirest, String.valueOf(userId), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class FoDAppCreateRequest {
private String releaseName;
private String releaseDescription;
private String sdlcStatusType;
private Integer ownerId;
private Long ownerId;
private String applicationType;
@Builder.Default private boolean hasMicroservices = false;
private JsonNode microservices;
Expand Down Expand Up @@ -141,10 +141,10 @@ public FoDAppCreateRequestBuilder releaseNameDescriptor(FoDQualifiedReleaseNameD
}

public FoDAppCreateRequestBuilder owner(UnirestInstance unirest, String owner) {
int userId = 0;
long userId = 0;
if (owner == null) return ownerId(null);
try {
userId = Integer.parseInt(owner);
userId = Long.parseLong(owner);
} catch (NumberFormatException nfe) {
userId = FoDUserHelper.getUserDescriptor(unirest, owner, true).getUserId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class FoDAppDescriptor extends JsonNodeHolder {
private String emailList;
private boolean hasMicroservices;

public Map<Integer, String> attributesAsMap() {
Map<Integer, String> attrMap = new HashMap<>();
public Map<Long, String> attributesAsMap() {
Map<Long, String> attrMap = new HashMap<>();
for (FoDAttributeValueDescriptor attr : attributes) {
attrMap.put(attr.getId(), attr.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public Collection<JsonNode> getAttributeDescriptorJsonNodes(UnirestInstance unir
.collect(Collectors.toList());
}

public Integer[] getAttributeIds(UnirestInstance unirest) {
public Long[] getAttributeIds(UnirestInstance unirest) {
return Stream.of(getAttributeDescriptors(unirest))
.map(FoDAttributeDefinitionDescriptor::getId)
.toArray(Integer[]::new);
.toArray(Long[]::new);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@Reflectable @NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class FoDAttributeDefinitionDescriptor extends JsonNodeHolder {
private Integer id;
private Long id;
private String name;
private Integer attributeTypeId;
private String attributeType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public FoDAttributeDefinitionDescriptor getDefinition(String nameOrId, boolean f
}
FoDAttributeDefinitionDescriptor result = null;
try {
int id = Integer.parseInt(nameOrId);
long id = Long.parseLong(nameOrId);
result = getAllDefinitions().stream()
.filter(d -> d.getId() != null && d.getId() == id)
.findFirst().orElse(null);
Expand Down Expand Up @@ -127,16 +127,16 @@ public JsonNode mergeAttributesNode(ArrayList<FoDAttributeValueDescriptor> curre
ArrayNode attrArray = JsonHelper.getObjectMapper().createArrayNode();
if (updates == null || updates.isEmpty()) return attrArray;

Map<Integer, String> updatesWithId = new HashMap<>();
Map<Long, String> updatesWithId = new HashMap<>();
for (Map.Entry<String, String> attr : updates.entrySet()) {
var def = getDefinition(attr.getKey(), true);
updatesWithId.put(def.getId(), attr.getValue());
}

Set<Integer> processedIds = new HashSet<>();
Set<Long> processedIds = new HashSet<>();
if (current != null) {
for (FoDAttributeValueDescriptor attr : current) {
int id = attr.getId();
long id = attr.getId();
ObjectNode attrObj = JsonHelper.getObjectMapper().createObjectNode();
attrObj.put("id", id);
attrObj.put("value", updatesWithId.getOrDefault(id, attr.getValue()));
Expand All @@ -145,7 +145,7 @@ public JsonNode mergeAttributesNode(ArrayList<FoDAttributeValueDescriptor> curre
}
}

for (Map.Entry<Integer, String> entry : updatesWithId.entrySet()) {
for (Map.Entry<Long, String> entry : updatesWithId.entrySet()) {
if (!processedIds.contains(entry.getKey())) {
ObjectNode attrObj = JsonHelper.getObjectMapper().createObjectNode();
attrObj.put("id", entry.getKey());
Expand Down Expand Up @@ -201,7 +201,7 @@ private FoDAttributeDefinitionDescriptor fetchFromApi(String nameOrId, boolean f
var request = unirest.get(FoDUrls.ATTRIBUTES);
JsonNode result;
try {
int id = Integer.parseInt(nameOrId);
long id = Long.parseLong(nameOrId);
result = FoDDataHelper.findUnique(request, String.format("id:%d", id));
} catch (NumberFormatException nfe) {
result = FoDDataHelper.findUnique(request, String.format("name:%s", nameOrId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@Reflectable @NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class FoDAttributeValueDescriptor extends JsonNodeHolder {
private Integer id;
private Long id;
private String name;
private String value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
@Data @EqualsAndHashCode(callSuper = true)
@Reflectable @NoArgsConstructor
public class FoDPickListDescriptor extends JsonNodeHolder {
private Integer id;
private Long id;
private String name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected FoDScanConfigDastAutomatedDescriptor getSetupDescriptor(UnirestInstanc
return FoDScanDastAutomatedHelper.getSetupDescriptor(unirest, releaseId);
}

protected void validateEntitlement(FoDScanConfigDastAutomatedDescriptor currentSetup, Integer entitlementIdToUse,
protected void validateEntitlement(FoDScanConfigDastAutomatedDescriptor currentSetup, Long entitlementIdToUse,
String relId, FoDReleaseAssessmentTypeDescriptor atd) {
// validate entitlement specified or currently in use against assessment type found
if (entitlementId != null && entitlementId > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class FoDDastLegacyScanStartCommand extends AbstractFoDScanStartCommand {
//private DynamicAssessmentTypes dynamicAssessmentType;
private String dynamicAssessmentType;
@Option(names = {"--entitlement-id"})
private Integer entitlementId;
private Long entitlementId;
@Option(names = {"--start-date"})
private String startDate;
@Option(names = {"--notes"})
Expand All @@ -77,7 +77,7 @@ public class FoDDastLegacyScanStartCommand extends AbstractFoDScanStartCommand {
protected FoDScanDescriptor startScan(UnirestInstance unirest, FoDReleaseDescriptor releaseDescriptor) {
try ( var progressWriter = progressWriterFactory.create() ) {
String relId = releaseDescriptor.getReleaseId();
Integer entitlementIdToUse = 0;
Long entitlementIdToUse = 0L;
Integer assessmentTypeId = 0;
Boolean isRemediation = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@EqualsAndHashCode(callSuper=false)
public class FoDScanConfigDastAutomatedDescriptor extends JsonNodeHolder {
private Integer assessmentTypeId;
private Integer entitlementId;
private Long entitlementId;
private String entitlementFrequencyType;
private String scanType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@EqualsAndHashCode(callSuper=false)
public class FoDScanConfigDastLegacyDescriptor extends JsonNodeHolder {
private Integer assessmentTypeId;
private Integer entitlementId;
private Long entitlementId;
private String entitlementDescription;
private String entitlementFrequencyType;
private Integer entitlementFrequencyTypeId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FoDBulkIssueUpdateRequest {
private Integer userId;
private Long userId;
private String developerStatus;
private String auditorStatus;
private String severity;
Expand Down Expand Up @@ -73,10 +73,10 @@ private void validateRequired(List<String> messages, Object obj, String message)

public static class FoDBulkIssueUpdateRequestBuilder {
public FoDBulkIssueUpdateRequestBuilder user(UnirestInstance unirest, String user) {
int userId = 0;
long userId = 0;
if (user == null) return userId(null);
try {
userId = Integer.parseInt(user);
userId = Long.parseLong(user);
} catch (NumberFormatException nfe) {
userId = FoDUserHelper.getUserDescriptor(unirest, user, true).getUserId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private String tryResolveAgainstAttributes(String[] attributeNames, String candi
}
}
try {
int providedId = Integer.parseInt(candidate);
long providedId = Long.parseLong(candidate);
for (var pv : picklist) {
if (Objects.equals(pv.getId(), providedId)) {
return pv.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static final ArrayNode mergeReleaseIssues(ArrayNode issues) {
sortedRecords.sort(
Comparator.comparingInt((ObjectNode n) -> n.get("severity").asInt()).reversed()
.thenComparing(n -> n.get("category").asText())
.thenComparing(n -> n.get("releaseId").asInt())
.thenComparing(n -> n.get("releaseId").asLong())
);

ArrayNode result = JsonHelper.getObjectMapper().createArrayNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected JsonNode setup(UnirestInstance unirest, FoDReleaseDescriptor releaseDe
var atd = FoDReleaseAssessmentTypeHelper.getAssessmentTypeDescriptor(unirest, releaseId, FoDScanType.Mobile,
entitlementFrequencyTypeMixin.getEntitlementFrequencyType(), assessmentType);
Integer assessmentTypeId = atd.getAssessmentTypeId();
Integer entitlementIdToUse = atd.getEntitlementId();
Long entitlementIdToUse = atd.getEntitlementId();
assessmentTypeName = atd.getName();

validateEntitlement(currentSetup, entitlementIdToUse, releaseId, atd);
Expand All @@ -124,7 +124,7 @@ protected JsonNode setup(UnirestInstance unirest, FoDReleaseDescriptor releaseDe
return FoDScanConfigMobileHelper.setupScan(unirest, releaseDescriptor, setupMastScanRequest).asJsonNode();
}

private void validateEntitlement(FoDScanConfigMobileDescriptor currentSetup, Integer entitlementIdToUse, String releaseId, FoDReleaseAssessmentTypeDescriptor atd) {
private void validateEntitlement(FoDScanConfigMobileDescriptor currentSetup, Long entitlementIdToUse, String releaseId, FoDReleaseAssessmentTypeDescriptor atd) {
// validate entitlement specified or currently in use against assessment type found
if (entitlementId != null && entitlementId > 0) {
// check if "entitlement id" explicitly matches what has been found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class FoDMastScanStartCommand extends AbstractFoDScanStartCommand {
@Option(names = {"--assessment-type"}, required = true)
private String mobileAssessmentType;
@Option(names = {"--entitlement-id"})
private Integer entitlementId;
private Long entitlementId;
private enum MobileFrameworks { iOS, Android }
@Option(names = {"--framework"})
private MobileFrameworks mobileFramework;
Expand Down Expand Up @@ -138,7 +138,7 @@ protected FoDScanDescriptor startScan(UnirestInstance unirest, FoDReleaseDescrip
}
}

private void validateEntitlement(FoDScanConfigMobileDescriptor currentSetup, Integer entitlementIdToUse, String relId, FoDReleaseAssessmentTypeDescriptor atd) {
private void validateEntitlement(FoDScanConfigMobileDescriptor currentSetup, Long entitlementIdToUse, String relId, FoDReleaseAssessmentTypeDescriptor atd) {
// validate entitlement specified or currently in use against assessment type found
if (entitlementId != null && entitlementId > 0) {
// check if "entitlement id" explicitly matches what has been found
Expand Down
Loading
Loading