public boolean isEmpty() {
   return super.isEmpty()
       && (identifier == null || identifier.isEmpty())
       && (name == null || name.isEmpty())
       && (type == null || type.isEmpty())
       && (status == null || status.isEmpty())
       && (activePeriod == null || activePeriod.isEmpty())
       && (currency == null || currency.isEmpty())
       && (balance == null || balance.isEmpty())
       && (coveragePeriod == null || coveragePeriod.isEmpty())
       && (subject == null || subject.isEmpty())
       && (owner == null || owner.isEmpty())
       && (description == null || description.isEmpty());
 }
Esempio n. 2
0
 public SupplyDispenseComponent copy(Supply e) {
   SupplyDispenseComponent dst = e.new SupplyDispenseComponent();
   dst.identifier = identifier == null ? null : identifier.copy();
   dst.status = status == null ? null : status.copy();
   dst.type = type == null ? null : type.copy();
   dst.quantity = quantity == null ? null : quantity.copy();
   dst.suppliedItem = suppliedItem == null ? null : suppliedItem.copy();
   dst.supplier = supplier == null ? null : supplier.copy();
   dst.whenPrepared = whenPrepared == null ? null : whenPrepared.copy();
   dst.whenHandedOver = whenHandedOver == null ? null : whenHandedOver.copy();
   dst.destination = destination == null ? null : destination.copy();
   dst.receiver = new ArrayList<ResourceReference>();
   for (ResourceReference i : receiver) dst.receiver.add(i.copy());
   return dst;
 }
 /**
  * 事件统计-趋势
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 事件统计-排行 {status:[true|false],data:[{name,num,rn,user,ru},...]}
  */
 @RequestMapping("event/trend/{period:hour|day|week|month}")
 public Object eventTrend(
     @PathVariable int siteId,
     @PathVariable Period period,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   List<EventTrendValue> list = service.eventTrend(idsite, period, start, end);
   list = fulldata(list, period.getFormat(), period.getField(), start, end, EventTrendValue.class);
   return list;
 }
Esempio n. 4
0
 public Coverage copy() {
   Coverage dst = new Coverage();
   copyValues(dst);
   dst.issuer = issuer == null ? null : issuer.copy();
   dst.bin = bin == null ? null : bin.copy();
   dst.period = period == null ? null : period.copy();
   dst.type = type == null ? null : type.copy();
   dst.subscriberId = subscriberId == null ? null : subscriberId.copy();
   if (identifier != null) {
     dst.identifier = new ArrayList<Identifier>();
     for (Identifier i : identifier) dst.identifier.add(i.copy());
   }
   ;
   dst.group = group == null ? null : group.copy();
   dst.plan = plan == null ? null : plan.copy();
   dst.subPlan = subPlan == null ? null : subPlan.copy();
   dst.dependent = dependent == null ? null : dependent.copy();
   dst.sequence = sequence == null ? null : sequence.copy();
   dst.subscriber = subscriber == null ? null : subscriber.copy();
   dst.network = network == null ? null : network.copy();
   if (contract != null) {
     dst.contract = new ArrayList<Reference>();
     for (Reference i : contract) dst.contract.add(i.copy());
   }
   ;
   return dst;
 }
Esempio n. 5
0
 public boolean isEmpty() {
   return super.isEmpty()
       && (code == null || code.isEmpty())
       && (value == null || value.isEmpty())
       && (exclude == null || exclude.isEmpty())
       && (period == null || period.isEmpty());
 }
Esempio n. 6
0
 public GroupMemberComponent copy() {
   GroupMemberComponent dst = new GroupMemberComponent();
   copyValues(dst);
   dst.entity = entity == null ? null : entity.copy();
   dst.period = period == null ? null : period.copy();
   dst.inactive = inactive == null ? null : inactive.copy();
   return dst;
 }
 /**
  * 根据周期和便宜计算结束时间
  *
  * @param end 结束时间
  * @param span 时间跨度
  * @param offset 偏移
  * @return 结束时间
  */
 private Date timeEnd(Date end, Period span, Integer offset) {
   if (span != null && offset != null /* && !Period.hour.equals(span)*/) {
     DateFormat format = span.getFormat();
     Calendar calendar = Calendar.getInstance();
     try {
       calendar.setTime(format.parse(format.format(calendar.getTime())));
     } catch (ParseException e) {
       e.printStackTrace();
     }
     calendar.add(span.getField(), offset + 1);
     return calendar.getTime();
   }
   if (end == null) {
     return timeEnd(new Date(), Period.year, 1000);
   }
   return end;
 }
 /**
  * 根据周期和便宜计算开始时间
  *
  * @param start 开始时间
  * @param span 时间跨度
  * @param offset 偏移
  * @return 开始时间
  */
 private Date timeStart(Date start, Period span, Integer offset) {
   if (span != null && offset != null) {
     DateFormat format = span.getFormat();
     Calendar calendar = Calendar.getInstance();
     try {
       calendar.setTime(format.parse(format.format(calendar.getTime())));
     } catch (ParseException e) {
       e.printStackTrace();
     }
     calendar.add(span.getField(), offset);
     return calendar.getTime();
   }
   if (start == null) {
     return timeStart(new Date(), Period.year, -1000);
   }
   return start;
 }
Esempio n. 9
0
 public DocumentReferenceContextComponent copy(DocumentReference e) {
   DocumentReferenceContextComponent dst = e.new DocumentReferenceContextComponent();
   dst.code = new ArrayList<CodeableConcept>();
   for (CodeableConcept i : code) dst.code.add(i.copy());
   dst.period = period == null ? null : period.copy();
   dst.facilityType = facilityType == null ? null : facilityType.copy();
   return dst;
 }
 public boolean isEmpty() {
   return super.isEmpty()
       && (system == null || system.isEmpty())
       && (value == null || value.isEmpty())
       && (use == null || use.isEmpty())
       && (rank == null || rank.isEmpty())
       && (period == null || period.isEmpty());
 }
Esempio n. 11
0
 public GroupCharacteristicComponent copy() {
   GroupCharacteristicComponent dst = new GroupCharacteristicComponent();
   copyValues(dst);
   dst.code = code == null ? null : code.copy();
   dst.value = value == null ? null : value.copy();
   dst.exclude = exclude == null ? null : exclude.copy();
   dst.period = period == null ? null : period.copy();
   return dst;
 }
 public ContactPoint copy() {
   ContactPoint dst = new ContactPoint();
   copyValues(dst);
   dst.system = system == null ? null : system.copy();
   dst.value = value == null ? null : value.copy();
   dst.use = use == null ? null : use.copy();
   dst.rank = rank == null ? null : rank.copy();
   dst.period = period == null ? null : period.copy();
   return dst;
 }
 /**
  * 计算分割段数
  *
  * @param period 时段周期 [时|日|周|月]
  * @param start 开始时间
  * @param end 结束时间
  * @return 段数
  */
 private int countDays(Period period, Date start, Date end) {
   Calendar calendar = Calendar.getInstance();
   calendar.setTime(start);
   int count = 0;
   while (calendar.getTime().before(end)) {
     count++;
     calendar.add(period.getField(), 1);
   }
   return count;
 }
 /**
  * 检测时间分段合理性
  *
  * @param period 时段周期 [时|日|周|月]
  * @param start 开始时间
  * @param end 结束时间
  */
 private void doCheckPeriod(Period period, Date start, Date end) throws ServiceException {
   Calendar calendar = Calendar.getInstance();
   calendar.setTime(start);
   int count = 0, max = 200;
   while (calendar.getTime().before(end)) {
     if (count++ > max) {
       throw new ServiceException("数据量偏大,请调整时间跨度再试!");
     }
     calendar.add(period.getField(), 1);
   }
 }
Esempio n. 15
0
 public boolean isEmpty() {
   return super.isEmpty()
       && (use == null || use.isEmpty())
       && (text == null || text.isEmpty())
       && (line == null || line.isEmpty())
       && (city == null || city.isEmpty())
       && (state == null || state.isEmpty())
       && (postalCode == null || postalCode.isEmpty())
       && (country == null || country.isEmpty())
       && (period == null || period.isEmpty());
 }
 public Account copy() {
   Account dst = new Account();
   copyValues(dst);
   if (identifier != null) {
     dst.identifier = new ArrayList<Identifier>();
     for (Identifier i : identifier) dst.identifier.add(i.copy());
   }
   ;
   dst.name = name == null ? null : name.copy();
   dst.type = type == null ? null : type.copy();
   dst.status = status == null ? null : status.copy();
   dst.activePeriod = activePeriod == null ? null : activePeriod.copy();
   dst.currency = currency == null ? null : currency.copy();
   dst.balance = balance == null ? null : balance.copy();
   dst.coveragePeriod = coveragePeriod == null ? null : coveragePeriod.copy();
   dst.subject = subject == null ? null : subject.copy();
   dst.owner = owner == null ? null : owner.copy();
   dst.description = description == null ? null : description.copy();
   return dst;
 }
 public HumanName copy() {
   HumanName dst = new HumanName();
   dst.use = use == null ? null : use.copy();
   dst.text = text == null ? null : text.copy();
   dst.family = new ArrayList<String_>();
   for (String_ i : family) dst.family.add(i.copy());
   dst.given = new ArrayList<String_>();
   for (String_ i : given) dst.given.add(i.copy());
   dst.prefix = new ArrayList<String_>();
   for (String_ i : prefix) dst.prefix.add(i.copy());
   dst.suffix = new ArrayList<String_>();
   for (String_ i : suffix) dst.suffix.add(i.copy());
   dst.period = period == null ? null : period.copy();
   return dst;
 }
Esempio n. 18
0
 public boolean isEmpty() {
   return super.isEmpty()
       && (issuer == null || issuer.isEmpty())
       && (bin == null || bin.isEmpty())
       && (period == null || period.isEmpty())
       && (type == null || type.isEmpty())
       && (subscriberId == null || subscriberId.isEmpty())
       && (identifier == null || identifier.isEmpty())
       && (group == null || group.isEmpty())
       && (plan == null || plan.isEmpty())
       && (subPlan == null || subPlan.isEmpty())
       && (dependent == null || dependent.isEmpty())
       && (sequence == null || sequence.isEmpty())
       && (subscriber == null || subscriber.isEmpty())
       && (network == null || network.isEmpty())
       && (contract == null || contract.isEmpty());
 }
Esempio n. 19
0
 public Address copy() {
   Address dst = new Address();
   copyValues(dst);
   dst.use = use == null ? null : use.copy();
   dst.text = text == null ? null : text.copy();
   if (line != null) {
     dst.line = new ArrayList<StringType>();
     for (StringType i : line) dst.line.add(i.copy());
   }
   ;
   dst.city = city == null ? null : city.copy();
   dst.state = state == null ? null : state.copy();
   dst.postalCode = postalCode == null ? null : postalCode.copy();
   dst.country = country == null ? null : country.copy();
   dst.period = period == null ? null : period.copy();
   return dst;
 }
Esempio n. 20
0
 /** Add all the screen listeners. */
 public void addListeners() {
   super.addListeners();
   this.getScreenRecord().getField(AcctDetailScreenRecord.ACCOUNT_ID).setEnabled(true);
   this.getRecord(Account.ACCOUNT_FILE)
       .getField(Account.ACCOUNT_NO)
       .setEnabled(true); // Enable Key Field
   this.getScreenRecord()
       .getField(AcctDetailScreenRecord.START_DATE)
       .addListener(new RegisterValueHandler(null));
   this.getScreenRecord()
       .getField(AcctDetailScreenRecord.END_DATE)
       .addListener(new RegisterValueHandler(null));
   this.getScreenRecord()
       .getField(AcctDetailScreenRecord.CALC_START)
       .addListener(new RegisterValueHandler(null));
   if ((this.getScreenRecord().getField(AcctDetailScreenRecord.START_DATE).isNull())
       || (this.getScreenRecord()
           .getField(AcctDetailScreenRecord.END_DATE)
           .isNull())) { // If the starting and ending date haven't been set yet, set them to the
                         // current period start and end.
     Date date = new Date(); // Now
     Period recPeriod =
         new Period(
             (RecordOwner)
                 this
                     .getParentScreen()); // Note: I Use READ_MOVE, because RegisterBehavior
                                          // doesn't respond to it.
     if (this.getScreenRecord().getField(AcctDetailScreenRecord.START_DATE).isNull())
       ((DateTimeField) this.getScreenRecord().getField(AcctDetailScreenRecord.START_DATE))
           .setDate(
               recPeriod.getPeriodStartDate(date), DBConstants.DISPLAY, DBConstants.READ_MOVE);
     if (this.getScreenRecord().getField(AcctDetailScreenRecord.END_DATE).isNull())
       ((DateTimeField) this.getScreenRecord().getField(AcctDetailScreenRecord.END_DATE))
           .setDate(recPeriod.getPeriodEndDate(date), DBConstants.DISPLAY, DBConstants.READ_MOVE);
     recPeriod.free();
     recPeriod = null;
   }
   this.getScreenRecord().getField(AcctDetailScreenRecord.START_DATE).setEnabled(true);
   this.getScreenRecord().getField(AcctDetailScreenRecord.END_DATE).setEnabled(true);
   this.getScreenRecord().getField(AcctDetailScreenRecord.CALC_START).setEnabled(true);
 }
Esempio n. 21
0
 public boolean isEmpty() {
   return super.isEmpty()
       && (action == null || action.isEmpty())
       && (identifier == null || identifier.isEmpty())
       && (ruleset == null || ruleset.isEmpty())
       && (originalRuleset == null || originalRuleset.isEmpty())
       && (created == null || created.isEmpty())
       && (target == null || target.isEmpty())
       && (provider == null || provider.isEmpty())
       && (organization == null || organization.isEmpty())
       && (request == null || request.isEmpty())
       && (response == null || response.isEmpty())
       && (nullify == null || nullify.isEmpty())
       && (reference == null || reference.isEmpty())
       && (item == null || item.isEmpty())
       && (include == null || include.isEmpty())
       && (exclude == null || exclude.isEmpty())
       && (period == null || period.isEmpty());
 }
 public MedicationAdministration copy() {
   MedicationAdministration dst = new MedicationAdministration();
   dst.identifier = new ArrayList<Identifier>();
   for (Identifier i : identifier) dst.identifier.add(i.copy());
   dst.status = status == null ? null : status.copy();
   dst.patient = patient == null ? null : patient.copy();
   dst.practitioner = practitioner == null ? null : practitioner.copy();
   dst.encounter = encounter == null ? null : encounter.copy();
   dst.prescription = prescription == null ? null : prescription.copy();
   dst.wasNotGiven = wasNotGiven == null ? null : wasNotGiven.copy();
   dst.reasonNotGiven = new ArrayList<CodeableConcept>();
   for (CodeableConcept i : reasonNotGiven) dst.reasonNotGiven.add(i.copy());
   dst.whenGiven = whenGiven == null ? null : whenGiven.copy();
   dst.medication = medication == null ? null : medication.copy();
   dst.device = new ArrayList<ResourceReference>();
   for (ResourceReference i : device) dst.device.add(i.copy());
   dst.dosage = new ArrayList<MedicationAdministrationDosageComponent>();
   for (MedicationAdministrationDosageComponent i : dosage) dst.dosage.add(i.copy(dst));
   return dst;
 }
Esempio n. 23
0
 public ProcessRequest copy() {
   ProcessRequest dst = new ProcessRequest();
   copyValues(dst);
   dst.action = action == null ? null : action.copy();
   if (identifier != null) {
     dst.identifier = new ArrayList<Identifier>();
     for (Identifier i : identifier) dst.identifier.add(i.copy());
   }
   ;
   dst.ruleset = ruleset == null ? null : ruleset.copy();
   dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
   dst.created = created == null ? null : created.copy();
   dst.target = target == null ? null : target.copy();
   dst.provider = provider == null ? null : provider.copy();
   dst.organization = organization == null ? null : organization.copy();
   dst.request = request == null ? null : request.copy();
   dst.response = response == null ? null : response.copy();
   dst.nullify = nullify == null ? null : nullify.copy();
   dst.reference = reference == null ? null : reference.copy();
   if (item != null) {
     dst.item = new ArrayList<ItemsComponent>();
     for (ItemsComponent i : item) dst.item.add(i.copy());
   }
   ;
   if (include != null) {
     dst.include = new ArrayList<StringType>();
     for (StringType i : include) dst.include.add(i.copy());
   }
   ;
   if (exclude != null) {
     dst.exclude = new ArrayList<StringType>();
     for (StringType i : exclude) dst.exclude.add(i.copy());
   }
   ;
   dst.period = period == null ? null : period.copy();
   return dst;
 }
Esempio n. 24
0
  public void testDetailOrder() {
    Study s = Fixtures.createReleasedTemplate();
    Period period = Fixtures.createPeriod("period1", 1, 10, 2);
    PlannedActivity plannedActivity = Fixtures.createPlannedActivity("activity", 3);
    PlannedActivityLabel plannedActivityLabel = Fixtures.createPlannedActivityLabel("label");
    period.addPlannedActivity(plannedActivity);
    plannedActivity.addPlannedActivityLabel(plannedActivityLabel);
    s.getPlannedCalendar().getEpochs().get(0).getStudySegments().get(0).getPeriods().add(period);

    Delta studyDelta = Delta.createDeltaFor(s.getPlannedCalendar().getStudy());
    Delta epochDelta = Delta.createDeltaFor(s.getPlannedCalendar().getEpochs().get(0));
    Delta studySegmentDelta =
        Delta.createDeltaFor(s.getPlannedCalendar().getEpochs().get(0).getStudySegments().get(1));
    Delta periodDelta =
        Delta.createDeltaFor(
            s.getPlannedCalendar()
                .getEpochs()
                .get(0)
                .getStudySegments()
                .get(0)
                .getPeriods()
                .last());
    Delta plannedActivityDelta =
        Delta.createDeltaFor(
            s.getPlannedCalendar()
                .getEpochs()
                .get(0)
                .getStudySegments()
                .get(0)
                .getPeriods()
                .first()
                .getPlannedActivities()
                .get(0));
    Delta plannedActivityLabelDelta =
        Delta.createDeltaFor(
            s.getPlannedCalendar()
                .getEpochs()
                .get(0)
                .getStudySegments()
                .get(0)
                .getPeriods()
                .first()
                .getPlannedActivities()
                .get(0)
                .getPlannedActivityLabels()
                .first());

    List<Delta<?>> listOfDeltas = new ArrayList<Delta<?>>();
    listOfDeltas.add(plannedActivityDelta);
    listOfDeltas.add(periodDelta);
    listOfDeltas.add(epochDelta);
    listOfDeltas.add(studyDelta);
    listOfDeltas.add(studySegmentDelta);
    listOfDeltas.add(plannedActivityLabelDelta);

    expect(templateService.findEquivalentChild(s, studyDelta.getNode())).andReturn(s);
    expect(templateService.findEquivalentChild(s, periodDelta.getNode())).andReturn(null);
    expect(templateService.findEquivalentChild(s, epochDelta.getNode()))
        .andReturn(epochDelta.getNode());
    expect(templateService.findEquivalentChild(s, studySegmentDelta.getNode()))
        .andReturn(studySegmentDelta.getNode());
    expect(templateService.findEquivalentChild(s, plannedActivityDelta.getNode())).andReturn(null);
    expect(templateService.findEquivalentChild(s, plannedActivityLabelDelta.getNode()))
        .andReturn(plannedActivityLabelDelta.getNode());
    replayMocks();
    DeltaIterator di = new DeltaIterator(listOfDeltas, s, templateService, false);

    assertSame("studyDelta is not the first element", studyDelta, di.next());
    assertSame("epochDelta is not the second element", epochDelta, di.next());
    assertSame("studySegmentDelta is not the third element", studySegmentDelta, di.next());
    assertSame("periodDelta is not the forth element", plannedActivityLabelDelta, di.next());
    assertFalse("deltaIterator has more elements ", di.hasNext());
    verifyMocks();
  }
Esempio n. 25
0
 public static Collection<Track> getTopTracks(String user, Period period, String apiKey) {
   Result result =
       Caller.getInstance()
           .call("user.getTopTracks", apiKey, "user", user, "period", period.getString());
   return ResponseBuilder.buildCollection(result, Track.class);
 }
Esempio n. 26
0
 public boolean isEmpty() {
   return super.isEmpty()
       && (entity == null || entity.isEmpty())
       && (period == null || period.isEmpty())
       && (inactive == null || inactive.isEmpty());
 }