AbstractBallotPageModContentFactoryImpl.java

  1. /*
  2.  * Copyright 2010-2025 James Pether Sörling
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *   http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  *
  16.  *  $Id$
  17.  *  $HeadURL$
  18. */
  19. package com.hack23.cia.web.impl.ui.application.views.user.ballot.pagemode;

  20. import java.util.List;

  21. import org.springframework.beans.factory.annotation.Autowired;

  22. import com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId;
  23. import com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId_;
  24. import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotSummary;
  25. import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotSummary_;
  26. import com.hack23.cia.service.api.DataContainer;
  27. import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.BallotMenuItemFactory;
  28. import com.hack23.cia.web.impl.ui.application.views.common.pagemode.AbstractItemPageModContentFactoryImpl;
  29. import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;

  30. /**
  31.  * The Class AbstractBallotPageModContentFactoryImpl.
  32.  */
  33. abstract class AbstractBallotPageModContentFactoryImpl extends AbstractItemPageModContentFactoryImpl<List<ViewRiksdagenVoteDataBallotSummary>> {

  34.     /** The Constant NAME. */
  35.     public static final String NAME = UserViews.BALLOT_VIEW_NAME;

  36.     /** The ballot menu item factory. */
  37.     @Autowired
  38.     private BallotMenuItemFactory ballotMenuItemFactory;

  39.     /**
  40.      * Instantiates a new abstract ballot page mod content factory impl.
  41.      */
  42.     AbstractBallotPageModContentFactoryImpl() {
  43.         super();
  44.     }

  45.     /**
  46.      * Gets the ballot menu item factory.
  47.      *
  48.      * @return the ballot menu item factory
  49.      */
  50.     protected final BallotMenuItemFactory getBallotMenuItemFactory() {
  51.         return ballotMenuItemFactory;
  52.     }

  53.     @Override
  54.     protected List<ViewRiksdagenVoteDataBallotSummary> getItem(final String parameters) {
  55.         final String pageId = getPageId(parameters);

  56.         final DataContainer<ViewRiksdagenVoteDataBallotSummary, RiksdagenVoteDataBallotEmbeddedId> dataContainer = getApplicationManager()
  57.                 .getDataContainer(ViewRiksdagenVoteDataBallotSummary.class);

  58.         return dataContainer.findListByEmbeddedProperty(ViewRiksdagenVoteDataBallotSummary.class, ViewRiksdagenVoteDataBallotSummary_.embeddedId, RiksdagenVoteDataBallotEmbeddedId.class, RiksdagenVoteDataBallotEmbeddedId_.ballotId, pageId);
  59.     }

  60. }