Skip to content
This repository was archived by the owner on Aug 3, 2021. It is now read-only.

#81: Backport all changes to 3.7.x#84

Open
oarrietadotcms wants to merge 2 commits into
4.0-3.7.xfrom
issue-81-Backport-3.7
Open

#81: Backport all changes to 3.7.x#84
oarrietadotcms wants to merge 2 commits into
4.0-3.7.xfrom
issue-81-Backport-3.7

Conversation

@oarrietadotcms

Copy link
Copy Markdown
Contributor

No description provided.

@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public final Response createIdpConfig(@Context final HttpServletRequest req,
@FormDataParam("id") String id,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be easy just to encapsulate it into a Form

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have an example of this?

return response;
} // deleteIdpConfig.

@POST

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be PUT since it is an update

@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public final Response saveDisabledSited(@Context final HttpServletRequest req,
@FormDataParam("disabledsites") String disabledSites) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use a Form Bean here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, if you have an example it would be great!

import java.util.Objects;
import java.util.Properties;

public class IdpConfig {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why it is not a immutable bean


public List<IdpConfig> getIdpConfigs() throws IOException, JSONException {
final List<IdpConfig> idpConfigs = IdpConfigWriterReader.readIdpConfigs(new File(idpfilePath));
//Collections.sort(idpConfigs, new IdpConfigComparator());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

public static String readDefaultIdpConfigId(final File idpConfigFile) throws IOException, JSONException {
String defaultIdpConfigId = "";

if (idpConfigFile.exists()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and can read

public static List<IdpConfig> readIdpConfigs(final File idpConfigFile) throws IOException, JSONException {
List<IdpConfig> idpConfigList = new ArrayList<>();

if (idpConfigFile.exists()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can read

public class SiteJsonTransformer {

public static JSONObject getJsonObjecFromtMap(Map<String, String> map) throws JSONException {
JSONObject jo = new JSONObject();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to jsonObject

import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

public class IdpConfigPaginator implements Paginator<IdpConfig> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

if (UtilMethods.isSet(filter)){
idpConfigs = idpConfigs.stream()
.filter(x -> x.contains(filter))
.collect(Collectors.toList());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use CollectionUtils.toImmutableList()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry you can not, it is on 4.x not on 3.x

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants