Example usage for org.joda.time DateTime getYear

List of usage examples for org.joda.time DateTime getYear

Introduction

In this page you can find the example usage for org.joda.time DateTime getYear.

Prototype

public int getYear() 

Source Link

Document

Get the year field value.

Usage

From source file:eu.uqasar.web.dashboard.widget.datadeviation.DataDeviationWidget.java

License:Apache License

public Options getQualityParameterOptions() {

    Project proj = null;//w  w  w . ja  va  2 s .  c  o m
    String projName = "";
    String qualityParameterChoice = "";

    proj = getProject(settings.get("project"));
    if (proj != null) {
        projName = proj.getName();
        System.out.println("projName: " + projName);
    }

    qualityParameterChoice = settings.get("qualityParams");
    //      if (qualityParameterChoice == null || qualityParameterChoice.isEmpty()) {         
    //         qualityParameterChoice = OBJS;
    //      }   

    System.out.println("qualityParameterChoice: " + qualityParameterChoice);

    Options options = new Options();
    ChartOptions chartOptions = new ChartOptions();

    // DATA
    List<HistoricValuesBaseIndicator> historicValues = getHistoricalValues();
    List<HistoricValuesBaseIndicator> qualityParam = new LinkedList<>();

    List<Float> baseIndicatorValues = new LinkedList<>();
    // get and save parameter values
    for (HistoricValuesBaseIndicator hv : historicValues) {
        if (hv.getBaseIndicator().getName().equals(qualityParameterChoice)) {
            qualityParam.add(hv);
            baseIndicatorValues.add(hv.getBaseIndicator().getValue());
        }
    }

    // calculate deviations
    // test: overwrite values
    //      baseIndicatorValues.set(0, 40087.0f);
    //      baseIndicatorValues.set(1, 39457.0f);
    //      baseIndicatorValues.set(2, 41347.0f);
    //      baseIndicatorValues.set(3, 44777.0f);

    System.out.println("baseIndicatorValues: " + baseIndicatorValues);
    List<Float> deviations = calculateDeviations(baseIndicatorValues);
    System.out.println("deviations: " + deviations);

    SeriesType seriesType = SeriesType.SPLINE;
    chartOptions.setType(seriesType);
    chartTitle = new Title("Deviations of " + qualityParameterChoice);
    options.setTitle(chartTitle);
    PointSeries series = new PointSeries();
    series.setType(seriesType);

    List<String> xAxisLabels = new ArrayList<>();

    for (int f = 0; f < deviations.size(); f++) {
        String name = qualityParam.get(f).getBaseIndicator().getName();
        float value = deviations.get(f);
        series.addPoint(new Point(name, value));
        //xAxis Label
        DateTime dateTime = new DateTime(qualityParam.get(f).getDate());
        String dateFormated = String.valueOf(dateTime.getMonthOfYear()) + "/"
                + String.valueOf(dateTime.dayOfMonth().get()) + "/" + String.valueOf(dateTime.getYear()) + " - "
                + String.valueOf(dateTime.getHourOfDay()) + ":" + String.valueOf(dateTime.getMinuteOfHour());
        xAxisLabels.add(dateFormated);

    }

    // Date on xAxis
    Axis xAxis = new Axis();
    xAxis.setType(AxisType.DATETIME);
    xAxis.setCategories(xAxisLabels);
    xAxis.setLabels(new Labels().setRotation(-60).setAlign(HorizontalAlignment.RIGHT).setStyle(
            new CssStyle().setProperty("font-size", "10px").setProperty("font-family", "Verdana, sans-serif")));
    options.setxAxis(xAxis);

    options.addSeries(series);
    options.setChartOptions(chartOptions);

    return options;
}

From source file:eu.uqasar.web.dashboard.widget.uqasardatavisualization.UqasarDataVisualizationWidget.java

License:Apache License

public Options getQualityParameterOptions() {

    Project proj = null;/*  w  ww  .  j  a va2 s . c o  m*/
    String projName = "";
    Map<String, List<TreeNode>> qualityParameters = new HashMap<>();
    String qualityParameterChoice = "";

    proj = getProject(settings.get("project"));
    if (proj != null) {
        projName = proj.getName();
    }

    qualityParameterChoice = settings.get("qualityParams");
    if (qualityParameterChoice == null || qualityParameterChoice.isEmpty()) {
        qualityParameterChoice = ALL.get(0); // all params
    }
    System.out.println("qualityParameterChoice: " + qualityParameterChoice);

    Options options = new Options();
    ChartOptions chartOptions = new ChartOptions();

    if (qualityParameterChoice.equals(ALL.get(0))) {
        // DATA
        qualityParameters = getQualityParametersFromProject(proj);
        SeriesType seriesType = SeriesType.COLUMN;
        // CHART
        chartOptions.setType(seriesType);
        chartTitle = new Title(ALL.get(0) + " of " + projName);
        options.setTitle(chartTitle);
        for (String key : qualityParameters.keySet()) {
            PointSeries series = new PointSeries();
            series.setType(seriesType);
            int siz = qualityParameters.get(key).size();
            series.addPoint(new Point(key, siz));
            series.setName(key);
            options.addSeries(series);
        }
        options.setChartOptions(chartOptions);
    } else {

        // DATA
        List<HistoricValuesBaseIndicator> HistoricValuesBaseIndicator = getHistoricalValues();
        List<HistoricValuesBaseIndicator> data = new LinkedList<>();

        for (HistoricValuesBaseIndicator hv : HistoricValuesBaseIndicator) {
            if (hv.getBaseIndicator().getName().equals(qualityParameterChoice)) {
                data.add(hv);
            }
        }

        SeriesType seriesType = SeriesType.SPLINE;
        chartOptions.setType(seriesType);
        chartTitle = new Title(qualityParameterChoice + " of " + projName);
        options.setTitle(chartTitle);
        PointSeries series = new PointSeries();
        series.setType(seriesType);

        List<String> xAxisLabels = new ArrayList<>();

        for (HistoricValuesBaseIndicator dat : data) {
            String name = dat.getBaseIndicator().getName();
            float value = dat.getBaseIndicator().getValue();
            series.addPoint(new Point(name, value));

            //xAxis Label
            //xAxis Label
            DateTime dateTime = new DateTime(dat.getDate());
            String dateFormated = String.valueOf(dateTime.getMonthOfYear()) + "/"
                    + String.valueOf(dateTime.dayOfMonth().get()) + "/" + String.valueOf(dateTime.getYear())
                    + " - " + String.valueOf(dateTime.getHourOfDay()) + ":"
                    + String.valueOf(dateTime.getMinuteOfHour());
            xAxisLabels.add(dateFormated);

        }

        // Date on xAxis
        Axis xAxis = new Axis();
        xAxis.setType(AxisType.DATETIME);
        xAxis.setCategories(xAxisLabels);
        xAxis.setLabels(
                new Labels().setRotation(-60).setAlign(HorizontalAlignment.RIGHT).setStyle(new CssStyle()
                        .setProperty("font-size", "10px").setProperty("font-family", "Verdana, sans-serif")));
        options.setxAxis(xAxis);

        options.addSeries(series);
        options.setChartOptions(chartOptions);
    }

    return options;
}

From source file:facebookpostpuller.PostModel.java

@Override
public void run() {
    User friend;//from w  ww  . j a v a2s  . c o m
    User evaluatedFriend;
    DateTime birthdate;
    List<User> friends = myFriends.getData();
    for (int i = this.startIndex; i < this.endIndex; i++) {
        if (stopped) {
            break;
        }
        friend = friends.get(i);
        // Start of Retry Try-Catch
        int count1 = 0;
        int maxTries = 5;
        while (true) {
            try {
                evaluatedFriend = facebookClient.fetchObject(friend.getId(), User.class,
                        Parameter.with("fields", "id, name, birthday"));
                break;
            } catch (FacebookNetworkException ex) {
                System.err.println("Thread " + threadName + ": Retry #" + count1);
                outputString = "Thread " + threadName + ": Retry #" + count1 + "\n";
                setChanged();
                notifyObservers();
                outputString = "";
                if (++count1 == maxTries) {
                    throw ex;
                }
            }
        }
        // End of Retry Try-Catch
        birthdate = new DateTime(evaluatedFriend.getBirthdayAsDate());

        // This line checks if the user's profile has his/her birthdate set and made public
        // Skips users who has no bday set and made public on their profile 
        if (birthdate.getYear() == DateTime.now().getYear()) {
            PostModel.progress++;
            setChanged();
            notifyObservers();
            continue;
        }
        // DELETE MO TOOOOOOO
        int age = calculateAge(evaluatedFriend.getBirthdayAsDate());
        if (age >= 13 && age <= 17 && !check[0]) {
            PostModel.progress++;
            setChanged();
            notifyObservers();
            continue;
        } else if (age >= 18 && age <= 24 && !check[1]) {
            PostModel.progress++;
            setChanged();
            notifyObservers();
            continue;
        } else if (age >= 25 && age <= 34 && !check[2]) {
            PostModel.progress++;
            setChanged();
            notifyObservers();
            continue;
        } else if (age >= 35 && age <= 44 && !check[3]) {
            PostModel.progress++;
            setChanged();
            notifyObservers();
            continue;
        } else if (age >= 45 && !check[4]) { // Modified 6/11/2014 
            PostModel.progress++;
            setChanged();
            notifyObservers();
            continue;
        }
        // END OF DELETE MO TOOOOOOO
        //outputString = "Thread " + threadName + "\n"
        //        + "Name: "
        //        + evaluatedFriend.getName()
        //        + "\nAge: "
        //        + calculateAge(evaluatedFriend.getBirthdayAsDate()) + "\n\n";
        //setChanged();
        //notifyObservers();
        outputString = "";

        DateTime minusOneYear = DateTime
                .parse(evaluatedFriend.getBirthday(), DateTimeFormat.forPattern("M/d/y"))
                .withYear(DateTime.now().getYear()).minusYears(1);

        Long targetTime = minusOneYear.getMillis() / 1000;

        Long now = DateTime.now().getMillis() / 1000;
        System.out.println("Thread " + threadName + ": " + evaluatedFriend.getName());
        Connection<Post> feed = null;
        // Start of Retry Try-Catch
        int count2 = 0;
        while (true) {
            try {
                if (calculateAge(evaluatedFriend.getBirthdayAsDate()) >= 18
                        && calculateAge(evaluatedFriend.getBirthdayAsDate()) <= 24) {
                    feed = facebookClient.fetchConnection(evaluatedFriend.getId().concat("/posts"), Post.class,
                            Parameter.with("fields", "message,from"), Parameter.with("until", now),
                            Parameter.with("since", targetTime), Parameter.with("limit", 50)); // limited to x posts
                    // Dataset range (first x posts since the user's birthdate last year until today)
                } else {
                    feed = facebookClient.fetchConnection(evaluatedFriend.getId().concat("/posts"), Post.class,
                            Parameter.with("fields", "message,from"), Parameter.with("limit", 500)); // limited to x posts
                }
                break;
            } catch (FacebookNetworkException ex) {
                System.err.println("Thread " + threadName + ": Retry #" + count2);
                outputString = "Thread " + threadName + ": Retry #" + count2 + "\n";
                setChanged();
                notifyObservers();
                outputString = "";
                if (++count2 == maxTries) {
                    throw ex;
                }
            }
        }
        // End of Retry Try-Catch
        String recentMessage = "";
        boolean userHasPosts = false;
        for (Post post : feed.getData()) {
            if (stopped) {
                break;
            }

            if (post.getMessage() == null) {
                continue;
            }

            // Prevents duplicate posts. Idk kung bug ba ng RestFB o kung ano man
            if (recentMessage.equals(post.getMessage())) {
                recentMessage = post.getMessage();
                continue;
            }

            recentMessage = post.getMessage();
            // End of duplicate checker

            //outputString = post.getMessage() + "\n";
            //setChanged();
            //notifyObservers();
            //outputString = "";
            posts.put(post, evaluatedFriend);
            userHasPosts = true;
        }
        if (userHasPosts) {
            // Puts the name and age of the friend
            metadata.put(String.valueOf(evaluatedFriend.getName()),
                    String.valueOf(calculateAge(evaluatedFriend.getBirthdayAsDate())));
        }
        PostModel.progress++;
        setChanged();
        notifyObservers();
    }
    stopped = true;

    System.out.println("Thread " + threadName + " finished execution\n" + posts.size());
    System.out.println(metadata.size());
}

From source file:facebookpostpuller.PostModelBACKUP.java

@Override
public void run() {
    User friend;/*from ww w  .  j a  v  a  2s. co  m*/
    User evaluatedFriend;
    DateTime birthdate;
    List<User> friends = myFriends.getData();
    for (int i = this.startIndex; i < this.endIndex; i++) {
        if (stopped) {
            break;
        }
        friend = friends.get(i);
        evaluatedFriend = facebookClient.fetchObject(friend.getId(), User.class,
                Parameter.with("fields", "id, name, birthday"));

        birthdate = new DateTime(evaluatedFriend.getBirthdayAsDate());

        // This line checks if the user's profile has his/her birthdate set and made public
        // Skips users who has no bday set and made public on their profile 
        if (birthdate.getYear() == DateTime.now().getYear()) {
            continue;
        }

        // Puts the name and age of the friend
        metadata.put(String.valueOf(evaluatedFriend.getName()),
                String.valueOf(calculateAge(evaluatedFriend.getBirthdayAsDate())));

        outputString = "Thread " + threadName + "\n" + "Name: " + evaluatedFriend.getName() + "\nAge: "
                + calculateAge(evaluatedFriend.getBirthdayAsDate()) + "\n\n";
        setChanged();
        notifyObservers();
        outputString = "";

        DateTime minusOneYear = DateTime
                .parse(evaluatedFriend.getBirthday(), DateTimeFormat.forPattern("M/d/y"))
                .withYear(DateTime.now().getYear()).minusYears(1);

        Long targetTime = minusOneYear.getMillis() / 1000;

        Long now = DateTime.now().getMillis() / 1000;
        System.out.println("Thread " + threadName + ": " + evaluatedFriend.getName());
        Connection<Post> feed = facebookClient.fetchConnection(evaluatedFriend.getId().concat("/posts"),
                Post.class, Parameter.with("fields", "message,from"), Parameter.with("until", now),
                Parameter.with("since", targetTime), Parameter.with("limit", 200)); // limited to x posts
        // Dataset range (first x posts since the user's birthdate last year until today)

        String recentMessage = "";
        for (Post post : feed.getData()) {
            if (stopped) {
                break;
            }

            if (post.getMessage() == null) {
                continue;
            }

            // Prevents duplicate posts. Idk kung bug ba ng RestFB o kung ano man
            if (recentMessage.equals(post.getMessage())) {
                recentMessage = post.getMessage();
                continue;
            }

            recentMessage = post.getMessage();
            // End of duplicate checker

            //outputString = post.getMessage() + "\n";
            //setChanged();
            //notifyObservers();
            //outputString = "";

            posts.put(post, evaluatedFriend);
        }
    }
    stopped = true;

    System.out.println("Thread " + threadName + " finished execution\n" + posts.size());
    System.out.println(metadata.size());
}

From source file:facebookpostpuller.PostModelBACKUP2.java

@Override
public void run() {
    User friend;/*from w  w w .j av  a  2  s. c o  m*/
    User evaluatedFriend;
    DateTime birthdate;
    List<User> friends = myFriends.getData();
    for (int i = this.startIndex; i < this.endIndex; i++) {
        if (stopped) {
            break;
        }
        friend = friends.get(i);
        // Start of Retry Try-Catch
        int count1 = 0;
        int maxTries = 5;
        while (true) {
            try {
                evaluatedFriend = facebookClient.fetchObject(friend.getId(), User.class,
                        Parameter.with("fields", "id, name, birthday"));
                break;
            } catch (FacebookNetworkException ex) {
                System.err.println(
                        "Thread " + threadName + " encountered an error. Retrying... Retry #" + count1);
                outputString = "Thread " + threadName + " encountered an error. Retrying... Retry #" + count1
                        + "\n";
                setChanged();
                notifyObservers();
                outputString = "";
                if (++count1 == maxTries) {
                    throw ex;
                }
            }
        }
        // End of Retry Try-Catch
        birthdate = new DateTime(evaluatedFriend.getBirthdayAsDate());

        // This line checks if the user's profile has his/her birthdate set and made public
        // Skips users who has no bday set and made public on their profile 
        if (birthdate.getYear() == DateTime.now().getYear()) {
            PostModelBACKUP2.progress++;
            setChanged();
            notifyObservers();
            continue;
        }

        //outputString = "Thread " + threadName + "\n"
        //        + "Name: "
        //        + evaluatedFriend.getName()
        //        + "\nAge: "
        //        + calculateAge(evaluatedFriend.getBirthdayAsDate()) + "\n\n";
        //setChanged();
        //notifyObservers();
        //outputString = "";

        DateTime minusOneYear = DateTime
                .parse(evaluatedFriend.getBirthday(), DateTimeFormat.forPattern("M/d/y"))
                .withYear(DateTime.now().getYear()).minusYears(1);

        Long targetTime = minusOneYear.getMillis() / 1000;

        Long now = DateTime.now().getMillis() / 1000;
        System.out.println("Thread " + threadName + ": " + evaluatedFriend.getName());
        Connection<Post> feed = null;
        // Start of Retry Try-Catch
        int count2 = 0;
        while (true) {
            try {
                if (calculateAge(evaluatedFriend.getBirthdayAsDate()) >= 18
                        && calculateAge(evaluatedFriend.getBirthdayAsDate()) <= 24) {
                    feed = facebookClient.fetchConnection(evaluatedFriend.getId().concat("/posts"), Post.class,
                            Parameter.with("fields", "message,from"), Parameter.with("until", now),
                            Parameter.with("since", targetTime), Parameter.with("limit", 50)); // limited to x posts
                    // Dataset range (first x posts since the user's birthdate last year until today)
                } else {
                    feed = facebookClient.fetchConnection(evaluatedFriend.getId().concat("/posts"), Post.class,
                            Parameter.with("fields", "message,from"), Parameter.with("limit", 500)); // limited to x posts
                    // Dataset range (first x posts since the user's birthdate last year until today)
                }
                break;
            } catch (FacebookNetworkException ex) {
                System.err.println(
                        "Thread " + threadName + " encountered an error. Retrying... Retry #" + count2);
                outputString = "Thread " + threadName + " encountered an error. Retrying... Retry #" + count2
                        + "\n";
                setChanged();
                notifyObservers();
                outputString = "";
                if (++count2 == maxTries) {
                    throw ex;
                }
            }
        }
        // End of Retry Try-Catch
        String recentMessage = "";
        boolean userHasPosts = false;
        for (Post post : feed.getData()) {
            if (stopped) {
                break;
            }

            if (post.getMessage() == null) {
                continue;
            }

            // Prevents duplicate posts. Idk kung bug ba ng RestFB o kung ano man
            if (recentMessage.equals(post.getMessage())) {
                recentMessage = post.getMessage();
                continue;
            }

            recentMessage = post.getMessage();
            // End of duplicate checker

            //outputString = post.getMessage() + "\n";
            //setChanged();
            //notifyObservers();
            //outputString = "";
            posts.put(post, evaluatedFriend);
            userHasPosts = true;
        }
        if (userHasPosts) {
            // Puts the name and age of the friend
            metadata.put(String.valueOf(evaluatedFriend.getName()),
                    String.valueOf(calculateAge(evaluatedFriend.getBirthdayAsDate())));
        }
        PostModelBACKUP2.progress++;
        setChanged();
        notifyObservers();
    }
    stopped = true;

    System.out.println("Thread " + threadName + " finished execution\n" + posts.size());
    System.out.println(metadata.size());
}

From source file:fi.craplab.roameo.ui.StatisticsWeekFragment.java

License:Open Source License

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    DateTime dateTime = DateTime.now();
    mWeekNumber = getArguments().getInt(ARG_WEEK_NUMBER, dateTime.getWeekOfWeekyear());
    mWeekYear = getArguments().getInt(ARG_WEEK_YEAR, dateTime.getYear());

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(RoameoEvents.ACTION_WEEK_START_CHANGED);
    intentFilter.addAction(RoameoEvents.ACTION_CALL_DATA_UPDATED);

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mDataUpdateBroadcastReceiver,
            intentFilter);/*from  w  ww  . j  av  a2s . co  m*/

    setupData();
}

From source file:fi.craplab.roameo.ui.view.ExportDatePickerDialog.java

License:Open Source License

public ExportDatePickerDialog(@NonNull Context context, @NonNull OnDateSetListener listener, int datePickerType,
        DateTime dateTime) {

    mDialog = new DatePickerDialog(context, this, dateTime.getYear(), dateTime.getMonthOfYear() - 1,
            dateTime.getDayOfMonth());//from  w  ww.  j  a v  a  2 s.  c om

    mListener = listener;
    mPickerType = datePickerType;
}

From source file:fi.craplab.roameo.ui.view.StatisticsDialog.java

License:Open Source License

@NonNull
@Override//from w w w. j  a v a2 s. c  om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    DateTime dateTime = DateTime.now();
    mWeekNumber = getArguments().getInt(ARG_WEEK_NUMBER, dateTime.getWeekOfWeekyear());
    mWeekYear = getArguments().getInt(ARG_WEEK_YEAR, dateTime.getYear());

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    View rootView = getActivity().getLayoutInflater().inflate(R.layout.dialog_statistics, null);

    mSessionCountTextView = (TextView) rootView.findViewById(R.id.session_count);
    mStepCountTextView = (TextView) rootView.findViewById(R.id.total_step_count);
    mDurationTextView = (TextView) rootView.findViewById(R.id.total_duration);
    mAvgStepCountTextView = (TextView) rootView.findViewById(R.id.average_step_count);
    mAvgDurationTextView = (TextView) rootView.findViewById(R.id.average_duration);
    mAvgPaceTextView = (TextView) rootView.findViewById(R.id.average_pace);
    mMaxStepCountTextView = (TextView) rootView.findViewById(R.id.max_step_count);
    mMaxDurationTextView = (TextView) rootView.findViewById(R.id.max_duration);

    setData();
    builder.setNegativeButton(getString(R.string.action_close), null);
    builder.setView(rootView);

    Dialog dialog = builder.create();
    dialog.setCancelable(true);
    dialog.setCanceledOnTouchOutside(true);
    return dialog;
}

From source file:fr.gouv.vitam.mdbes.MainSimpleRequest.java

License:Open Source License

protected static void oneShot(MongoDbAccess dbvitam) throws InvalidParseOperationException,
        InvalidExecOperationException, InstantiationException, IllegalAccessException {
    // Requesting
    String comdtree = request.toString();
    BasicDBObject query = (BasicDBObject) JSON.parse(comdtree);
    if (ids != null) {
        BasicDBObject id = (BasicDBObject) JSON.parse(ids);
        DateTime date = new DateTime(-123456789012345L);
        query = new BasicDBObject("OldDate", date.toDate());
        System.out.println("Date: " + date + " upd: " + query + " => " + date.getYear());
        dbvitam.daips.collection.update(id, query);
        final DBCursor cursor = dbvitam.daips.collection.find(id);
        while (cursor.hasNext()) {
            final DAip maip = (DAip) cursor.next();
            maip.load(dbvitam);/*from  w  w w.jav a 2  s.  c o  m*/
            System.out.println(maip);
        }
        cursor.close();
        System.out.println("====");
        date = date.plusYears(10);
        id.append("OldDate", new BasicDBObject("$lt", date.toDate()));
        System.out.println("Date: " + date + " find: " + id + " => " + date.getYear());
        final DBCursor cursor2 = dbvitam.daips.collection.find(id);
        while (cursor2.hasNext()) {
            final DAip maip = (DAip) cursor2.next();
            Date madate = maip.getDate("OldDate");
            System.out.println("Madate: " + madate);
            System.out.println("Madate: " + madate.getTime());
            System.out.println("Madate: " + new DateTime(madate));
            maip.load(dbvitam);
            System.out.println(maip);
        }
        cursor2.close();
    } else {
        final DBCursor cursor = dbvitam.find(dbvitam.daips, query, ID_NBCHILD);
        while (cursor.hasNext()) {
            final DAip maip = (DAip) cursor.next();
            maip.load(dbvitam);
            System.out.println(maip);
        }
        cursor.close();
    }
}

From source file:gobblin.ingestion.google.DayPartitioner.java

License:Apache License

@Override
public GenericRecord partitionForRecord(GenericRecord record) {
    GenericRecord partition = new GenericData.Record(_partitionSchema);
    String dateString = record.get(_dateColumn).toString();
    DateTime date = _dateFormatter.parseDateTime(dateString);

    if (_withPrefix) {
        if (_withColumnNames) {
            partition.put(PARTITION_COLUMN_PREFIX, PARTITION_COLUMN_PREFIX + "=" + _prefix);
        } else {//w ww. j  a va 2  s .c o  m
            partition.put(PARTITION_COLUMN_PREFIX, _prefix);
        }
    }

    if (_withColumnNames) {
        partition.put(PARTITION_COLUMN_YEAR, PARTITION_COLUMN_YEAR + "=" + date.getYear());
        partition.put(PARTITION_COLUMN_MONTH, PARTITION_COLUMN_MONTH + "=" + date.getMonthOfYear());
        partition.put(PARTITION_COLUMN_DAY, PARTITION_COLUMN_DAY + "=" + date.getDayOfMonth());
    } else {
        partition.put(PARTITION_COLUMN_YEAR, date.getYear());
        partition.put(PARTITION_COLUMN_MONTH, date.getMonthOfYear());
        partition.put(PARTITION_COLUMN_DAY, date.getDayOfMonth());
    }

    return partition;
}