private void assertRuleExport(RuleBaseValues oldRule, RuleBaseValues newRule) { assertFalse("Ids should be different.", oldRule.getId().equals(newRule.getId())); assertEquals(oldRule.isActive(), newRule.isActive()); assertEquals( DateUtils.round(oldRule.getActivationDate(), Calendar.DATE), DateUtils.round(newRule.getActivationDate(), Calendar.DATE)); assertEquals(oldRule.getName(), newRule.getName()); assertEquals(oldRule.getCurrentInd(), newRule.getCurrentInd()); assertEquals(oldRule.getDeactivationDate(), newRule.getDeactivationDate()); assertEquals(oldRule.getDelegateRule(), newRule.getDelegateRule()); assertEquals(oldRule.getDescription(), newRule.getDescription()); assertEquals(oldRule.getDocTypeName(), newRule.getDocTypeName()); if (oldRule.getFromDateValue() == null) { assertNull(newRule.getFromDateValue()); } else { assertEquals( DateUtils.round(oldRule.getFromDateValue(), Calendar.DATE), DateUtils.round(newRule.getFromDateValue(), Calendar.DATE)); } if (oldRule.getToDateValue() == null) { assertNull(newRule.getToDateValue()); } else { assertEquals( DateUtils.round(oldRule.getToDateValue(), Calendar.DATE), DateUtils.round(newRule.getToDateValue(), Calendar.DATE)); } assertEquals(oldRule.getFromDateString(), newRule.getFromDateString()); assertEquals(oldRule.getToDateString(), newRule.getToDateString()); assertEquals(oldRule.isForceAction(), newRule.isForceAction()); if (!oldRule.getDelegateRule().booleanValue()) assertEquals(oldRule.getPreviousVersionId(), newRule.getPreviousVersionId()); assertEquals(oldRule.getDocumentId(), newRule.getDocumentId()); if (oldRule.getRuleTemplate() == null) { assertNull(newRule.getRuleTemplate()); } else { assertEquals(oldRule.getRuleTemplate().getName(), newRule.getRuleTemplate().getName()); } if (oldRule.getRuleExpressionDef() == null) { assertNull(newRule.getRuleExpressionDef()); } else { assertEquals( oldRule.getRuleExpressionDef().getExpression(), newRule.getRuleExpressionDef().getExpression()); assertEquals( oldRule.getRuleExpressionDef().getType(), newRule.getRuleExpressionDef().getType()); } if (!oldRule.getDelegateRule().booleanValue()) assertEquals(oldRule.getVersionNbr(), newRule.getVersionNbr()); assertRuleExtensions(oldRule.getRuleExtensions(), newRule.getRuleExtensions()); assertResponsibilities(oldRule.getRuleResponsibilities(), newRule.getRuleResponsibilities()); }
@Override public ScheduledServiceAdvancedResource getTaskScheduled() { if (scheduledTask == null) { scheduledTask = new ScheduledServiceAdvancedResource(); scheduledTask.setEnabled(true); scheduledTask.setId(null); scheduledTask.setName("taskAdvanced"); scheduledTask.setSchedule("advanced"); // A future date Date startDate = DateUtils.addDays(new Date(), 10); startDate = DateUtils.round(startDate, Calendar.DAY_OF_MONTH); scheduledTask.setCronCommand("0 0 12 ? * WED"); scheduledTask.setTypeId(UpdateIndexTaskDescriptor.ID); ScheduledServicePropertyResource prop = new ScheduledServicePropertyResource(); prop.setKey("repositoryId"); prop.setValue("all_repo"); scheduledTask.addProperty(prop); } return scheduledTask; }
@Override public void populate(final SOURCE productModel, final TARGET productData) throws ConversionException { final BaseSiteModel baseSiteModel = getBaseSiteService().getCurrentBaseSite(); if (baseSiteModel != null) { final PromotionGroupModel defaultPromotionGroup = baseSiteModel.getDefaultPromotionGroup(); final Date currentTimeRoundedToMinute = DateUtils.round(getTimeService().getCurrentTime(), Calendar.MINUTE); if (defaultPromotionGroup != null) { final List<ProductPromotionModel> promotions = getPromotionsService() .getProductPromotions( Collections.singletonList(defaultPromotionGroup), productModel, true, currentTimeRoundedToMinute); productData.setPotentialPromotions( Converters.convertAll(promotions, getPromotionsConverter())); } } }
@Override public ScheduledServiceMonthlyResource getTaskScheduled() { if (scheduledTask == null) { scheduledTask = new ScheduledServiceMonthlyResource(); scheduledTask.setEnabled(true); scheduledTask.setId(null); scheduledTask.setName("taskMonthly"); scheduledTask.setSchedule("monthly"); // A future date Date startDate = DateUtils.addDays(new Date(), 10); startDate = DateUtils.round(startDate, Calendar.DAY_OF_MONTH); scheduledTask.setStartDate(String.valueOf(startDate.getTime())); scheduledTask.setRecurringTime("03:30"); scheduledTask.setRecurringDay(Arrays.asList(new String[] {"1", "9", "17", "25"})); scheduledTask.setTypeId(UpdateIndexTaskDescriptor.ID); ScheduledServicePropertyResource prop = new ScheduledServicePropertyResource(); prop.setKey("repositoryId"); prop.setValue("all_repo"); scheduledTask.addProperty(prop); } return scheduledTask; }