diff --git a/dicegame.png b/dicegame.png new file mode 100644 index 0000000000..1c1a40821a Binary files /dev/null and b/dicegame.png differ diff --git a/liuxin/ood/ood-assignment/pom.xml b/liuxin/ood/ood-assignment/pom.xml index cac49a5328..e5f19f00ee 100644 --- a/liuxin/ood/ood-assignment/pom.xml +++ b/liuxin/ood/ood-assignment/pom.xml @@ -5,7 +5,19 @@ com.coderising ood-assignment 0.0.1-SNAPSHOT - jar + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.7 + 1.7 + + + + + jar ood-assignment http://maven.apache.org diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagBuilder.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagBuilder.java new file mode 100644 index 0000000000..fe8673ec30 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagBuilder.java @@ -0,0 +1,30 @@ +package com.coderising.dp.builder; + +public class TagBuilder { + + public TagBuilder(String rootTagName){ + + } + + public TagBuilder addChild(String childTagName){ + + return null; + } + public TagBuilder addSibling(String siblingTagName){ + + + return null; + + } + public TagBuilder setAttribute(String name, String value){ + + return null; + } + public TagBuilder setText(String value){ + + return null; + } + public String toXML(){ + return null; + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagBuilderTest.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagBuilderTest.java new file mode 100644 index 0000000000..e30d20285b --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagBuilderTest.java @@ -0,0 +1,40 @@ +package com.coderising.dp.builder; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class TagBuilderTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testToXML() { + + TagBuilder builder = new TagBuilder("order"); + + String xml = builder.addChild("line-items") + .addChild("line-item").setAttribute("pid", "P3677").setAttribute("qty", "3") + .addSibling("line-item").setAttribute("pid", "P9877").setAttribute("qty", "10") + .toXML(); + + String expected = "" + + "" + + "" + + "" + + "" + + ""; + + System.out.println(xml); + assertEquals(expected, xml); + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagNode.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagNode.java new file mode 100644 index 0000000000..7763ee9d0a --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/builder/TagNode.java @@ -0,0 +1,82 @@ +package com.coderising.dp.builder; + +import java.util.ArrayList; +import java.util.List; + +public class TagNode { + private String tagName; + private String tagValue; + private List children = new ArrayList<>(); + private List attributes = new ArrayList<>(); + + public TagNode(String name){ + this.tagName = name; + } + public void add(TagNode child){ + this.children.add(child); + } + public void setAttribute(String name, String value) { + Attribute attr = findAttribute(name); + if(attr != null){ + attr.value = value; + } + + attributes.add(new Attribute(name,value)); + } + private Attribute findAttribute(String name){ + for(Attribute attr : attributes){ + if(attr.name.equals(name)){ + return attr; + } + } + return null; + } + public void setValue(String value) { + this.tagValue = value; + + } + public String getTagName() { + return tagName; + } + public List getChildren() { + return children; + } + + private static class Attribute{ + public Attribute(String name, String value) { + this.name = name; + this.value = value; + } + String name; + String value; + + } + public String toXML(){ + return toXML(this); + } + private String toXML(TagNode node){ + StringBuilder buffer = new StringBuilder(); + buffer.append("<").append(node.tagName); + if(node.attributes.size()> 0){ + for(int i=0;i"); + return buffer.toString(); + } + buffer.append(">"); + for(TagNode childNode : node.children){ + buffer.append(toXML(childNode)); + } + buffer.append(""); + + + return buffer.toString(); + } + private String toXML(Attribute attr){ + return attr.name+"=\""+attr.value + "\""; + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java new file mode 100644 index 0000000000..064de1e837 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/Email.java @@ -0,0 +1,6 @@ +package com.coderising.dp.decorator; + +public interface Email { + public String getContent(); +} + diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java new file mode 100644 index 0000000000..d5379b0dd9 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailDecorator.java @@ -0,0 +1,5 @@ +package com.coderising.dp.decorator; + +public abstract class EmailDecorator implements Email{ + +} \ No newline at end of file diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java new file mode 100644 index 0000000000..640aef6da3 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/dp/decorator/EmailImpl.java @@ -0,0 +1,12 @@ +package com.coderising.dp.decorator; + +public class EmailImpl implements Email { + private String content; + + public EmailImpl(String content) { + this.content = content; + } + public String getContent() { + return content; + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/ood/srp/good1/MailSender.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/ood/srp/good1/MailSender.java index 0503d1a88b..ffd0543e22 100644 --- a/liuxin/ood/ood-assignment/src/main/java/com/coderising/ood/srp/good1/MailSender.java +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/ood/srp/good1/MailSender.java @@ -1,5 +1,6 @@ package com.coderising.ood.srp.good1; + public class MailSender { private String fromAddress ; diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt b/liuxin/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt index 0c0124cc61..618f02b102 100644 --- a/liuxin/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt @@ -1,3 +1,8 @@ + + + + + P8756 iPhone8 P3946 XiaoMi10 P8904 Oppo_R15 diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/PayrollService.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/PayrollService.java new file mode 100644 index 0000000000..b0b4fec82f --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/PayrollService.java @@ -0,0 +1,49 @@ +package com.coderising.payroll; + +import java.util.List; + +import com.coderising.payroll.classification.CommissionedClassification; +import com.coderising.payroll.classification.HourlyClassification; +import com.coderising.payroll.classification.SalariedClassification; +import com.coderising.payroll.domain.Employee; +import com.coderising.payroll.domain.HoldMethod; +import com.coderising.payroll.domain.Paycheck; +import com.coderising.payroll.schedule.BiweeklySchedule; +import com.coderising.payroll.schedule.MonthlySchedule; +import com.coderising.payroll.schedule.WeeklySchedule; + +public class PayrollService { + public List getAllEmployees(){ + return null; + } + public void savePaycheck(Paycheck pc){ + + } + + public Employee addHourlyEmployee(String name, String address, double hourlyRate){ + Employee e = new Employee(name, address); + e.setClassification(new HourlyClassification(hourlyRate)); + e.setSchedule(new WeeklySchedule()); + e.setPaymentMethod(new HoldMethod()); + //保存员工到数据库.. 略 + return e; + } + + public Employee addSalariedEmployee(String name, String address, double salary){ + Employee e = new Employee(name, address); + e.setClassification(new SalariedClassification(salary)); + e.setSchedule(new MonthlySchedule()); + e.setPaymentMethod(new HoldMethod()); + //保存员工到数据库.. 略 + return e; + } + + public Employee addCommissionedEmployee(String name, String address, double salary, double saleRate){ + Employee e = new Employee(name, address); + e.setClassification(new CommissionedClassification(salary, saleRate)); + e.setSchedule(new BiweeklySchedule()); + e.setPaymentMethod(new HoldMethod()); + //保存员工到数据库.. 略 + return e; + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/affiliation/NonAffiliation.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/affiliation/NonAffiliation.java new file mode 100644 index 0000000000..3cb6228aa4 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/affiliation/NonAffiliation.java @@ -0,0 +1,10 @@ +package com.coderising.payroll.affiliation; + +import com.coderising.payroll.domain.Affiliation; +import com.coderising.payroll.domain.Paycheck; + +public class NonAffiliation implements Affiliation{ + public double calculateDeductions(Paycheck pc){ + return 0.0; + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/affiliation/UnionAffiliation.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/affiliation/UnionAffiliation.java new file mode 100644 index 0000000000..bbce4fa317 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/affiliation/UnionAffiliation.java @@ -0,0 +1,14 @@ +package com.coderising.payroll.affiliation; + +import com.coderising.payroll.domain.Affiliation; +import com.coderising.payroll.domain.Paycheck; + +public class UnionAffiliation implements Affiliation { + + @Override + public double calculateDeductions(Paycheck pc) { + + return 0; + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/CommissionedClassification.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/CommissionedClassification.java new file mode 100644 index 0000000000..f6a7ab4a63 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/CommissionedClassification.java @@ -0,0 +1,31 @@ +package com.coderising.payroll.classification; + +import java.util.Date; +import java.util.Map; + +import com.coderising.payroll.domain.Paycheck; +import com.coderising.payroll.domain.PaymentClassification; +import com.coderising.payroll.domain.SalesReceipt; +import com.coderising.payroll.util.DateUtil; + +public class CommissionedClassification implements PaymentClassification { + double salary; + double rate; + public CommissionedClassification(double salary , double rate){ + this.salary = salary; + this.rate = rate; + } + Map receipts; + @Override + public double calculatePay(Paycheck pc) { + double commission = 0.0; + for(SalesReceipt sr : receipts.values()){ + if(DateUtil.between(sr.getSaleDate(), pc.getPayPeriodStartDate(), + pc.getPayPeriodEndDate())){ + commission += sr.getAmount() * rate; + } + } + return salary + commission; + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/HourlyClassification.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/HourlyClassification.java new file mode 100644 index 0000000000..1238ac84a6 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/HourlyClassification.java @@ -0,0 +1,43 @@ +package com.coderising.payroll.classification; + +import java.util.Date; +import java.util.Map; + +import com.coderising.payroll.domain.Paycheck; +import com.coderising.payroll.domain.PaymentClassification; +import com.coderising.payroll.domain.TimeCard; +import com.coderising.payroll.util.DateUtil; + +public class HourlyClassification implements PaymentClassification { + private double rate; + private Map timeCards; + + public HourlyClassification(double hourlyRate) { + this.rate = hourlyRate; + } + public void addTimeCard(TimeCard tc){ + timeCards.put(tc.getDate(), tc); + } + @Override + public double calculatePay(Paycheck pc) { + double totalPay = 0; + for(TimeCard tc : timeCards.values()){ + if(DateUtil.between(tc.getDate(), pc.getPayPeriodStartDate(), + pc.getPayPeriodEndDate())){ + totalPay += calculatePayForTimeCard(tc); + } + } + return totalPay; + + } + private double calculatePayForTimeCard(TimeCard tc) { + int hours = tc.getHours(); + + if(hours > 8){ + return 8*rate + (hours-8) * rate * 1.5; + } else{ + return 8*rate; + } + } +} + diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/SalariedClassification.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/SalariedClassification.java new file mode 100644 index 0000000000..796aae93f1 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/classification/SalariedClassification.java @@ -0,0 +1,16 @@ +package com.coderising.payroll.classification; + +import com.coderising.payroll.domain.Paycheck; +import com.coderising.payroll.domain.PaymentClassification; + +public class SalariedClassification implements PaymentClassification { + private double salary; + public SalariedClassification(double salary){ + this.salary = salary; + } + @Override + public double calculatePay(Paycheck pc) { + return salary; + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Affiliation.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Affiliation.java new file mode 100644 index 0000000000..74a6b404bc --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Affiliation.java @@ -0,0 +1,5 @@ +package com.coderising.payroll.domain; + +public interface Affiliation { + public double calculateDeductions(Paycheck pc); +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Employee.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Employee.java new file mode 100644 index 0000000000..204180a672 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Employee.java @@ -0,0 +1,48 @@ +package com.coderising.payroll.domain; + +import java.util.Date; + +public class Employee { + private String id; + private String name; + private String address; + private Affiliation affiliation; + + + private PaymentClassification classification; + private PaymentSchedule schedule; + private PaymentMethod paymentMethod; + + public Employee(String name, String address){ + this.name = name; + this.address = address; + } + public boolean isPayDay(Date d) { + return this.schedule.isPayDate(d); + } + + public Date getPayPeriodStartDate(Date d) { + return this.schedule.getPayPeriodStartDate(d); + } + + public void payDay(Paycheck pc){ + double grossPay = classification.calculatePay(pc); + double deductions = affiliation.calculateDeductions(pc); + double netPay = grossPay - deductions; + pc.setGrossPay(grossPay); + pc.setDeductions(deductions); + pc.setNetPay(netPay); + paymentMethod.pay(pc); + } + + public void setClassification(PaymentClassification classification) { + this.classification = classification; + } + public void setSchedule(PaymentSchedule schedule) { + this.schedule = schedule; + } + public void setPaymentMethod(PaymentMethod paymentMethod) { + this.paymentMethod = paymentMethod; + } +} + diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/HoldMethod.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/HoldMethod.java new file mode 100644 index 0000000000..0ce19e2291 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/HoldMethod.java @@ -0,0 +1,11 @@ +package com.coderising.payroll.domain; + +public class HoldMethod implements PaymentMethod { + + @Override + public void pay(Paycheck pc) { + + + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Paycheck.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Paycheck.java new file mode 100644 index 0000000000..6f1ff99413 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/Paycheck.java @@ -0,0 +1,35 @@ +package com.coderising.payroll.domain; + +import java.util.Date; +import java.util.Map; + +public class Paycheck { + private Date payPeriodStart; + private Date payPeriodEnd; + private double grossPay; + private double netPay; + private double deductions; + private Map itsFields; + public Paycheck(Date payPeriodStart, Date payPeriodEnd){ + this.payPeriodStart = payPeriodStart; + this.payPeriodEnd = payPeriodEnd; + } + public void setGrossPay(double grossPay) { + this.grossPay = grossPay; + + } + public void setDeductions(double deductions) { + this.deductions = deductions; + } + public void setNetPay(double netPay){ + this.netPay = netPay; + } + public Date getPayPeriodEndDate() { + + return this.payPeriodEnd; + } + public Date getPayPeriodStartDate() { + + return this.payPeriodStart; + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaydayTransaction.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaydayTransaction.java new file mode 100644 index 0000000000..e066e46263 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaydayTransaction.java @@ -0,0 +1,23 @@ +package com.coderising.payroll.domain; + +import java.util.Date; +import java.util.List; + +import com.coderising.payroll.PayrollService; + +public class PaydayTransaction { + private Date date; + private PayrollService payrollService; + + public void execute(){ + List employees = payrollService.getAllEmployees(); + for(Employee e : employees){ + if(e.isPayDay(date)){ + Paycheck pc = new Paycheck(e.getPayPeriodStartDate(date),date); + e.payDay(pc); + payrollService.savePaycheck(pc); + } + } + } +} + diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentClassification.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentClassification.java new file mode 100644 index 0000000000..b6f2120bdb --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentClassification.java @@ -0,0 +1,5 @@ +package com.coderising.payroll.domain; + +public interface PaymentClassification { + public double calculatePay(Paycheck pc); +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentMethod.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentMethod.java new file mode 100644 index 0000000000..f07cc5354b --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentMethod.java @@ -0,0 +1,5 @@ +package com.coderising.payroll.domain; + +public interface PaymentMethod { + public void pay(Paycheck pc); +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/PaymentSchedule.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentSchedule.java similarity index 80% rename from liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/PaymentSchedule.java rename to liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentSchedule.java index 500d72404d..96788f4f80 100644 --- a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/PaymentSchedule.java +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/PaymentSchedule.java @@ -1,4 +1,4 @@ -package com.coderising.payroll; +package com.coderising.payroll.domain; import java.util.Date; diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/SalesReceipt.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/SalesReceipt.java new file mode 100644 index 0000000000..a7b0ba41ad --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/SalesReceipt.java @@ -0,0 +1,14 @@ +package com.coderising.payroll.domain; + +import java.util.Date; + +public class SalesReceipt { + private Date saleDate; + private double amount; + public Date getSaleDate() { + return saleDate; + } + public double getAmount() { + return amount; + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/TimeCard.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/TimeCard.java new file mode 100644 index 0000000000..ebf6e17a4c --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/domain/TimeCard.java @@ -0,0 +1,15 @@ +package com.coderising.payroll.domain; + +import java.util.Date; + +public class TimeCard { + private Date date; + private int hours; + + public Date getDate() { + return date; + } + public int getHours() { + return hours; + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/BiweeklySchedule.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/BiweeklySchedule.java new file mode 100644 index 0000000000..35ec65c49c --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/BiweeklySchedule.java @@ -0,0 +1,38 @@ +package com.coderising.payroll.schedule; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.coderising.payroll.domain.PaymentSchedule; +import com.coderising.payroll.util.DateUtil; + +public class BiweeklySchedule implements PaymentSchedule { + Date firstPayableFriday = DateUtil.parseDate("2017-6-2"); + + @Override + public boolean isPayDate(Date date) { + + long interval = DateUtil.getDaysBetween(firstPayableFriday, date); + return interval % 14 == 0; + } + + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.add(payPeriodEndDate, -13); + + } + + public static void main(String [] args) throws Exception{ + BiweeklySchedule schedule = new BiweeklySchedule(); + + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); + Date d = sdf.parse("2017-06-30"); + + System.out.println(schedule.isPayDate(d)); + + System.out.println(DateUtil.isFriday(d)); + + System.out.println(schedule.getPayPeriodStartDate(d)); + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/MonthlySchedule.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/MonthlySchedule.java new file mode 100644 index 0000000000..dbbe732d2f --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/MonthlySchedule.java @@ -0,0 +1,20 @@ +package com.coderising.payroll.schedule; + +import java.util.Date; + +import com.coderising.payroll.domain.PaymentSchedule; +import com.coderising.payroll.util.DateUtil; + +public class MonthlySchedule implements PaymentSchedule { + + @Override + public boolean isPayDate(Date date) { + return DateUtil.isLastDayOfMonth(date); + } + + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.getFirstDay(payPeriodEndDate); + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/WeeklySchedule.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/WeeklySchedule.java new file mode 100644 index 0000000000..54a22ab7db --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/schedule/WeeklySchedule.java @@ -0,0 +1,19 @@ +package com.coderising.payroll.schedule; + +import java.util.Date; + +import com.coderising.payroll.domain.PaymentSchedule; +import com.coderising.payroll.util.DateUtil; + +public class WeeklySchedule implements PaymentSchedule { + + @Override + public boolean isPayDate(Date date) { + return DateUtil.isFriday(date); + } + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.add(payPeriodEndDate, -6); + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/transaction/AddEmployeeTransaction.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/transaction/AddEmployeeTransaction.java new file mode 100644 index 0000000000..39b268486b --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/transaction/AddEmployeeTransaction.java @@ -0,0 +1,29 @@ +package com.coderising.payroll.transaction; + +import com.coderising.payroll.domain.Employee; +import com.coderising.payroll.domain.HoldMethod; +import com.coderising.payroll.domain.PaymentClassification; +import com.coderising.payroll.domain.PaymentMethod; +import com.coderising.payroll.domain.PaymentSchedule; + +public abstract class AddEmployeeTransaction { + private String name; + private String address; + public AddEmployeeTransaction(String name,String address){ + this.name = name; + this.address = address; + } + public abstract PaymentClassification getClassification(); + public abstract PaymentSchedule getSchedule(); + + public void execute(){ + PaymentClassification pc = getClassification(); + PaymentSchedule ps = getSchedule(); + PaymentMethod pm = new HoldMethod(); + Employee e = new Employee(name, address); + e.setClassification(pc); + e.setSchedule(ps); + e.setPaymentMethod(pm); + //保存到数据库, 略 + } +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/transaction/AddHourlyEmployeeTransaction.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/transaction/AddHourlyEmployeeTransaction.java new file mode 100644 index 0000000000..2039734479 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/transaction/AddHourlyEmployeeTransaction.java @@ -0,0 +1,25 @@ +package com.coderising.payroll.transaction; + +import com.coderising.payroll.classification.HourlyClassification; +import com.coderising.payroll.domain.PaymentClassification; +import com.coderising.payroll.domain.PaymentSchedule; +import com.coderising.payroll.schedule.WeeklySchedule; + +public class AddHourlyEmployeeTransaction extends AddEmployeeTransaction{ + private double rate; + AddHourlyEmployeeTransaction(String name, String address, double hourlyRate) { + super(name, address); + this.rate = hourlyRate; + } + @Override + public PaymentClassification getClassification() { + return new HourlyClassification(rate); + } + + @Override + public PaymentSchedule getSchedule() { + + return new WeeklySchedule(); + } +} + diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/util/DateUtil.java b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/util/DateUtil.java new file mode 100644 index 0000000000..ffc26f31a1 --- /dev/null +++ b/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/util/DateUtil.java @@ -0,0 +1,56 @@ +package com.coderising.payroll.util; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +public class DateUtil { + public static long getDaysBetween(Date d1, Date d2){ + + return (d2.getTime() - d1.getTime())/(24*60*60*1000); + } + + public static Date parseDate(String txtDate){ + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); + try { + return sdf.parse(txtDate); + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + public static boolean isFriday(Date d){ + Calendar calendar = Calendar.getInstance(); + return calendar.get(Calendar.DAY_OF_WEEK) == 5; + } + + public static Date add(Date d, int days){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(d); + calendar.add(Calendar.DATE, days); + return calendar.getTime(); + } + + public static boolean isLastDayOfMonth(Date d){ + Calendar calendar=Calendar.getInstance(); + calendar.setTime(d); + return calendar.get(Calendar.DATE)==calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + } + public static Date getFirstDay(Date d){ + Calendar calendar=Calendar.getInstance(); + calendar.setTime(d); + int day = calendar.get(Calendar.DATE); + calendar.add(Calendar.DATE, -(day-1)); + return calendar.getTime(); + } + public static void main(String [] args) throws Exception{ + System.out.println(DateUtil.isLastDayOfMonth(DateUtil.parseDate("2017-6-29"))); + + System.out.println(DateUtil.getFirstDay(DateUtil.parseDate("2017-6-30"))); + } + + public static boolean between(Date d, Date date1, Date date2){ + return d.after(date1) && d.before(date2); + } +} diff --git a/shopping.png b/shopping.png new file mode 100644 index 0000000000..6ef672f5f9 Binary files /dev/null and b/shopping.png differ diff --git a/students/1072760797/src/com/coderising/ood/ocp/DateUtil.java b/students/1072760797/src/com/coderising/ood/ocp/DateUtil.java new file mode 100644 index 0000000000..b6cf28c096 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/DateUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return null; + } + +} diff --git a/students/1072760797/src/com/coderising/ood/ocp/Logger.java b/students/1072760797/src/com/coderising/ood/ocp/Logger.java new file mode 100644 index 0000000000..b89d355fef --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/Logger.java @@ -0,0 +1,17 @@ +package com.coderising.ood.ocp; + +public abstract class Logger { + + + public void log(String msg){ + + setMsg(msg); + + sendMsg(msg); + } + + public abstract void setMsg(String msg); + public abstract void sendMsg(String logMsg); + +} + diff --git a/students/1072760797/src/com/coderising/ood/ocp/MailUtil.java b/students/1072760797/src/com/coderising/ood/ocp/MailUtil.java new file mode 100644 index 0000000000..ec54b839c5 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/MailUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/1072760797/src/com/coderising/ood/ocp/RAW_Logger.java b/students/1072760797/src/com/coderising/ood/ocp/RAW_Logger.java new file mode 100644 index 0000000000..c3e684e735 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/RAW_Logger.java @@ -0,0 +1,18 @@ +package com.coderising.ood.ocp; + +public class RAW_Logger extends Logger { + + @Override + public void setMsg(String msg) { + // TODO Auto-generated method stub + String logMsg = msg; + logMsg = msg; + } + + @Override + public void sendMsg(String logMsg) { + // TODO Auto-generated method stub + MailUtil.send(logMsg); + } + +} diff --git a/students/1072760797/src/com/coderising/ood/ocp/SMSUtil.java b/students/1072760797/src/com/coderising/ood/ocp/SMSUtil.java new file mode 100644 index 0000000000..13cf802418 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/SMSUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class SMSUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/1072760797/src/com/coderising/ood/ocp/good/Formatter.java b/students/1072760797/src/com/coderising/ood/ocp/good/Formatter.java new file mode 100644 index 0000000000..b6e2ccbc16 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/good/Formatter.java @@ -0,0 +1,7 @@ +package com.coderising.ood.ocp.good; + +public interface Formatter { + + String format(String msg); + +} diff --git a/students/1072760797/src/com/coderising/ood/ocp/good/FormatterFactory.java b/students/1072760797/src/com/coderising/ood/ocp/good/FormatterFactory.java new file mode 100644 index 0000000000..3c2009a674 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/good/FormatterFactory.java @@ -0,0 +1,13 @@ +package com.coderising.ood.ocp.good; + +public class FormatterFactory { + public static Formatter createFormatter(int type){ + if(type == 1){ + return new RawFormatter(); + } + if (type == 2){ + return new HtmlFormatter(); + } + return null; + } +} diff --git a/students/1072760797/src/com/coderising/ood/ocp/good/HtmlFormatter.java b/students/1072760797/src/com/coderising/ood/ocp/good/HtmlFormatter.java new file mode 100644 index 0000000000..3d375f5acc --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/good/HtmlFormatter.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.good; + +public class HtmlFormatter implements Formatter { + + @Override + public String format(String msg) { + + return null; + } + +} diff --git a/students/1072760797/src/com/coderising/ood/ocp/good/Logger.java b/students/1072760797/src/com/coderising/ood/ocp/good/Logger.java new file mode 100644 index 0000000000..f206472d0d --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/good/Logger.java @@ -0,0 +1,18 @@ +package com.coderising.ood.ocp.good; + +public class Logger { + + private Formatter formatter; + private Sender sender; + + public Logger(Formatter formatter,Sender sender){ + this.formatter = formatter; + this.sender = sender; + } + public void log(String msg){ + sender.send(formatter.format(msg)) ; + } + + +} + diff --git a/students/1072760797/src/com/coderising/ood/ocp/good/RawFormatter.java b/students/1072760797/src/com/coderising/ood/ocp/good/RawFormatter.java new file mode 100644 index 0000000000..7f1cb4ae30 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/good/RawFormatter.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.good; + +public class RawFormatter implements Formatter { + + @Override + public String format(String msg) { + + return null; + } + +} diff --git a/students/1072760797/src/com/coderising/ood/ocp/good/Sender.java b/students/1072760797/src/com/coderising/ood/ocp/good/Sender.java new file mode 100644 index 0000000000..aaa46c1fb7 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/ocp/good/Sender.java @@ -0,0 +1,7 @@ +package com.coderising.ood.ocp.good; + +public interface Sender { + + void send(String msg); + +} diff --git a/students/1072760797/src/com/coderising/ood/srp/Configuration.java b/students/1072760797/src/com/coderising/ood/srp/Configuration.java new file mode 100644 index 0000000000..c458c8774a --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/Configuration.java @@ -0,0 +1,58 @@ +package com.coderising.ood.srp; +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + private static Map configurations = new HashMap<>(); + private static String smtpHost; + private static String altSmtpHost; + private static String fromAddress; + static{ + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * @param key + * @return + */ + public Configuration(){ + setSMTPHost(); + setAltSMTPHost(); + setFromAddress(); + } + public String getProperty(String key) { + + return configurations.get(key); + } + + protected void setSMTPHost() + { + smtpHost = this.getProperty(ConfigurationKeys.SMTP_SERVER); + } + + protected void setAltSMTPHost() + { + altSmtpHost = this.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + + } + + protected void setFromAddress() + { + fromAddress = this.getProperty(ConfigurationKeys.EMAIL_ADMIN); + } + + public static String getSmtpHost() { + return smtpHost; + } + public static String getAltSmtpHost() { + return altSmtpHost; + } + public static String getFromAddress() { + return fromAddress; + } + + +} diff --git a/students/1072760797/src/com/coderising/ood/srp/ConfigurationKeys.java b/students/1072760797/src/com/coderising/ood/srp/ConfigurationKeys.java new file mode 100644 index 0000000000..8695aed644 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/ConfigurationKeys.java @@ -0,0 +1,9 @@ +package com.coderising.ood.srp; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + +} diff --git a/students/1072760797/src/com/coderising/ood/srp/ConfigureEmail.java b/students/1072760797/src/com/coderising/ood/srp/ConfigureEmail.java new file mode 100644 index 0000000000..87af1e42db --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/ConfigureEmail.java @@ -0,0 +1,58 @@ +package com.coderising.ood.srp; + +import java.io.IOException; +import java.util.HashMap; + +public class ConfigureEmail { + + private static final String NAME_KEY = "NAME"; + private static final String EMAIL_KEY = "EMAIL"; + + private Configuration config = null; + private EmailBean email = new EmailBean(); + private Product product; + + private String message; + private String subject; + private String toAddress; + + public ConfigureEmail(Configuration config, Product product, + HashMap userInfo) { + + this.config = config; + this.product = product; + + setMessage(userInfo); + setToAddress(userInfo); + + setBean(); + + } + + private void setBean() { + + email.setFromAddress(config.getFromAddress()); + email.setMessage(message); + email.setSmtpHost(config.getSmtpHost()); + email.setSubject(subject); + email.setToAddress(toAddress); + } + + public EmailBean getEmail() { + return email; + } + + public void setMessage(HashMap userInfo) { + + String name = (String) userInfo.get(NAME_KEY); + + subject = "您关注的产品降价了"; + message = "尊敬的 " + name + ", 您关注的产品 " + product.getProductDesc() + + " 降价了,欢迎购买!"; + } + + protected void setToAddress(HashMap userInfo) { + toAddress = (String) userInfo.get(EMAIL_KEY); + } + +} diff --git a/students/1072760797/src/com/coderising/ood/srp/DBUtil.java b/students/1072760797/src/com/coderising/ood/srp/DBUtil.java new file mode 100644 index 0000000000..7597905da1 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/DBUtil.java @@ -0,0 +1,27 @@ +package com.coderising.ood.srp; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class DBUtil { + + /** + * 应该从数据库读, 但是简化为直接生成。 + * + * @param sql + * @return + */ + public static List query(String sql) { + + List userList = new ArrayList(); + for (int i = 1; i <= 3; i++) { + HashMap userInfo = new HashMap(); + userInfo.put("NAME", "User" + i); + userInfo.put("EMAIL", "aa@bb.com"); + userList.add(userInfo); + } + + return userList; + } +} diff --git a/students/1072760797/src/com/coderising/ood/srp/EmailBean.java b/students/1072760797/src/com/coderising/ood/srp/EmailBean.java new file mode 100644 index 0000000000..d5923b9f28 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/EmailBean.java @@ -0,0 +1,50 @@ +package com.coderising.ood.srp; + +public class EmailBean { + private String toAddress; + private String fromAddress; + private String subject; + private String message; + private String smtpHost; + + public String getToAddress() { + return toAddress; + } + + public void setToAddress(String toAddress) { + this.toAddress = toAddress; + } + + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getSmtpHost() { + return smtpHost; + } + + public void setSmtpHost(String smtpHost) { + this.smtpHost = smtpHost; + } + +} diff --git a/students/1072760797/src/com/coderising/ood/srp/MailUtil.java b/students/1072760797/src/com/coderising/ood/srp/MailUtil.java new file mode 100644 index 0000000000..508a11f3d8 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/MailUtil.java @@ -0,0 +1,24 @@ +package com.coderising.ood.srp; + +public class MailUtil { + + public static void sendEmail(String toAddress, String fromAddress, + String subject, String message, String smtpHost, boolean debug) { + // 假装发了一封邮件 + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(toAddress).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(message).append("\n"); + System.out.println(buffer.toString()); + + } + + public static void sendEmail(EmailBean email, boolean debug) { + // TODO Auto-generated method stub + sendEmail(email.getToAddress(), email.getFromAddress(), + email.getSubject(), email.getMessage(), email.getSmtpHost(), + debug); + } + +} diff --git a/students/1072760797/src/com/coderising/ood/srp/MailingDao.java b/students/1072760797/src/com/coderising/ood/srp/MailingDao.java new file mode 100644 index 0000000000..cb5924f604 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/MailingDao.java @@ -0,0 +1,23 @@ +package com.coderising.ood.srp; + +import java.util.List; + +public class MailingDao { + + private String sendMailQuery; + public List getQuery(String productID) throws Exception { + + sendMailQuery = "Select name from subscriptions " + + "where product_id= '" + productID +"' " + + "and send_mail=1 "; + + + System.out.println("loadQuery set"); + + return loadMailingList(); + } + + private List loadMailingList() throws Exception { + return DBUtil.query(this.sendMailQuery); + } +} diff --git a/students/1072760797/src/com/coderising/ood/srp/Product.java b/students/1072760797/src/com/coderising/ood/srp/Product.java new file mode 100644 index 0000000000..7b5abd3c88 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/Product.java @@ -0,0 +1,62 @@ +package com.coderising.ood.srp; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +public class Product { + + private File file = null; + private String productID; + private String productDesc; + public Product(){} + public Product(File file) throws IOException{ + this.file = file; + //读取配置文件, 文件中只有一行用空格隔开, 例如 P8756 iPhone8 + readFile(file); + } + protected void readFile(File file) throws IOException // @02C + { + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(file)); + String temp = br.readLine(); + String[] data = temp.split(" "); + + setProductID(data[0]); + setProductDesc(data[1]); + + System.out.println("产品ID = " + productID + "\n"); + System.out.println("产品描述 = " + productDesc + "\n"); + + } catch (IOException e) { + throw new IOException(e.getMessage()); + } finally { + br.close(); + } + } + + public void setFile(File file) throws IOException { + this.file = file; + readFile(file); + } + public String getProductID() { + if(productID.isEmpty()){ + throw new RuntimeException("no productID"); + } + return productID; + } + public void setProductID(String productID) { + this.productID = productID; + } + public String getProductDesc() { + if(productDesc.isEmpty()){ + throw new RuntimeException("no productDesc"); + } + return productDesc; + } + public void setProductDesc(String productDesc) { + this.productDesc = productDesc; + } +} diff --git a/students/1072760797/src/com/coderising/ood/srp/PromotionMail.java b/students/1072760797/src/com/coderising/ood/srp/PromotionMail.java new file mode 100644 index 0000000000..b2713840e0 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/PromotionMail.java @@ -0,0 +1,77 @@ +package com.coderising.ood.srp; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +public class PromotionMail { + + List mailingList = null; + private static Configuration config; + + private Product product = null; + + public static void main(String[] args) throws Exception { + File f = new File("src/com/coderising/ood/srp/product_promotion.txt"); + boolean emailDebug = false; + + PromotionMail pe = new PromotionMail(f, emailDebug); + + } + + public PromotionMail(File file, boolean mailDebug) throws Exception { + + init(file, mailDebug); + + } + + private void init(File file, boolean mailDebug) throws Exception { + product = new Product(file); + config = new Configuration(); + MailingDao dao = new MailingDao(); + mailingList = dao.getQuery(product.getProductID()); + + sendEMails(mailDebug, mailingList); + + } + + protected void sendEMails(boolean debug, List mailingList) + throws IOException { + + System.out.println("开始发送邮件"); + + if (mailingList != null) { + Iterator iter = mailingList.iterator(); + while (iter.hasNext()) { + ConfigureEmail ce = new ConfigureEmail(config, product, + (HashMap) iter.next()); + EmailBean email = ce.getEmail(); + try { + if (email.getToAddress().length() > 0) + MailUtil.sendEmail(email, debug); + } catch (Exception e) { + + try { + MailUtil.sendEmail(email, debug); + + } catch (Exception e2) { + System.out.println("通过备用 SMTP服务器发送邮件失败: " + + e2.getMessage()); + } + } + } + + } + + else { + System.out.println("没有邮件发送"); + + } + + } +} diff --git a/students/1072760797/src/com/coderising/ood/srp/product_promotion.txt b/students/1072760797/src/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..b7a974adb3 --- /dev/null +++ b/students/1072760797/src/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/1158154002/src/main/java/com/coderising/payroll/AddCommissionEmployeeTransaction.java b/students/1158154002/src/main/java/com/coderising/payroll/AddCommissionEmployeeTransaction.java new file mode 100644 index 0000000000..45b30ab31b --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/AddCommissionEmployeeTransaction.java @@ -0,0 +1,28 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.AddEmployeeTransaction; +import com.coderising.payroll.api.Affiliation; +import com.coderising.payroll.api.PaymentClassification; +import com.coderising.payroll.api.PaymentMethod; +import com.coderising.payroll.api.PaymentSchedule; + +public class AddCommissionEmployeeTransaction extends AddEmployeeTransaction{ + private double rate; + private double salary; + public AddCommissionEmployeeTransaction(String name, String address, PaymentMethod paymentMethod, + Affiliation affiliation) { + super(name, address, paymentMethod, affiliation); + this.rate=rate; + } + + @Override + public PaymentClassification getClassification() { + return new CommissionClassification(rate,salary); + } + + @Override + public PaymentSchedule getSchedule() { + return new WeeklySchedule(); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/AddEmployeeTransaction.java b/students/1158154002/src/main/java/com/coderising/payroll/AddEmployeeTransaction.java new file mode 100644 index 0000000000..9a5ed30b31 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/AddEmployeeTransaction.java @@ -0,0 +1,37 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.Affiliation; +import com.coderising.payroll.api.PaymentClassification; +import com.coderising.payroll.api.PaymentMethod; +import com.coderising.payroll.api.PaymentSchedule; + +public abstract class AddEmployeeTransaction { + private String name; + private String address; + private PaymentMethod paymentMethod; + private Affiliation affiliation; + + + public AddEmployeeTransaction(String name, String address, PaymentMethod paymentMethod, Affiliation affiliation) { + super(); + this.name = name; + this.address = address; + this.paymentMethod = paymentMethod; + this.affiliation = affiliation; + } + + public abstract PaymentClassification getClassification(); + + public abstract PaymentSchedule getSchedule(); + + public void execute(){ + PaymentClassification pc=getClassification(); + PaymentSchedule ps=getSchedule(); + Employee e=new Employee(name, address); + e.setClassification(pc); + e.setSchedule(ps); + e.setPaymentMethod(paymentMethod); + e.setAffiliation(affiliation); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/AddHourlyEmployeeTransaction.java b/students/1158154002/src/main/java/com/coderising/payroll/AddHourlyEmployeeTransaction.java new file mode 100644 index 0000000000..c7b92eafd3 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/AddHourlyEmployeeTransaction.java @@ -0,0 +1,27 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.AddEmployeeTransaction; +import com.coderising.payroll.api.Affiliation; +import com.coderising.payroll.api.PaymentClassification; +import com.coderising.payroll.api.PaymentMethod; +import com.coderising.payroll.api.PaymentSchedule; + +public class AddHourlyEmployeeTransaction extends AddEmployeeTransaction{ + private double rate; + public AddHourlyEmployeeTransaction(String name, String address, PaymentMethod paymentMethod, + Affiliation affiliation) { + super(name, address, paymentMethod, affiliation); + this.rate=rate; + } + + @Override + public PaymentClassification getClassification() { + return new HourlyClassification(rate); + } + + @Override + public PaymentSchedule getSchedule() { + return new WeeklySchedule(); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/AddSalariedEmployeeTransaction.java b/students/1158154002/src/main/java/com/coderising/payroll/AddSalariedEmployeeTransaction.java new file mode 100644 index 0000000000..4edfbd0d1e --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/AddSalariedEmployeeTransaction.java @@ -0,0 +1,27 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.AddEmployeeTransaction; +import com.coderising.payroll.api.Affiliation; +import com.coderising.payroll.api.PaymentClassification; +import com.coderising.payroll.api.PaymentMethod; +import com.coderising.payroll.api.PaymentSchedule; + +public class AddSalariedEmployeeTransaction extends AddEmployeeTransaction{ + private double salary; + public AddSalariedEmployeeTransaction(String name, String address, PaymentMethod paymentMethod, + Affiliation affiliation) { + super(name, address, paymentMethod, affiliation); + this.salary=salary; + } + + @Override + public PaymentClassification getClassification() { + return new SalariedClassification(salary); + } + + @Override + public PaymentSchedule getSchedule() { + return new MonthlySchedule(); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/BankMethod.java b/students/1158154002/src/main/java/com/coderising/payroll/BankMethod.java new file mode 100644 index 0000000000..2a37417717 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/BankMethod.java @@ -0,0 +1,15 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.PaymentMethod; + +public class BankMethod implements PaymentMethod{ + + private String bank; + private String account; + + @Override + public void pay(Paycheck pc) { + System.out.println("BankMethod"); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/BiWeeklySchedule.java b/students/1158154002/src/main/java/com/coderising/payroll/BiWeeklySchedule.java new file mode 100644 index 0000000000..39ab695425 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/BiWeeklySchedule.java @@ -0,0 +1,22 @@ +package com.coderising.payroll; + +import java.util.Date; + +import com.coderising.payroll.api.PaymentSchedule; +import com.coderising.payroll.util.DateUtil; + +public class BiWeeklySchedule implements PaymentSchedule { + Date firstPayableFriday = DateUtil.parseDate("2017-06-02"); + + @Override + public boolean isPayDate(Date date) { + int interval = DateUtil.getDaysBetween(firstPayableFriday, date); + return interval % 14 == 0; + } + + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.add(payPeriodEndDate, -13); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/CommissionClassification.java b/students/1158154002/src/main/java/com/coderising/payroll/CommissionClassification.java new file mode 100644 index 0000000000..758e5e8ba8 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/CommissionClassification.java @@ -0,0 +1,34 @@ +package com.coderising.payroll; + +import java.util.Date; +import java.util.Map; + +import com.coderising.payroll.api.PaymentClassification; +import com.coderising.payroll.util.DateUtil; + +public class CommissionClassification implements PaymentClassification{ + private double salary; + private double rate; + private Map receipts; + + public CommissionClassification(double rate, double salary) { + this.rate=rate; + this.salary=salary; + } + + public void addSalesReceipt(SalesReceipt sr) { + receipts.put(sr.getSaleDate(), sr); + } + + @Override + public double calculatePay(Paycheck pc) { + double commission=0; + for (SalesReceipt sr : receipts.values()) { + if (DateUtil.between(sr.getSaleDate(), pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate())) { + commission+=sr.getAmount()*rate; + } + } + return salary+commission; + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/Employee.java b/students/1158154002/src/main/java/com/coderising/payroll/Employee.java new file mode 100644 index 0000000000..45f503ab4a --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/Employee.java @@ -0,0 +1,55 @@ +package com.coderising.payroll; + +import java.util.Date; + +import com.coderising.payroll.api.Affiliation; +import com.coderising.payroll.api.PaymentClassification; +import com.coderising.payroll.api.PaymentMethod; +import com.coderising.payroll.api.PaymentSchedule; + +public class Employee { + String id; + String name; + String address; + + Affiliation affiliation; + PaymentClassification classification; + PaymentSchedule schedule; + PaymentMethod paymentMethod; + + public Employee(String name, String address){ + this.name = name; + this.address = address; + } + public boolean isPayDay(Date d) { + return schedule.isPayDate(d); + } + + public Date getPayPeriodStartDate(Date d) { + return schedule.getPayPeriodStartDate(d); + } + + public void payDay(Paycheck pc){ + double grossPay=classification.calculatePay(pc); + double deductions=affiliation.calculateDeductions(pc); + double netPay=grossPay-deductions; + pc.setGrossPay(grossPay); + pc.setDeductions(deductions); + pc.setNetPay(netPay); + paymentMethod.pay(pc); + } + + public void setClassification(PaymentClassification classification) { + this.classification = classification; + } + public void setSchedule(PaymentSchedule schedule) { + this.schedule = schedule; + } + public void setPaymentMethod(PaymentMethod paymentMethod) { + this.paymentMethod = paymentMethod; + } + + public void setAffiliation(Affiliation affiliation) { + this.affiliation = affiliation; + } +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/HoldMethod.java b/students/1158154002/src/main/java/com/coderising/payroll/HoldMethod.java new file mode 100644 index 0000000000..ec0892eb6a --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/HoldMethod.java @@ -0,0 +1,12 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.PaymentMethod; + +public class HoldMethod implements PaymentMethod{ + + @Override + public void pay(Paycheck pc) { + System.out.println("HoldMethod"); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/HourlyClassification.java b/students/1158154002/src/main/java/com/coderising/payroll/HourlyClassification.java new file mode 100644 index 0000000000..6d61cae25e --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/HourlyClassification.java @@ -0,0 +1,42 @@ +package com.coderising.payroll; + +import java.util.Date; +import java.util.Map; + +import com.coderising.payroll.api.PaymentClassification; +import com.coderising.payroll.util.DateUtil; + +public class HourlyClassification implements PaymentClassification { + + private double rate; + private Map timeCards; + + public HourlyClassification(double rate) { + this.rate=rate; + } + + public void addTimeCard(TimeCard tc) { + timeCards.put(tc.getDate(), tc); + } + + @Override + public double calculatePay(Paycheck pc) { + double totalPay = 0; + for (TimeCard tc : timeCards.values()) { + if (DateUtil.between(tc.getDate(), pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate())) { + totalPay+=calculatePayForTimeCard(tc); + } + } + return totalPay; + } + + private double calculatePayForTimeCard(TimeCard tc) { + int hours = tc.getHours(); + if (hours > 8) { + return 8 * rate + (hours - 8) * 1.5 * rate; + } else { + return 8 * rate; + } + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/MailMethod.java b/students/1158154002/src/main/java/com/coderising/payroll/MailMethod.java new file mode 100644 index 0000000000..8cbcf755e0 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/MailMethod.java @@ -0,0 +1,13 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.PaymentMethod; + +public class MailMethod implements PaymentMethod{ + private String address; + + @Override + public void pay(Paycheck pc) { + System.out.println("MailMethod"); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/MonthlySchedule.java b/students/1158154002/src/main/java/com/coderising/payroll/MonthlySchedule.java new file mode 100644 index 0000000000..4b96edd28e --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/MonthlySchedule.java @@ -0,0 +1,20 @@ +package com.coderising.payroll; + +import java.util.Date; + +import com.coderising.payroll.api.PaymentSchedule; +import com.coderising.payroll.util.DateUtil; + +public class MonthlySchedule implements PaymentSchedule{ + + @Override + public boolean isPayDate(Date date) { + return DateUtil.isLasyDayOfMonth(date); + } + + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.getFirstDay(payPeriodEndDate); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/NonAffiliation.java b/students/1158154002/src/main/java/com/coderising/payroll/NonAffiliation.java new file mode 100644 index 0000000000..ec8b6bc5a4 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/NonAffiliation.java @@ -0,0 +1,12 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.Affiliation; + +public class NonAffiliation implements Affiliation{ + + @Override + public double calculateDeductions(Paycheck pc) { + return 0; + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/Paycheck.java b/students/1158154002/src/main/java/com/coderising/payroll/Paycheck.java similarity index 95% rename from liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/Paycheck.java rename to students/1158154002/src/main/java/com/coderising/payroll/Paycheck.java index 802c8b5c45..5a7f0f87e0 100644 --- a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/Paycheck.java +++ b/students/1158154002/src/main/java/com/coderising/payroll/Paycheck.java @@ -1,35 +1,34 @@ -package com.coderising.payroll; - -import java.util.Date; -import java.util.Map; - -public class Paycheck { - private Date payPeriodStart; - private Date payPeriodEnd; - private double grossPay; - private double netPay; - private double deductions; - - public Paycheck(Date payPeriodStart, Date payPeriodEnd){ - this.payPeriodStart = payPeriodStart; - this.payPeriodEnd = payPeriodEnd; - } - public void setGrossPay(double grossPay) { - this.grossPay = grossPay; - - } - public void setDeductions(double deductions) { - this.deductions = deductions; - } - public void setNetPay(double netPay){ - this.netPay = netPay; - } - public Date getPayPeriodEndDate() { - - return this.payPeriodEnd; - } - public Date getPayPeriodStartDate() { - - return this.payPeriodStart; - } -} +package com.coderising.payroll; + +import java.util.Date; + +public class Paycheck { + private Date payPeriodStart; + private Date payPeriodEnd; + private double grossPay; + private double netPay; + private double deductions; + + public Paycheck(Date payPeriodStart, Date payPeriodEnd){ + this.payPeriodStart = payPeriodStart; + this.payPeriodEnd = payPeriodEnd; + } + public void setGrossPay(double grossPay) { + this.grossPay = grossPay; + + } + public void setDeductions(double deductions) { + this.deductions = deductions; + } + public void setNetPay(double netPay){ + this.netPay = netPay; + } + public Date getPayPeriodEndDate() { + + return this.payPeriodEnd; + } + public Date getPayPeriodStartDate() { + + return this.payPeriodStart; + } +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/SalariedClassification.java b/students/1158154002/src/main/java/com/coderising/payroll/SalariedClassification.java new file mode 100644 index 0000000000..8bc025e1d8 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/SalariedClassification.java @@ -0,0 +1,18 @@ +package com.coderising.payroll; + +import com.coderising.payroll.api.PaymentClassification; + +public class SalariedClassification implements PaymentClassification{ + private double salary; + + public SalariedClassification(double salary) { + this.salary=salary; + } + + @Override + public double calculatePay(Paycheck pc) { + // TODO Auto-generated method stub + return salary; + } + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/SalesReceipt.java b/students/1158154002/src/main/java/com/coderising/payroll/SalesReceipt.java similarity index 94% rename from liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/SalesReceipt.java rename to students/1158154002/src/main/java/com/coderising/payroll/SalesReceipt.java index fcd3b506fc..25bbcd81bc 100644 --- a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/SalesReceipt.java +++ b/students/1158154002/src/main/java/com/coderising/payroll/SalesReceipt.java @@ -1,14 +1,14 @@ -package com.coderising.payroll; - -import java.util.Date; - -public class SalesReceipt { - private Date saleDate; - private double amount; - public Date getSaleDate() { - return saleDate; - } - public double getAmount() { - return amount; - } -} +package com.coderising.payroll; + +import java.util.Date; + +public class SalesReceipt { + private Date saleDate; + private double amount; + public Date getSaleDate() { + return saleDate; + } + public double getAmount() { + return amount; + } +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/ServiceCharge.java b/students/1158154002/src/main/java/com/coderising/payroll/ServiceCharge.java new file mode 100644 index 0000000000..4630f71f17 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/ServiceCharge.java @@ -0,0 +1,22 @@ +package com.coderising.payroll; + +import java.util.Date; + +public class ServiceCharge { + private Date date; + private double amount; + public Date getDate() { + return date; + } + public void setDate(Date date) { + this.date = date; + } + public double getAmount() { + return amount; + } + public void setAmount(double amount) { + this.amount = amount; + } + + +} diff --git a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/TimeCard.java b/students/1158154002/src/main/java/com/coderising/payroll/TimeCard.java similarity index 93% rename from liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/TimeCard.java rename to students/1158154002/src/main/java/com/coderising/payroll/TimeCard.java index 735cc17ac1..0ee88399c5 100644 --- a/liuxin/ood/ood-assignment/src/main/java/com/coderising/payroll/TimeCard.java +++ b/students/1158154002/src/main/java/com/coderising/payroll/TimeCard.java @@ -1,15 +1,15 @@ -package com.coderising.payroll; - -import java.util.Date; - -public class TimeCard { - private Date date; - private int hours; - - public Date getDate() { - return date; - } - public int getHours() { - return hours; - } -} +package com.coderising.payroll; + +import java.util.Date; + +public class TimeCard { + private Date date; + private int hours; + + public Date getDate() { + return date; + } + public int getHours() { + return hours; + } +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/UnionAffiliation.java b/students/1158154002/src/main/java/com/coderising/payroll/UnionAffiliation.java new file mode 100644 index 0000000000..7505b585a8 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/UnionAffiliation.java @@ -0,0 +1,35 @@ +package com.coderising.payroll; + +import java.util.Date; +import java.util.Map; + +import com.coderising.payroll.api.Affiliation; +import com.coderising.payroll.util.DateUtil; + +public class UnionAffiliation implements Affiliation{ + private String memberID; + private double weeklyDue; + private Map serviceCharges; + + public void addServiceCharge(ServiceCharge sc){ + serviceCharges.put(sc.getDate(), sc); + } + + @Override + public double calculateDeductions(Paycheck pc) { + double totalPay = 0; + for (ServiceCharge sc : serviceCharges.values()) { + if (DateUtil.between(sc.getDate(), pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate())) { + totalPay+=sc.getAmount(); + } + } + return totalPay+calculatePayForWeeklyDue(pc); + } + + private double calculatePayForWeeklyDue(Paycheck pc) { + int interval=DateUtil.getDaysBetween( pc.getPayPeriodStartDate(),pc.getPayPeriodEndDate()); + return interval/7*weeklyDue; + } + + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/WeeklySchedule.java b/students/1158154002/src/main/java/com/coderising/payroll/WeeklySchedule.java new file mode 100644 index 0000000000..93e96d2412 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/WeeklySchedule.java @@ -0,0 +1,21 @@ +package com.coderising.payroll; + +import java.util.Date; + +import com.coderising.payroll.api.PaymentSchedule; +import com.coderising.payroll.util.DateUtil; + +public class WeeklySchedule implements PaymentSchedule{ + + @Override + public boolean isPayDate(Date date) { + + return DateUtil.isFriday(date); + } + + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.add(payPeriodEndDate, -6); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/api/AddEmployeeTransaction.java b/students/1158154002/src/main/java/com/coderising/payroll/api/AddEmployeeTransaction.java new file mode 100644 index 0000000000..8537092b94 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/api/AddEmployeeTransaction.java @@ -0,0 +1,34 @@ +package com.coderising.payroll.api; + +import com.coderising.payroll.Employee; + +public abstract class AddEmployeeTransaction { + private String name; + private String address; + private PaymentMethod paymentMethod; + private Affiliation affiliation; + + + public AddEmployeeTransaction(String name, String address, PaymentMethod paymentMethod, Affiliation affiliation) { + super(); + this.name = name; + this.address = address; + this.paymentMethod = paymentMethod; + this.affiliation = affiliation; + } + + public abstract PaymentClassification getClassification(); + + public abstract PaymentSchedule getSchedule(); + + public void execute(){ + PaymentClassification pc=getClassification(); + PaymentSchedule ps=getSchedule(); + Employee e=new Employee(name, address); + e.setClassification(pc); + e.setSchedule(ps); + e.setPaymentMethod(paymentMethod); + e.setAffiliation(affiliation); + } + +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/api/Affiliation.java b/students/1158154002/src/main/java/com/coderising/payroll/api/Affiliation.java new file mode 100644 index 0000000000..9a28cd1c46 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/api/Affiliation.java @@ -0,0 +1,7 @@ +package com.coderising.payroll.api; + +import com.coderising.payroll.Paycheck; + +public interface Affiliation { + public double calculateDeductions(Paycheck pc); +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentClassification.java b/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentClassification.java new file mode 100644 index 0000000000..66e1c6704f --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentClassification.java @@ -0,0 +1,7 @@ +package com.coderising.payroll.api; + +import com.coderising.payroll.Paycheck; + +public interface PaymentClassification { + public double calculatePay(Paycheck pc); +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentMethod.java b/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentMethod.java new file mode 100644 index 0000000000..2be20094b0 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentMethod.java @@ -0,0 +1,7 @@ +package com.coderising.payroll.api; + +import com.coderising.payroll.Paycheck; + +public interface PaymentMethod { + public void pay(Paycheck pc); +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentSchedule.java b/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentSchedule.java new file mode 100644 index 0000000000..520b6a2e98 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/api/PaymentSchedule.java @@ -0,0 +1,8 @@ +package com.coderising.payroll.api; + +import java.util.Date; + +public interface PaymentSchedule { + public boolean isPayDate(Date date); + public Date getPayPeriodStartDate( Date payPeriodEndDate); +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/package-info.java b/students/1158154002/src/main/java/com/coderising/payroll/package-info.java new file mode 100644 index 0000000000..149c6a9f42 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author Administrator + * + */ +package com.coderising.payroll; \ No newline at end of file diff --git a/students/1158154002/src/main/java/com/coderising/payroll/service/PayrollService.java b/students/1158154002/src/main/java/com/coderising/payroll/service/PayrollService.java new file mode 100644 index 0000000000..188bca74b0 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/service/PayrollService.java @@ -0,0 +1,29 @@ +package com.coderising.payroll.service; + +import java.util.Date; +import java.util.List; + +import com.coderising.payroll.Employee; +import com.coderising.payroll.Paycheck; + +public class PayrollService { + public List getAllEmployees(){ + return null; + } + + public void savePayCheck(Paycheck pc){} + + public static void main(String[] args) { + PayrollService payrollService=new PayrollService(); + Date date=new Date(); + List employees=payrollService.getAllEmployees(); + for (Employee e : employees) { + if (e.isPayDay(date)) { + Paycheck pc=new Paycheck(e.getPayPeriodStartDate(date), date); + e.payDay(pc); + payrollService.savePayCheck(pc); + } + } + + } +} diff --git a/students/1158154002/src/main/java/com/coderising/payroll/util/DateUtil.java b/students/1158154002/src/main/java/com/coderising/payroll/util/DateUtil.java new file mode 100644 index 0000000000..f2a3269b63 --- /dev/null +++ b/students/1158154002/src/main/java/com/coderising/payroll/util/DateUtil.java @@ -0,0 +1,65 @@ +package com.coderising.payroll.util; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +public class DateUtil { + public static boolean isLasyDayOfMonth(Date date) { + Calendar b = Calendar.getInstance(); + b.setTime(date); + int lastDay = b.getActualMaximum(Calendar.DAY_OF_MONTH); + int now = b.get(Calendar.DAY_OF_MONTH); + return now == lastDay; + } + + public static Date getFirstDay(Date payPeriodEndDate) { + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, 0); + c.set(Calendar.DAY_OF_MONTH, 1); + return c.getTime(); + } + + public static Date add(Date date, int num) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + c.add(Calendar.DATE, num); + return c.getTime(); + } + + public static Date parseDate(String date) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date time = null; + try { + time = sdf.parse(date); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return time; + } + + public static boolean isFriday(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + return c.get(Calendar.DAY_OF_WEEK) == 6; + } + + public static int getDaysBetween(Date start, Date end) { + Calendar aCalendar = Calendar.getInstance(); + aCalendar.setTime(end); + + int day1 = aCalendar.get(Calendar.DAY_OF_YEAR); + aCalendar.setTime(start); + + int day2 = aCalendar.get(Calendar.DAY_OF_YEAR); + + return day1 - day2; + } + + public static boolean between(Date saleDate, Date payPeriodStartDate, Date payPeriodEndDate) { + + return saleDate.getTime()>=payPeriodStartDate.getTime()&&saleDate.getTime()<=payPeriodEndDate.getTime(); + } +} diff --git a/students/247565311/week00/Configuration.java b/students/247565311/week00/Configuration.java new file mode 100644 index 0000000000..66f989efd0 --- /dev/null +++ b/students/247565311/week00/Configuration.java @@ -0,0 +1,19 @@ +package week00; +import java.util.HashMap; +import java.util.Map; +public class Configuration { + static Map configurations = new HashMap<>(); + static{ + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + /** + * Ӧ�ô������ļ����� ���������Ϊֱ�Ӵ�һ��map ��ȥ�� + * @param key + * @return + */ + public String getProperty(String key) { + return configurations.get(key); + } +} diff --git a/students/247565311/week00/ConfigurationKeys.java b/students/247565311/week00/ConfigurationKeys.java new file mode 100644 index 0000000000..10da9ce88c --- /dev/null +++ b/students/247565311/week00/ConfigurationKeys.java @@ -0,0 +1,6 @@ +package week00; +public class ConfigurationKeys { + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; +} diff --git a/students/247565311/week00/DBUtil.java b/students/247565311/week00/DBUtil.java new file mode 100644 index 0000000000..903bdef223 --- /dev/null +++ b/students/247565311/week00/DBUtil.java @@ -0,0 +1,21 @@ +package week00; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +public class DBUtil { + /** + * Ӧ�ô����ݿ���� ���Ǽ�Ϊֱ�����ɡ� + * @param sql + * @return + */ + public static List> query(String sql){ + List> userList = new ArrayList>(); + for (int i = 1; i <= 3; i++) { + HashMap userInfo = new HashMap(); + userInfo.put("NAME", "User" + i); + userInfo.put("EMAIL", "aa@bb.com"); + userList.add(userInfo); + } + return userList; + } +} diff --git a/students/247565311/week00/MailUtil.java b/students/247565311/week00/MailUtil.java new file mode 100644 index 0000000000..01e6e32fc8 --- /dev/null +++ b/students/247565311/week00/MailUtil.java @@ -0,0 +1,14 @@ +package week00; + +public class MailUtil { + public static void sendEmail(String toAddress, String fromAddress, String subject, String message, String smtpHost, + boolean debug) { + //��װ����һ���ʼ� + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(toAddress).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(message).append("\n"); + System.out.println(buffer.toString()); + } +} diff --git a/students/247565311/week00/PromotionMail.java b/students/247565311/week00/PromotionMail.java new file mode 100644 index 0000000000..a1e079f571 --- /dev/null +++ b/students/247565311/week00/PromotionMail.java @@ -0,0 +1,136 @@ +package week00; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +class ProductMessage{ + public String productID; + public String productDesc; + public ProductMessage(String id,String desc){ + productID = id; + productDesc = desc; + } +} +class ProductMessageIter{ + BufferedReader reader = null; + boolean loadFileSuccess = false,readFinished = false; + public ProductMessageIter(File socFile){ + try { + reader = new BufferedReader(new FileReader(socFile)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + return; + } + loadFileSuccess = true; + } + public boolean hasNext(){ + if(!loadFileSuccess || readFinished) return false; + try { + reader.mark(10); + String lineMsg = reader.readLine(); + reader.reset(); + if(lineMsg.equals("")) { + readFinished = true; + reader.close(); + return false; + } + } catch (IOException e) { + e.printStackTrace(); + } + return true; + } + public ProductMessage next(){ + String lineMsg=null; + try { + lineMsg = reader.readLine(); + } catch (IOException e) { + e.printStackTrace(); + } + if(lineMsg == null) return null; + String [] msgs = lineMsg.split(" "); + ProductMessage msg = new ProductMessage(msgs[0],msgs[1]); + System.out.println("��ƷID = " + msgs[0]); + System.out.println("��Ʒ���� = " + msgs[1]); + return msg; + } +} +class EMailSender{ + String fromAddress = null; + String smtpHost = null; + String altSmtpHost = null; + private static final String NAME_KEY = "NAME"; + private static final String EMAIL_KEY = "EMAIL"; + + public EMailSender(){ + Configuration config = new Configuration(); + smtpHost = config.getProperty(ConfigurationKeys.SMTP_SERVER); + altSmtpHost = config.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + fromAddress = config.getProperty(ConfigurationKeys.EMAIL_ADMIN); + } + // �����ʼ����ݣ��ɹ����ɻᷢ���ʼ� + public void configureAndSendEMail(HashMap userInfo,ProductMessage prdMsg,boolean debug) throws IOException + { + String toAddress = "",subject = "",message = ""; + toAddress = (String) userInfo.get(EMAIL_KEY); + if (toAddress.length() > 0) { + String name = (String) userInfo.get(NAME_KEY); + subject = "����ע�IJ�Ʒ������"; + message = "�𾴵� "+name+", ����ע�IJ�Ʒ " + prdMsg.productDesc + " �����ˣ���ӭ����!" ; + System.out.println("��ʼ�����ʼ�"); + sendEMail(toAddress,subject,message,debug); + }else { + System.out.println("û���ʼ�����"); + } + } + // ����֪ͨ�ʼ� + void sendEMail(String toAddress,String subject,String message,boolean debug) throws IOException + { + boolean sendSucceed = false; + try + { + if (toAddress.length() > 0){ + MailUtil.sendEmail(toAddress, fromAddress, subject, message, smtpHost, debug); + sendSucceed = true; + } + } + catch (Exception e) {} + if(!sendSucceed){ + try { + MailUtil.sendEmail(toAddress, fromAddress, subject, message, altSmtpHost, debug); + } catch (Exception e2) + { + System.out.println("ͨ������ SMTP�����������ʼ�ʧ��: " + e2.getMessage()); + } + } + } +} +public class PromotionMail { + public static void main(String[] args) throws Exception { + File f = new File("J:\\gitstore\\coding2017\\students\\247565311\\week00\\product_promotion.txt"); + boolean emailDebug = false; + PromotionMail pe = new PromotionMail(f, emailDebug); + } + // ���̿��� + public PromotionMail(File file, boolean mailDebug) throws Exception { + ProductMessageIter iter = new ProductMessageIter(file);//��ȡ�����ļ��� �ļ���ֻ��һ���ÿո������ ���� P8756 iPhone8 + while(iter.hasNext()){ + ProductMessage prdMsg = iter.next(); + List> userInfos = loadMailingList(prdMsg); + for(HashMap user : userInfos){ + new EMailSender().configureAndSendEMail(user,prdMsg,mailDebug); + } + } + } + // ��ȡ�û������б� + protected List> loadMailingList(ProductMessage prdMsg) throws Exception { + String sendMailQuery = "Select name from subscriptions " + + "where product_id= '" + prdMsg.productID +"' " + + "and send_mail=1 "; + System.out.println("�����û��б���..."); + return DBUtil.query(sendMailQuery); + } +} diff --git a/students/247565311/week00/product_promotion.txt b/students/247565311/week00/product_promotion.txt new file mode 100644 index 0000000000..e98aea9f01 --- /dev/null +++ b/students/247565311/week00/product_promotion.txt @@ -0,0 +1,5 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 + diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/Employee.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/Employee.java new file mode 100644 index 0000000000..a19e993424 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/Employee.java @@ -0,0 +1,64 @@ +package com.coderising.ood.payroll; + +import com.coderising.ood.payroll.affiliation.Affiliation; +import com.coderising.ood.payroll.classfication.PaymentClassification; +import com.coderising.ood.payroll.method.PaymentMethod; +import com.coderising.ood.payroll.schedule.PaymentSchedule; + +import java.util.Date; + +public class Employee { + int id; + String name; + String address; + Affiliation affiliation; + + + PaymentClassification classification; + PaymentSchedule schedule; + PaymentMethod paymentMethod; + + public Employee(String name, String address) { + this.name = name; + this.address = address; + } + + public boolean isPayDay(Date d) { + return schedule.isPayDate(id, d); + } + + public boolean isPayed(Date d) { + return schedule.isPayed(id, d); + } + + public Date getPayPeriodStartDate(Date d) { + return schedule.getPayPeriodStartDate(d); + } + + public void payDay(Paycheck pc) { + + if (isPayDay(new Date()) && isPayed(new Date())) { + double grossPay = classification.calculatePay(pc); + double deduction = affiliation.calculateDeductions(pc); + double netPay = grossPay - deduction; + pc.setGrossPay(grossPay); + pc.setDeductions(deduction); + pc.setNetPay(netPay); + + paymentMethod.pay(pc, id); + } + } + + public void setClassification(PaymentClassification classification) { + this.classification = classification; + } + + public void setSchedule(PaymentSchedule schedule) { + this.schedule = schedule; + } + + public void setPaymentMethod(PaymentMethod paymentMethod) { + this.paymentMethod = paymentMethod; + } +} + diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/Paycheck.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/Paycheck.java new file mode 100644 index 0000000000..8704ba58c7 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/Paycheck.java @@ -0,0 +1,34 @@ +package com.coderising.ood.payroll; + +import java.util.Date; + +public class Paycheck { + private Date payPeriodStart; + private Date payPeriodEnd; + private double grossPay; + private double netPay; + private double deductions; + + public Paycheck(Date payPeriodStart, Date payPeriodEnd){ + this.payPeriodStart = payPeriodStart; + this.payPeriodEnd = payPeriodEnd; + } + public void setGrossPay(double grossPay) { + this.grossPay = grossPay; + + } + public void setDeductions(double deductions) { + this.deductions = deductions; + } + public void setNetPay(double netPay){ + this.netPay = netPay; + } + public Date getPayPeriodEndDate() { + + return this.payPeriodEnd; + } + public Date getPayPeriodStartDate() { + + return this.payPeriodStart; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/Affiliation.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/Affiliation.java new file mode 100644 index 0000000000..2b427068ae --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/Affiliation.java @@ -0,0 +1,7 @@ +package com.coderising.ood.payroll.affiliation; + +import com.coderising.ood.payroll.Paycheck; + +public interface Affiliation { + public double calculateDeductions(Paycheck pc); +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/NonAffiliation.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/NonAffiliation.java new file mode 100644 index 0000000000..cab1542a14 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/NonAffiliation.java @@ -0,0 +1,15 @@ +package com.coderising.ood.payroll.affiliation; + +import com.coderising.ood.payroll.Paycheck; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class NonAffiliation implements Affiliation { + + @Override + public double calculateDeductions(Paycheck pc) { + return 0; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/ServiceCharge.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/ServiceCharge.java new file mode 100644 index 0000000000..25847d650a --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/ServiceCharge.java @@ -0,0 +1,28 @@ +package com.coderising.ood.payroll.affiliation; + +import java.util.Date; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class ServiceCharge { + private Date date; + private double amount; + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public double getAmount() { + return amount; + } + + public void setAmount(double amount) { + this.amount = amount; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/UnionAffiliation.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/UnionAffiliation.java new file mode 100644 index 0000000000..50e19e985f --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/affiliation/UnionAffiliation.java @@ -0,0 +1,53 @@ +package com.coderising.ood.payroll.affiliation; + +import com.coderising.ood.payroll.Paycheck; +import com.coderising.ood.payroll.util.DateUtil; + +import java.util.List; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class UnionAffiliation implements Affiliation{ + private int memberId; + private double weeklyDue; + private List serviceChargeList; + + @Override + public double calculateDeductions(Paycheck pc) { + int fridays = DateUtil.getFridayNumber(pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate()); + double totalDue = fridays * weeklyDue; + double totalCharge = 0.0d; + for (ServiceCharge serviceCharge : serviceChargeList){ + if (DateUtil.isDuring(pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate(), serviceCharge.getDate())){ + totalCharge += serviceCharge.getAmount(); + } + } + return totalCharge + totalDue; + } + + public int getMemberId() { + return memberId; + } + + public void setMemberId(int memberId) { + this.memberId = memberId; + } + + public double getWeeklyDue() { + return weeklyDue; + } + + public void setWeeklyDue(double weeklyDue) { + this.weeklyDue = weeklyDue; + } + + public List getServiceChargeList() { + return serviceChargeList; + } + + public void setServiceChargeList(List serviceChargeList) { + this.serviceChargeList = serviceChargeList; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/CommissionClassification.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/CommissionClassification.java new file mode 100644 index 0000000000..992b8142c1 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/CommissionClassification.java @@ -0,0 +1,17 @@ +package com.coderising.ood.payroll.classfication; + +import com.coderising.ood.payroll.Paycheck; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class CommissionClassification implements PaymentClassification { + + private double salary; + + @Override + public double calculatePay(Paycheck pc) { + return salary; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/HourlyClassification.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/HourlyClassification.java new file mode 100644 index 0000000000..de8ac05ae4 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/HourlyClassification.java @@ -0,0 +1,36 @@ +package com.coderising.ood.payroll.classfication; + +import com.coderising.ood.payroll.Paycheck; +import com.coderising.ood.payroll.util.DateUtil; + +import java.util.Date; +import java.util.Map; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class HourlyClassification implements PaymentClassification { + private double rate; + private Map timeCards; + + public void addTimeCard(TimeCard tc) { + timeCards.put(tc.getDate(), tc); + } + + @Override + public double calculatePay(Paycheck pc) { + double daysMoney = 0.0; + for (Date date : timeCards.keySet()) { + if (DateUtil.isDuring(pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate(), date)) { + daysMoney += calculateHours(timeCards.get(date).getHours()); + } + } + return daysMoney; + } + + private double calculateHours(int hour) { + int extendHour = hour - 8 >= 0 ? hour - 8 : 0; + return hour * rate + extendHour * rate * 1.5; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/PaymentClassification.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/PaymentClassification.java new file mode 100644 index 0000000000..90cd991f75 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/PaymentClassification.java @@ -0,0 +1,7 @@ +package com.coderising.ood.payroll.classfication; + +import com.coderising.ood.payroll.Paycheck; + +public interface PaymentClassification { + public double calculatePay(Paycheck pc); +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/SalariedClassification.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/SalariedClassification.java new file mode 100644 index 0000000000..50c3a70d92 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/SalariedClassification.java @@ -0,0 +1,30 @@ +package com.coderising.ood.payroll.classfication; + +import com.coderising.ood.payroll.Paycheck; +import com.coderising.ood.payroll.util.DateUtil; + +import java.util.Date; +import java.util.Map; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class SalariedClassification implements PaymentClassification { + private double salary; + private double rate; + private Map salesReceiptMap; + + + @Override + public double calculatePay(Paycheck pc) { + double commission = 0.0; + for (Date date : salesReceiptMap.keySet()) { + if (DateUtil.isDuring(pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate(), date)) { + commission += salesReceiptMap.get(date).getAmount() * rate; + } + } + + return salary + commission; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/SalesReceipt.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/SalesReceipt.java new file mode 100644 index 0000000000..5194c317c4 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/SalesReceipt.java @@ -0,0 +1,14 @@ +package com.coderising.ood.payroll.classfication; + +import java.util.Date; + +public class SalesReceipt { + private Date saleDate; + private double amount; + public Date getSaleDate() { + return saleDate; + } + public double getAmount() { + return amount; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/TimeCard.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/TimeCard.java new file mode 100644 index 0000000000..c0c70e95f8 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/classfication/TimeCard.java @@ -0,0 +1,15 @@ +package com.coderising.ood.payroll.classfication; + +import java.util.Date; + +public class TimeCard { + private Date date; + private int hours; + + public Date getDate() { + return date; + } + public int getHours() { + return hours; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/db/MockDB.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/db/MockDB.java new file mode 100644 index 0000000000..9529963626 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/db/MockDB.java @@ -0,0 +1,38 @@ +package com.coderising.ood.payroll.db; + +import com.coderising.ood.payroll.Paycheck; + +import java.util.HashMap; +import java.util.Map; +import java.util.Stack; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class MockDB { + + private static Map> map; + + static { + map = new HashMap>(); + } + + public static void put(int id, Paycheck pc) { + if (map.containsKey(id)) { + Stack stack = map.get(id); + stack.push(pc); + } else { + Stack stack = new Stack<>(); + stack.push(pc); + map.put(id, stack); + } + } + + public static Paycheck peek(int id) { + if (map.containsKey(id)) { + return map.get(id).peek(); + } + return null; + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/BankMethod.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/BankMethod.java new file mode 100644 index 0000000000..257476c8b1 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/BankMethod.java @@ -0,0 +1,18 @@ +package com.coderising.ood.payroll.method; + +import com.coderising.ood.payroll.Paycheck; +import com.coderising.ood.payroll.db.MockDB; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class BankMethod implements PaymentMethod { + + @Override + public void pay(Paycheck pc, int employId) { + //pay to bank + System.out.println("pay to bank " + employId); + MockDB.put(employId, pc); + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/HoldMethod.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/HoldMethod.java new file mode 100644 index 0000000000..92f1b08830 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/HoldMethod.java @@ -0,0 +1,18 @@ +package com.coderising.ood.payroll.method; + +import com.coderising.ood.payroll.Paycheck; +import com.coderising.ood.payroll.db.MockDB; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class HoldMethod implements PaymentMethod { + + @Override + public void pay(Paycheck pc, int employId) { + //hold the paycheck + System.out.println("hold paycheck " + employId); + MockDB.put(employId, pc); + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/MailMethod.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/MailMethod.java new file mode 100644 index 0000000000..1cff304dc7 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/MailMethod.java @@ -0,0 +1,17 @@ +package com.coderising.ood.payroll.method; + +import com.coderising.ood.payroll.Paycheck; +import com.coderising.ood.payroll.db.MockDB; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class MailMethod implements PaymentMethod { + @Override + public void pay(Paycheck pc, int employId) { + //mail to employee + System.out.println("mail to employee " + employId); + MockDB.put(employId, pc); + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/PaymentMethod.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/PaymentMethod.java new file mode 100644 index 0000000000..b0c88c21fa --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/method/PaymentMethod.java @@ -0,0 +1,7 @@ +package com.coderising.ood.payroll.method; + +import com.coderising.ood.payroll.Paycheck; + +public interface PaymentMethod{ + public void pay(Paycheck pc, int employId); +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/BiWeeklyPaymentSchedule.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/BiWeeklyPaymentSchedule.java new file mode 100644 index 0000000000..b36968d68b --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/BiWeeklyPaymentSchedule.java @@ -0,0 +1,28 @@ +package com.coderising.ood.payroll.schedule; + +import com.coderising.ood.payroll.db.MockDB; +import com.coderising.ood.payroll.util.DateUtil; + +import java.util.Date; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class BiWeeklyPaymentSchedule implements PaymentSchedule { + + @Override + public boolean isPayDate(int employedId, Date date) { + Date payedDate = MockDB.peek(employedId).getPayPeriodEndDate(); + if (payedDate == null) { + return DateUtil.isFriday(date); + } else { + return DateUtil.getInterval(payedDate, date) % 14 == 0; + } + } + + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.getStartDate(payPeriodEndDate, -13); + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/MonthlyPaymentSchedule.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/MonthlyPaymentSchedule.java new file mode 100644 index 0000000000..b54682ab83 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/MonthlyPaymentSchedule.java @@ -0,0 +1,22 @@ +package com.coderising.ood.payroll.schedule; + +import com.coderising.ood.payroll.util.DateUtil; + +import java.util.Date; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class MonthlyPaymentSchedule implements PaymentSchedule { + + @Override + public boolean isPayDate(int employId, Date date) { + return DateUtil.isLastWorkDay(date); + } + + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.getStartOfMonth(); + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/PaymentSchedule.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/PaymentSchedule.java new file mode 100644 index 0000000000..4fce5bac18 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/PaymentSchedule.java @@ -0,0 +1,15 @@ +package com.coderising.ood.payroll.schedule; + +import com.coderising.ood.payroll.db.MockDB; +import com.coderising.ood.payroll.util.DateUtil; + +import java.util.Date; + +public interface PaymentSchedule { + public boolean isPayDate(int employId, Date date); + public Date getPayPeriodStartDate(Date payPeriodEndDate); + + default public boolean isPayed(int employedId, Date date){ + return DateUtil.equalDay(MockDB.peek(employedId).getPayPeriodEndDate(), date); + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/WeeklyPaymentSchedule.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/WeeklyPaymentSchedule.java new file mode 100644 index 0000000000..988b8c23ea --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/schedule/WeeklyPaymentSchedule.java @@ -0,0 +1,22 @@ +package com.coderising.ood.payroll.schedule; + +import com.coderising.ood.payroll.util.DateUtil; + +import java.util.Date; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class WeeklyPaymentSchedule implements PaymentSchedule { + + @Override + public boolean isPayDate(int employId,Date date) { + return DateUtil.isFriday(date); + } + + @Override + public Date getPayPeriodStartDate(Date payPeriodEndDate) { + return DateUtil.getStartDate(payPeriodEndDate, -6); + } +} diff --git a/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/util/DateUtil.java b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/util/DateUtil.java new file mode 100644 index 0000000000..b742fabef5 --- /dev/null +++ b/students/2816977791/ood/ood-assignment/src/main/java/com/coderising/ood/payroll/util/DateUtil.java @@ -0,0 +1,96 @@ +package com.coderising.ood.payroll.util; + +import java.util.Calendar; +import java.util.Date; + +/** + * @author nvarchar + * date 2017/7/10 + */ +public class DateUtil { + + public static boolean isDuring(Date start, Date end, Date date) { + long oneDay = 24 * 60 * 60 * 1000; + long d1 = start.getTime() / oneDay; + long d2 = end.getTime() / oneDay; + long d = date.getTime() / oneDay; + + if (d1 <= d && d <= d2) { + return true; + } + + return false; + } + + + public static int getFridayNumber(Date start, Date end) { + Calendar starCalendar = Calendar.getInstance(); + starCalendar.setTime(start); + Calendar endCalendar = Calendar.getInstance(); + endCalendar.setTime(end); + int result = 0; + while (starCalendar.before(endCalendar)) { + + starCalendar.add(Calendar.DATE, 1); + + if (starCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) { + result++; + starCalendar.add(Calendar.DATE, 6); + } + + } + return result; + } + + public static boolean isFriday(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) { + return true; + } + return false; + } + + public static boolean isLastWorkDay(Date date) { + + Calendar calToday = Calendar.getInstance(); + calToday.setTime(date); + + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE)); + while (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && + cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { + cal.add(Calendar.DATE, -1); + } + + return cal.get(Calendar.DAY_OF_MONTH) == calToday.get(Calendar.DAY_OF_MONTH); + } + + public static Date getStartDate(Date endDate, int duringDay) { + Calendar cal = Calendar.getInstance(); + cal.setTime(endDate); + cal.add(Calendar.DATE, duringDay); + return cal.getTime(); + } + + public static Date getStartOfMonth() { + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.DATE, cal.getActualMinimum(Calendar.DATE)); + return cal.getTime(); + } + + public static boolean equalDay(Date date1, Date date2) { + long oneDay = 24 * 60 * 60 * 1000; + long d1 = date1.getTime() / oneDay; + long d2 = date2.getTime() / oneDay; + return d1 == d2; + } + + public static long getInterval(Date start, Date end) { + long oneDay = 24 * 60 * 60 * 1000; + long d1 = start.getTime() / oneDay; + long d2 = end.getTime() / oneDay; + return d2 - d1; + } +} + diff --git "a/students/2816977791/ood/ood-assignment/uml\344\275\234\344\270\232.mdj" "b/students/2816977791/ood/ood-assignment/uml\344\275\234\344\270\232.mdj" new file mode 100644 index 0000000000..07a8fd5223 --- /dev/null +++ "b/students/2816977791/ood/ood-assignment/uml\344\275\234\344\270\232.mdj" @@ -0,0 +1,10991 @@ +{ + "_type": "Project", + "_id": "AAAAAAFF+h6SjaM2Hec=", + "name": "UML", + "ownedElements": [ + { + "_type": "UMLModel", + "_id": "AAAAAAFdF8bUGpzmKj4=", + "_parent": { + "$ref": "AAAAAAFF+h6SjaM2Hec=" + }, + "name": "UML", + "ownedElements": [ + { + "_type": "UMLClassDiagram", + "_id": "AAAAAAFdF8bUG5znYro=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "掷骰子类图", + "visible": true, + "defaultDiagram": false, + "ownedViews": [ + { + "_type": "UMLClassView", + "_id": "AAAAAAFdF9Jh5p1e1kg=", + "_parent": { + "$ref": "AAAAAAFdF8bUG5znYro=" + }, + "model": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdF9Jh551fLcE=", + "_parent": { + "$ref": "AAAAAAFdF9Jh5p1e1kg=" + }, + "model": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdF9Jh551gGOA=", + "_parent": { + "$ref": "AAAAAAFdF9Jh551fLcE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -64, + "top": -64, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9Jh6J1hmaI=", + "_parent": { + "$ref": "AAAAAAFdF9Jh551fLcE=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 93, + "top": 143, + "width": 136, + "height": 13, + "autoResize": false, + "underline": false, + "text": "Player", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9Jh6J1iK1E=", + "_parent": { + "$ref": "AAAAAAFdF9Jh551fLcE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -64, + "top": -64, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9Jh6J1jC4c=", + "_parent": { + "$ref": "AAAAAAFdF9Jh551fLcE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -64, + "top": -64, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 88, + "top": 136, + "width": 146, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdF9Jh551gGOA=" + }, + "nameLabel": { + "$ref": "AAAAAAFdF9Jh6J1hmaI=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdF9Jh6J1iK1E=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdF9Jh6J1jC4c=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdF9Jh6J1k2zs=", + "_parent": { + "$ref": "AAAAAAFdF9Jh5p1e1kg=" + }, + "model": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 88, + "top": 161, + "width": 146, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdF9Jh6Z1lcZE=", + "_parent": { + "$ref": "AAAAAAFdF9Jh5p1e1kg=" + }, + "model": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 88, + "top": 171, + "width": 146, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdF9Jh6Z1mfBE=", + "_parent": { + "$ref": "AAAAAAFdF9Jh5p1e1kg=" + }, + "model": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -32, + "top": -32, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdF9Jh6p1n2Rs=", + "_parent": { + "$ref": "AAAAAAFdF9Jh5p1e1kg=" + }, + "model": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -32, + "top": -32, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 88, + "top": 136, + "width": 146, + "height": 137, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdF9Jh551fLcE=" + }, + "wordWrap": false, + "suppressAttributes": false, + "suppressOperations": false, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdF9Jh6J1k2zs=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdF9Jh6Z1lcZE=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdF9Jh6Z1mfBE=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdF9Jh6p1n2Rs=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFdF9NBMZ2L3Y0=", + "_parent": { + "$ref": "AAAAAAFdF8bUG5znYro=" + }, + "model": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdF9NBMp2MHjA=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2L3Y0=" + }, + "model": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdF9NBMp2N/fY=", + "_parent": { + "$ref": "AAAAAAFdF9NBMp2MHjA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 352, + "top": -32, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9NBMp2OfKA=", + "_parent": { + "$ref": "AAAAAAFdF9NBMp2MHjA=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 301, + "top": 159, + "width": 110, + "height": 13, + "autoResize": false, + "underline": false, + "text": "DiceGame", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9NBMp2P328=", + "_parent": { + "$ref": "AAAAAAFdF9NBMp2MHjA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 352, + "top": -32, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9NBMp2QlM4=", + "_parent": { + "$ref": "AAAAAAFdF9NBMp2MHjA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 352, + "top": -32, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 296, + "top": 152, + "width": 120, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdF9NBMp2N/fY=" + }, + "nameLabel": { + "$ref": "AAAAAAFdF9NBMp2OfKA=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdF9NBMp2P328=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdF9NBMp2QlM4=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdF9NBM52Rwlo=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2L3Y0=" + }, + "model": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 296, + "top": 177, + "width": 120, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdF9NBM52Sw5c=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2L3Y0=" + }, + "model": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFdF9tkjZ8WQz4=", + "_parent": { + "$ref": "AAAAAAFdF9NBM52Sw5c=" + }, + "model": { + "$ref": "AAAAAAFdF9tkT58TEw0=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 301, + "top": 192, + "width": 110, + "height": 13, + "autoResize": false, + "underline": false, + "text": "+play()", + "horizontalAlignment": 0, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 296, + "top": 187, + "width": 120, + "height": 23, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdF9NBM52TM2c=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2L3Y0=" + }, + "model": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 176, + "top": -16, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdF9NBM52UQZA=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2L3Y0=" + }, + "model": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 176, + "top": -16, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 296, + "top": 152, + "width": 120, + "height": 105, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdF9NBMp2MHjA=" + }, + "wordWrap": false, + "suppressAttributes": false, + "suppressOperations": false, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdF9NBM52Rwlo=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdF9NBM52Sw5c=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdF9NBM52TM2c=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdF9NBM52UQZA=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFdF9RF6p27dz8=", + "_parent": { + "$ref": "AAAAAAFdF8bUG5znYro=" + }, + "model": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdF9RF6p285OM=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p27dz8=" + }, + "model": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdF9RF6p290EI=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p285OM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 832, + "top": -64, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9RF652+dtM=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p285OM=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 541, + "top": 143, + "width": 95, + "height": 13, + "autoResize": false, + "underline": false, + "text": "Dice", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9RF652/xQQ=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p285OM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 832, + "top": -64, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9RF653A46U=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p285OM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 832, + "top": -64, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 536, + "top": 136, + "width": 105, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdF9RF6p290EI=" + }, + "nameLabel": { + "$ref": "AAAAAAFdF9RF652+dtM=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdF9RF652/xQQ=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdF9RF653A46U=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdF9RF653BO3M=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p27dz8=" + }, + "model": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 536, + "top": 161, + "width": 105, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdF9RF653Cqww=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p27dz8=" + }, + "model": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFdF9yO5Z8ojEk=", + "_parent": { + "$ref": "AAAAAAFdF9RF653Cqww=" + }, + "model": { + "$ref": "AAAAAAFdF9yOrp8l+p4=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 541, + "top": 176, + "width": 95, + "height": 13, + "autoResize": false, + "underline": false, + "text": "+roll()", + "horizontalAlignment": 0, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 536, + "top": 171, + "width": 105, + "height": 23, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdF9RF653DNB8=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p27dz8=" + }, + "model": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 416, + "top": -32, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdF9RF653EiHA=", + "_parent": { + "$ref": "AAAAAAFdF9RF6p27dz8=" + }, + "model": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 416, + "top": -32, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 536, + "top": 136, + "width": 105, + "height": 129, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdF9RF6p285OM=" + }, + "wordWrap": false, + "suppressAttributes": false, + "suppressOperations": false, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdF9RF653BO3M=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdF9RF653Cqww=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdF9RF653DNB8=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdF9RF653EiHA=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFdG6RIw5sj01s=", + "_parent": { + "$ref": "AAAAAAFdF8bUG5znYro=" + }, + "model": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdG6RIw5skjDw=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5sj01s=" + }, + "model": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdG6RIxJslAao=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5skjDw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 64, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdG6RIxJsm7oQ=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5skjDw=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 317, + "top": 343, + "width": 83, + "height": 13, + "autoResize": false, + "underline": false, + "text": "Display", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdG6RIxJsn/Ho=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5skjDw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 64, + "top": 0, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdG6RIxJsowro=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5skjDw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 64, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 312, + "top": 336, + "width": 93, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdG6RIxJslAao=" + }, + "nameLabel": { + "$ref": "AAAAAAFdG6RIxJsm7oQ=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdG6RIxJsn/Ho=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdG6RIxJsowro=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdG6RIxJsppN8=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5sj01s=" + }, + "model": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 312, + "top": 361, + "width": 93, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdG6RIxJsqh8o=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5sj01s=" + }, + "model": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFdG6UFHpx+fFk=", + "_parent": { + "$ref": "AAAAAAFdG6RIxJsqh8o=" + }, + "model": { + "$ref": "AAAAAAFdG6UEzJx4aDY=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 317, + "top": 376, + "width": 83, + "height": 13, + "autoResize": false, + "underline": false, + "text": "+showResult()", + "horizontalAlignment": 0, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 312, + "top": 371, + "width": 93, + "height": 23, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdG6RIxZsrp4I=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5sj01s=" + }, + "model": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 32, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdG6RIxZssrB4=", + "_parent": { + "$ref": "AAAAAAFdG6RIw5sj01s=" + }, + "model": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 32, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 312, + "top": 336, + "width": 93, + "height": 58, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdG6RIw5skjDw=" + }, + "wordWrap": false, + "suppressAttributes": false, + "suppressOperations": false, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdG6RIxJsppN8=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdG6RIxJsqh8o=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdG6RIxZsrp4I=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdG6RIxZssrB4=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFdG6S2ipuwjkI=", + "_parent": { + "$ref": "AAAAAAFdF8bUG5znYro=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZusc0s=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5uxbfQ=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZusc0s=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 475, + "top": 210, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5uyfR4=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZusc0s=" + }, + "visible": null, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 475, + "top": 225, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5uz2QY=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZusc0s=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 474, + "top": 181, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5u0CCg=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZutrMs=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 509, + "top": 210, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5u1a6s=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZutrMs=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 507, + "top": 223, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5u2OxE=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZutrMs=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 513, + "top": 182, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5u3NnY=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZuu5hA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 442, + "top": 211, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5u4bS4=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZuu5hA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 444, + "top": 224, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6S2i5u5L50=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZuu5hA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 437, + "top": 184, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdG6S2i5u6s+4=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZutrMs=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdG6S2i5u7PHQ=", + "_parent": { + "$ref": "AAAAAAFdG6S2ipuwjkI=" + }, + "model": { + "$ref": "AAAAAAFdG6S2iZuu5hA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdF9NBMZ2L3Y0=" + }, + "tail": { + "$ref": "AAAAAAFdF9RF6p27dz8=" + }, + "lineStyle": 1, + "points": "535:201;416:203", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdG6S2i5uxbfQ=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdG6S2i5uyfR4=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdG6S2i5uz2QY=" + }, + "showMultiplicity": true, + "showType": true, + "tailRoleNameLabel": { + "$ref": "AAAAAAFdG6S2i5u0CCg=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFdG6S2i5u1a6s=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFdG6S2i5u2OxE=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFdG6S2i5u3NnY=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFdG6S2i5u4bS4=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFdG6S2i5u5L50=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFdG6S2i5u6s+4=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFdG6S2i5u7PHQ=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFdG6TzIZwbrTI=", + "_parent": { + "$ref": "AAAAAAFdF8bUG5znYro=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwX5cs=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZwcpKE=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwX5cs=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 370, + "top": 289, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZwdOEs=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwX5cs=" + }, + "visible": null, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 385, + "top": 289, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZweT1I=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwX5cs=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 341, + "top": 290, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZwf28Q=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwYZJ8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 371, + "top": 276, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZwgt2E=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwYZJ8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 384, + "top": 278, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZwhoAc=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwYZJ8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 343, + "top": 272, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZwixsg=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwZeVE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 371, + "top": 302, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZwj9mY=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwZeVE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 384, + "top": 300, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6TzIZwk3hI=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwZeVE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 344, + "top": 307, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdG6TzIZwlZ4U=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwYZJ8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdG6TzIZwmWlA=", + "_parent": { + "$ref": "AAAAAAFdG6TzIZwbrTI=" + }, + "model": { + "$ref": "AAAAAAFdG6TzIJwZeVE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdG6RIw5sj01s=" + }, + "tail": { + "$ref": "AAAAAAFdF9NBMZ2L3Y0=" + }, + "lineStyle": 1, + "points": "356:257;357:335", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdG6TzIZwcpKE=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdG6TzIZwdOEs=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdG6TzIZweT1I=" + }, + "showMultiplicity": true, + "showType": true, + "tailRoleNameLabel": { + "$ref": "AAAAAAFdG6TzIZwf28Q=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFdG6TzIZwgt2E=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFdG6TzIZwhoAc=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFdG6TzIZwixsg=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFdG6TzIZwj9mY=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFdG6TzIZwk3hI=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFdG6TzIZwlZ4U=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFdG6TzIZwmWlA=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFdG6VR1p1K29k=", + "_parent": { + "$ref": "AAAAAAFdF8bUG5znYro=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1Gsno=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151Ll90=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1Gsno=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 264, + "top": 183, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151MEwk=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1Gsno=" + }, + "visible": null, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 264, + "top": 168, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151N38E=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1Gsno=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 264, + "top": 213, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151OVG8=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1HuPE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 259, + "top": 183, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151PBXI=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1HuPE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 262, + "top": 169, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151Qxb0=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1HuPE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 255, + "top": 210, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151RWSE=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1IHBQ=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 269, + "top": 183, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151SI6M=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1IHBQ=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 266, + "top": 169, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdG6VR151Tzp0=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1IHBQ=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 273, + "top": 210, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdG6VR2J1U3mw=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1HuPE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdG6VR2J1VdIc=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1K29k=" + }, + "model": { + "$ref": "AAAAAAFdG6VR1p1IHBQ=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdF9NBMZ2L3Y0=" + }, + "tail": { + "$ref": "AAAAAAFdF9Jh5p1e1kg=" + }, + "lineStyle": 1, + "points": "234:204;295:204", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdG6VR151Ll90=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdG6VR151MEwk=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdG6VR151N38E=" + }, + "showMultiplicity": true, + "showType": true, + "tailRoleNameLabel": { + "$ref": "AAAAAAFdG6VR151OVG8=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFdG6VR151PBXI=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFdG6VR151Qxb0=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFdG6VR151RWSE=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFdG6VR151SI6M=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFdG6VR151Tzp0=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFdG6VR2J1U3mw=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFdG6VR2J1VdIc=" + } + } + ] + }, + { + "_type": "UMLUseCaseDiagram", + "_id": "AAAAAAFdF8yd/5z3Wwc=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "购物网站", + "visible": true, + "defaultDiagram": false, + "ownedViews": [ + { + "_type": "UMLActorView", + "_id": "AAAAAAFdGAKakqRiXVU=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdGAKakqRjG98=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "model": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdGAKalKRkgoU=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRjG98=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 80, + "top": 432, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAKalaRlXyo=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRjG98=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 125, + "top": 549, + "width": 40, + "height": 13, + "autoResize": false, + "underline": false, + "text": "用户", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAKalqRm2U4=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRjG98=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 80, + "top": 432, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAKalqRnExY=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRjG98=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 80, + "top": 432, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 120, + "top": 542, + "width": 50, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdGAKalKRkgoU=" + }, + "nameLabel": { + "$ref": "AAAAAAFdGAKalaRlXyo=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdGAKalqRm2U4=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdGAKalqRnExY=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdGAKalqRoke0=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "model": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 40, + "top": 216, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdGAKalqRpCx8=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "model": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 40, + "top": 216, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdGAKalqRq+G8=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "model": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 40, + "top": 216, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdGAKal6Rr7ig=", + "_parent": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "model": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 40, + "top": 216, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 120, + "top": 488, + "width": 50, + "height": 80, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdGAKakqRjG98=" + }, + "wordWrap": false, + "suppressAttributes": true, + "suppressOperations": true, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdGAKalqRoke0=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdGAKalqRpCx8=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdGAKalqRq+G8=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdGAKal6Rr7ig=" + } + }, + { + "_type": "UMLUseCaseView", + "_id": "AAAAAAFdGAO/iqSO/fU=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdGAO/i6SPYmM=", + "_parent": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "model": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdGAO/i6SQA1I=", + "_parent": { + "$ref": "AAAAAAFdGAO/i6SPYmM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 96, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAO/jKSRG4E=", + "_parent": { + "$ref": "AAAAAAFdGAO/i6SPYmM=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 363.5, + "top": 299.5, + "width": 59, + "height": 13, + "autoResize": false, + "underline": false, + "text": "搜索产品", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAO/jKSSM84=", + "_parent": { + "$ref": "AAAAAAFdGAO/i6SPYmM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 96, + "top": 0, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAO/jKSTyrk=", + "_parent": { + "$ref": "AAAAAAFdGAO/i6SPYmM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 96, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 358.5, + "top": 292.5, + "width": 69, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdGAO/i6SQA1I=" + }, + "nameLabel": { + "$ref": "AAAAAAFdGAO/jKSRG4E=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdGAO/jKSSM84=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdGAO/jKSTyrk=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdGAO/jKSULYo=", + "_parent": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "model": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 48, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdGAO/jKSVv9A=", + "_parent": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "model": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 48, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdGAO/jaSWaoI=", + "_parent": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "model": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 48, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdGAO/jaSXnr0=", + "_parent": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "model": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 48, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLExtensionPointCompartmentView", + "_id": "AAAAAAFdGAO/jaSYrk8=", + "_parent": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "model": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 48, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 344, + "top": 288, + "width": 98, + "height": 35, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdGAO/i6SPYmM=" + }, + "wordWrap": false, + "suppressAttributes": true, + "suppressOperations": true, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdGAO/jKSULYo=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdGAO/jKSVv9A=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdGAO/jaSWaoI=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdGAO/jaSXnr0=" + }, + "extensionPointCompartment": { + "$ref": "AAAAAAFdGAO/jaSYrk8=" + } + }, + { + "_type": "UMLUseCaseView", + "_id": "AAAAAAFdGAW4LqTsTLE=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdGAW4LqTtPZc=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "model": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdGAW4LqTuTJk=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTtPZc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -48, + "top": 192, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAW4LqTvhiU=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTtPZc=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 283.5, + "top": 547.5, + "width": 59, + "height": 13, + "autoResize": false, + "underline": false, + "text": "登录", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAW4LqTwLGA=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTtPZc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -48, + "top": 192, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAW4LqTxlcc=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTtPZc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -48, + "top": 192, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 278.5, + "top": 540.5, + "width": 69, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdGAW4LqTuTJk=" + }, + "nameLabel": { + "$ref": "AAAAAAFdGAW4LqTvhiU=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdGAW4LqTwLGA=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdGAW4LqTxlcc=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdGAW4L6Ty/cY=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "model": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -24, + "top": 96, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdGAW4L6TzO8g=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "model": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -24, + "top": 96, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdGAW4L6T0ZYo=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "model": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -24, + "top": 96, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdGAW4L6T1z/U=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "model": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -24, + "top": 96, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLExtensionPointCompartmentView", + "_id": "AAAAAAFdGAW4L6T22yQ=", + "_parent": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "model": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -24, + "top": 96, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 264, + "top": 536, + "width": 98, + "height": 35, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdGAW4LqTtPZc=" + }, + "wordWrap": false, + "suppressAttributes": true, + "suppressOperations": true, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdGAW4L6Ty/cY=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdGAW4L6TzO8g=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdGAW4L6T0ZYo=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdGAW4L6T1z/U=" + }, + "extensionPointCompartment": { + "$ref": "AAAAAAFdGAW4L6T22yQ=" + } + }, + { + "_type": "UMLUseCaseView", + "_id": "AAAAAAFdGAXoA6UbzVQ=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdGAXoA6UcL8A=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UbzVQ=" + }, + "model": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdGAXoA6UdkQA=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UcL8A=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 512, + "top": -256, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAXoBKUe/lA=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UcL8A=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 557, + "top": 379.5, + "width": 64, + "height": 13, + "autoResize": false, + "underline": false, + "text": "加入购物车", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAXoBKUftL0=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UcL8A=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 512, + "top": -256, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAXoBKUgLYU=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UcL8A=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 512, + "top": -256, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 552, + "top": 372.5, + "width": 75, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdGAXoA6UdkQA=" + }, + "nameLabel": { + "$ref": "AAAAAAFdGAXoBKUe/lA=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdGAXoBKUftL0=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdGAXoBKUgLYU=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdGAXoBKUhVMo=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UbzVQ=" + }, + "model": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 256, + "top": -128, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdGAXoBKUiMzs=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UbzVQ=" + }, + "model": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 256, + "top": -128, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdGAXoBKUj3f8=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UbzVQ=" + }, + "model": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 256, + "top": -128, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdGAXoBKUk5Oc=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UbzVQ=" + }, + "model": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 256, + "top": -128, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLExtensionPointCompartmentView", + "_id": "AAAAAAFdGAXoBKUlCmw=", + "_parent": { + "$ref": "AAAAAAFdGAXoA6UbzVQ=" + }, + "model": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 256, + "top": -128, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 536, + "top": 368, + "width": 106, + "height": 35, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdGAXoA6UcL8A=" + }, + "wordWrap": false, + "suppressAttributes": true, + "suppressOperations": true, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdGAXoBKUhVMo=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdGAXoBKUiMzs=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdGAXoBKUj3f8=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdGAXoBKUk5Oc=" + }, + "extensionPointCompartment": { + "$ref": "AAAAAAFdGAXoBKUlCmw=" + } + }, + { + "_type": "UMLUseCaseView", + "_id": "AAAAAAFdGAY0uaVJfPE=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdGAY0uqVKVek=", + "_parent": { + "$ref": "AAAAAAFdGAY0uaVJfPE=" + }, + "model": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdGAY0uqVLTx8=", + "_parent": { + "$ref": "AAAAAAFdGAY0uqVKVek=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 384, + "top": -224, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAY0uqVMq7M=", + "_parent": { + "$ref": "AAAAAAFdGAY0uqVKVek=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 491.5, + "top": 459.5, + "width": 59, + "height": 13, + "autoResize": false, + "underline": false, + "text": "下订单", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAY0uqVNyeI=", + "_parent": { + "$ref": "AAAAAAFdGAY0uqVKVek=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 384, + "top": -224, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdGAY0uqVOXIE=", + "_parent": { + "$ref": "AAAAAAFdGAY0uqVKVek=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 384, + "top": -224, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 486.5, + "top": 452.5, + "width": 69, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdGAY0uqVLTx8=" + }, + "nameLabel": { + "$ref": "AAAAAAFdGAY0uqVMq7M=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdGAY0uqVNyeI=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdGAY0uqVOXIE=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdGAY0u6VPDCs=", + "_parent": { + "$ref": "AAAAAAFdGAY0uaVJfPE=" + }, + "model": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 192, + "top": -112, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdGAY0u6VQoxY=", + "_parent": { + "$ref": "AAAAAAFdGAY0uaVJfPE=" + }, + "model": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 192, + "top": -112, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdGAY0vKVR6Lo=", + "_parent": { + "$ref": "AAAAAAFdGAY0uaVJfPE=" + }, + "model": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 192, + "top": -112, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdGAY0vKVS8fI=", + "_parent": { + "$ref": "AAAAAAFdGAY0uaVJfPE=" + }, + "model": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 192, + "top": -112, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLExtensionPointCompartmentView", + "_id": "AAAAAAFdGAY0vKVTC5U=", + "_parent": { + "$ref": "AAAAAAFdGAY0uaVJfPE=" + }, + "model": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 192, + "top": -112, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 472, + "top": 448, + "width": 98, + "height": 35, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdGAY0uqVKVek=" + }, + "wordWrap": false, + "suppressAttributes": true, + "suppressOperations": true, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdGAY0u6VPDCs=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdGAY0u6VQoxY=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdGAY0vKVR6Lo=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdGAY0vKVS8fI=" + }, + "extensionPointCompartment": { + "$ref": "AAAAAAFdGAY0vKVTC5U=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFdGBgGqqbtA6o=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabpFws=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGqqbulzY=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabpFws=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 261, + "top": 395, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGqqbvRns=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabpFws=" + }, + "visible": null, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 251, + "top": 384, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGqqbw+8Q=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabpFws=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 280, + "top": 418, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGqqbx1Oo=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabqC0k=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 179, + "top": 469, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGqqby2Nw=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabqC0k=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 172, + "top": 458, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGq6bzark=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabqC0k=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 194, + "top": 492, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGq6b0+5A=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabrjBY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 342, + "top": 323, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGq6b1X1E=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabrjBY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 332, + "top": 314, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdGBgGq6b22tU=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabrjBY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 364, + "top": 340, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdGBgGq6b3GEg=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabqC0k=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdGBgGq6b4aEw=", + "_parent": { + "$ref": "AAAAAAFdGBgGqqbtA6o=" + }, + "model": { + "$ref": "AAAAAAFdGBgGqabrjBY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "tail": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "lineStyle": 1, + "points": "170:504;372:323", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdGBgGqqbulzY=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdGBgGqqbvRns=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdGBgGqqbw+8Q=" + }, + "showMultiplicity": true, + "showType": true, + "tailRoleNameLabel": { + "$ref": "AAAAAAFdGBgGqqbx1Oo=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFdGBgGqqby2Nw=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFdGBgGq6bzark=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFdGBgGq6b0+5A=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFdGBgGq6b1X1E=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFdGBgGq6b22tU=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFdGBgGq6b3GEg=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFdGBgGq6b4aEw=" + } + }, + { + "_type": "UMLUseCaseView", + "_id": "AAAAAAFdHQ4fLp+/lbg=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdHQ4fL5/A/FM=", + "_parent": { + "$ref": "AAAAAAFdHQ4fLp+/lbg=" + }, + "model": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ4fL5/ByjE=", + "_parent": { + "$ref": "AAAAAAFdHQ4fL5/A/FM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ4fL5/Cees=", + "_parent": { + "$ref": "AAAAAAFdHQ4fL5/A/FM=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 567.5, + "top": 283.5, + "width": 77, + "height": 13, + "autoResize": false, + "underline": false, + "text": "查看产品详情", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ4fL5/Dl2s=", + "_parent": { + "$ref": "AAAAAAFdHQ4fL5/A/FM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ4fL5/ELok=", + "_parent": { + "$ref": "AAAAAAFdHQ4fL5/A/FM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 562.5, + "top": 276.5, + "width": 88, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ4fL5/ByjE=" + }, + "nameLabel": { + "$ref": "AAAAAAFdHQ4fL5/Cees=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdHQ4fL5/Dl2s=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ4fL5/ELok=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdHQ4fL5/FyyE=", + "_parent": { + "$ref": "AAAAAAFdHQ4fLp+/lbg=" + }, + "model": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdHQ4fMJ/GK3o=", + "_parent": { + "$ref": "AAAAAAFdHQ4fLp+/lbg=" + }, + "model": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdHQ4fMJ/Hh90=", + "_parent": { + "$ref": "AAAAAAFdHQ4fLp+/lbg=" + }, + "model": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdHQ4fMJ/I0dw=", + "_parent": { + "$ref": "AAAAAAFdHQ4fLp+/lbg=" + }, + "model": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLExtensionPointCompartmentView", + "_id": "AAAAAAFdHQ4fMJ/Jrj0=", + "_parent": { + "$ref": "AAAAAAFdHQ4fLp+/lbg=" + }, + "model": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 544, + "top": 272, + "width": 124, + "height": 35, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdHQ4fL5/A/FM=" + }, + "wordWrap": false, + "suppressAttributes": true, + "suppressOperations": true, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdHQ4fL5/FyyE=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdHQ4fMJ/GK3o=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdHQ4fMJ/Hh90=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdHQ4fMJ/I0dw=" + }, + "extensionPointCompartment": { + "$ref": "AAAAAAFdHQ4fMJ/Jrj0=" + } + }, + { + "_type": "UMLExtendView", + "_id": "AAAAAAFdHQ57DaAqNs0=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ57DaAopRI=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ57DqAr1sM=", + "_parent": { + "$ref": "AAAAAAFdHQ57DaAqNs0=" + }, + "model": { + "$ref": "AAAAAAFdHQ57DaAopRI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 493, + "top": 305, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ57DaAqNs0=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ57DqAshCo=", + "_parent": { + "$ref": "AAAAAAFdHQ57DaAqNs0=" + }, + "model": { + "$ref": "AAAAAAFdHQ57DaAopRI=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 464, + "top": 279, + "width": 53, + "height": 13, + "autoResize": false, + "alpha": -1.4707737086130512, + "distance": 11.180339887498949, + "hostEdge": { + "$ref": "AAAAAAFdHQ57DaAqNs0=" + }, + "edgePosition": 1, + "underline": false, + "text": "«extend»", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ57DqAt9cs=", + "_parent": { + "$ref": "AAAAAAFdHQ57DaAqNs0=" + }, + "model": { + "$ref": "AAAAAAFdHQ57DaAopRI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 490, + "top": 276, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ57DaAqNs0=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "tail": { + "$ref": "AAAAAAFdHQ4fLp+/lbg=" + }, + "lineStyle": 1, + "points": "543:294;442:301", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHQ57DqAr1sM=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ57DqAshCo=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ57DqAt9cs=" + } + }, + { + "_type": "UMLExtendView", + "_id": "AAAAAAFdHQ7gj6GpG4g=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ7gj6Gn9wA=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ7gj6GqUSs=", + "_parent": { + "$ref": "AAAAAAFdHQ7gj6GpG4g=" + }, + "model": { + "$ref": "AAAAAAFdHQ7gj6Gn9wA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 484, + "top": 352, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ7gj6GpG4g=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ7gj6Grtfg=", + "_parent": { + "$ref": "AAAAAAFdHQ7gj6GpG4g=" + }, + "model": { + "$ref": "AAAAAAFdHQ7gj6Gn9wA=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 440, + "top": 344, + "width": 53, + "height": 13, + "autoResize": false, + "alpha": 0.5922712548213971, + "distance": 24.515301344262525, + "hostEdge": { + "$ref": "AAAAAAFdHQ7gj6GpG4g=" + }, + "edgePosition": 1, + "underline": false, + "text": "«extend»", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ7gj6Gs0Zk=", + "_parent": { + "$ref": "AAAAAAFdHQ7gj6GpG4g=" + }, + "model": { + "$ref": "AAAAAAFdHQ7gj6Gn9wA=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 495, + "top": 325, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ7gj6GpG4g=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdGAO/iqSO/fU=" + }, + "tail": { + "$ref": "AAAAAAFdGAXoA6UbzVQ=" + }, + "lineStyle": 1, + "points": "544:367;436:323", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHQ7gj6GqUSs=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ7gj6Grtfg=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ7gj6Gs0Zk=" + } + }, + { + "_type": "UMLExtendView", + "_id": "AAAAAAFdHQ8AdqIMIpQ=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ8AdqIKyBQ=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ8AdqINQDI=", + "_parent": { + "$ref": "AAAAAAFdHQ8AdqIMIpQ=" + }, + "model": { + "$ref": "AAAAAAFdHQ8AdqIKyBQ=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 581, + "top": 328, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ8AdqIMIpQ=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ8AdqIOOpY=", + "_parent": { + "$ref": "AAAAAAFdHQ8AdqIMIpQ=" + }, + "model": { + "$ref": "AAAAAAFdHQ8AdqIKyBQ=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 540, + "top": 325, + "width": 53, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHQ8AdqIMIpQ=" + }, + "edgePosition": 1, + "underline": false, + "text": "«extend»", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ8AdqIP3rw=", + "_parent": { + "$ref": "AAAAAAFdHQ8AdqIMIpQ=" + }, + "model": { + "$ref": "AAAAAAFdHQ8AdqIKyBQ=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 610, + "top": 333, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ8AdqIMIpQ=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdHQ4fLp+/lbg=" + }, + "tail": { + "$ref": "AAAAAAFdGAXoA6UbzVQ=" + }, + "lineStyle": 1, + "points": "591:367;602:307", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHQ8AdqINQDI=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ8AdqIOOpY=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ8AdqIP3rw=" + } + }, + { + "_type": "UMLUseCaseView", + "_id": "AAAAAAFdHQ882aKZU8U=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdHQ882aKagds=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKZU8U=" + }, + "model": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ882aKbCFY=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKagds=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -144, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ882aKcJss=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKagds=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 333, + "top": 419.5, + "width": 64, + "height": 13, + "autoResize": false, + "underline": false, + "text": "显示购物车", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ882aKdAj4=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKagds=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -144, + "top": 0, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ882aKeFk8=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKagds=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -144, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 328, + "top": 412.5, + "width": 75, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ882aKbCFY=" + }, + "nameLabel": { + "$ref": "AAAAAAFdHQ882aKcJss=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdHQ882aKdAj4=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ882aKeFk8=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdHQ882aKfXY8=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKZU8U=" + }, + "model": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -72, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdHQ882qKgImc=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKZU8U=" + }, + "model": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -72, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdHQ882qKhtB0=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKZU8U=" + }, + "model": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -72, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdHQ882qKiU5Q=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKZU8U=" + }, + "model": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -72, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLExtensionPointCompartmentView", + "_id": "AAAAAAFdHQ882qKj6Uw=", + "_parent": { + "$ref": "AAAAAAFdHQ882aKZU8U=" + }, + "model": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -72, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 312, + "top": 408, + "width": 106, + "height": 35, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdHQ882aKagds=" + }, + "wordWrap": false, + "suppressAttributes": true, + "suppressOperations": true, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdHQ882aKfXY8=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdHQ882qKgImc=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdHQ882qKhtB0=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdHQ882qKiU5Q=" + }, + "extensionPointCompartment": { + "$ref": "AAAAAAFdHQ882qKj6Uw=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFdHQ9cP6L6Aeo=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL2MKE=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cP6L7zvs=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL2MKE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 240, + "top": 459, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cQaL8CqM=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL2MKE=" + }, + "visible": null, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 234, + "top": 445, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cQqL9dnk=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL2MKE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 253, + "top": 486, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cQqL+ddA=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL3JSg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 187, + "top": 484, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cQqL/dNg=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL3JSg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 183, + "top": 471, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cQqMATrE=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL3JSg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 194, + "top": 511, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cQqMBCKU=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL4Obc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 295, + "top": 434, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cQqMCH3Y=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL4Obc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 287, + "top": 423, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ9cQqMDqB8=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL4Obc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 310, + "top": 457, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdHQ9cQqMEVYQ=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL3JSg=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdHQ9cQ6MFMeQ=", + "_parent": { + "$ref": "AAAAAAFdHQ9cP6L6Aeo=" + }, + "model": { + "$ref": "AAAAAAFdHQ9cPqL4Obc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdHQ882aKZU8U=" + }, + "tail": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "lineStyle": 1, + "points": "170:515;325:443", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHQ9cP6L7zvs=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ9cQaL8CqM=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ9cQqL9dnk=" + }, + "showMultiplicity": true, + "showType": true, + "tailRoleNameLabel": { + "$ref": "AAAAAAFdHQ9cQqL+ddA=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFdHQ9cQqL/dNg=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFdHQ9cQqMATrE=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFdHQ9cQqMBCKU=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFdHQ9cQqMCH3Y=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFdHQ9cQqMDqB8=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFdHQ9cQqMEVYQ=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFdHQ9cQ6MFMeQ=" + } + }, + { + "_type": "UMLExtendView", + "_id": "AAAAAAFdHQ+6bqQX4zM=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ+6bqQVrTI=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ+6b6QYXyk=", + "_parent": { + "$ref": "AAAAAAFdHQ+6bqQX4zM=" + }, + "model": { + "$ref": "AAAAAAFdHQ+6bqQVrTI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 440, + "top": 453, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ+6bqQX4zM=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ+6b6QZrOI=", + "_parent": { + "$ref": "AAAAAAFdHQ+6bqQX4zM=" + }, + "model": { + "$ref": "AAAAAAFdHQ+6bqQVrTI=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 408, + "top": 448, + "width": 53, + "height": 13, + "autoResize": false, + "alpha": 0.9596145313479303, + "distance": 13.45362404707371, + "hostEdge": { + "$ref": "AAAAAAFdHQ+6bqQX4zM=" + }, + "edgePosition": 1, + "underline": false, + "text": "«extend»", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ+6b6QaSio=", + "_parent": { + "$ref": "AAAAAAFdHQ+6bqQX4zM=" + }, + "model": { + "$ref": "AAAAAAFdHQ+6bqQVrTI=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 447, + "top": 424, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ+6bqQX4zM=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdHQ882aKZU8U=" + }, + "tail": { + "$ref": "AAAAAAFdGAY0uaVJfPE=" + }, + "lineStyle": 1, + "points": "471:452;418:439", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHQ+6b6QYXyk=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ+6b6QZrOI=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ+6b6QaSio=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFdHQ/nDaSMkME=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SIpV8=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDaSNdP4=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SIpV8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 218, + "top": 517, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDaSO7po=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SIpV8=" + }, + "visible": null, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 220, + "top": 502, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDqSPPvg=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SIpV8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 213, + "top": 546, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDqSQ5n8=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SJEfc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 197, + "top": 514, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDqSRoK0=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SJEfc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 202, + "top": 501, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDqSSHNE=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SJEfc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 189, + "top": 540, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDqSTDv4=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SKfbM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 239, + "top": 520, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDqSUKEc=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SKfbM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 239, + "top": 506, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQ/nDqSV+BU=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SKfbM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 239, + "top": 548, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdHQ/nDqSW3i8=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SJEfc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdHQ/nDqSXffo=", + "_parent": { + "$ref": "AAAAAAFdHQ/nDaSMkME=" + }, + "model": { + "$ref": "AAAAAAFdHQ/nC6SKfbM=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "tail": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "lineStyle": 1, + "points": "170:531;263:545", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHQ/nDaSNdP4=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ/nDaSO7po=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ/nDqSPPvg=" + }, + "showMultiplicity": true, + "showType": true, + "tailRoleNameLabel": { + "$ref": "AAAAAAFdHQ/nDqSQ5n8=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFdHQ/nDqSRoK0=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFdHQ/nDqSSHNE=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFdHQ/nDqSTDv4=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFdHQ/nDqSUKEc=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFdHQ/nDqSV+BU=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFdHQ/nDqSW3i8=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFdHQ/nDqSXffo=" + } + }, + { + "_type": "UMLUseCaseView", + "_id": "AAAAAAFdHQ/+ZqTrAgU=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdHQ/+ZqTsUt0=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTrAgU=" + }, + "model": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ/+Z6TtsU0=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTsUt0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -32, + "top": -16, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ/+Z6TuoEc=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTsUt0=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 283.5, + "top": 619.5, + "width": 59, + "height": 13, + "autoResize": false, + "underline": false, + "text": "注册", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ/+Z6TvnVY=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTsUt0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -32, + "top": -16, + "width": 65, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from UML)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQ/+Z6TwpEY=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTsUt0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -32, + "top": -16, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 278.5, + "top": 612.5, + "width": 69, + "height": 25, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQ/+Z6TtsU0=" + }, + "nameLabel": { + "$ref": "AAAAAAFdHQ/+Z6TuoEc=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdHQ/+Z6TvnVY=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQ/+Z6TwpEY=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFdHQ/+Z6Tx1GQ=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTrAgU=" + }, + "model": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -16, + "top": -8, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFdHQ/+aKTyY7E=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTrAgU=" + }, + "model": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -16, + "top": -8, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAFdHQ/+aKTzGEk=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTrAgU=" + }, + "model": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -16, + "top": -8, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFdHQ/+aKT0jnU=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTrAgU=" + }, + "model": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -16, + "top": -8, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLExtensionPointCompartmentView", + "_id": "AAAAAAFdHQ/+aKT1dBo=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTrAgU=" + }, + "model": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -16, + "top": -8, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": true, + "containerExtending": false, + "left": 264, + "top": 608, + "width": 98, + "height": 35, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdHQ/+ZqTsUt0=" + }, + "wordWrap": false, + "suppressAttributes": true, + "suppressOperations": true, + "suppressReceptions": true, + "showMultiplicity": true, + "showOperationSignature": true, + "attributeCompartment": { + "$ref": "AAAAAAFdHQ/+Z6Tx1GQ=" + }, + "operationCompartment": { + "$ref": "AAAAAAFdHQ/+aKTyY7E=" + }, + "receptionCompartment": { + "$ref": "AAAAAAFdHQ/+aKTzGEk=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFdHQ/+aKT0jnU=" + }, + "extensionPointCompartment": { + "$ref": "AAAAAAFdHQ/+aKT1dBo=" + } + }, + { + "_type": "UMLExtendView", + "_id": "AAAAAAFdHRAkKaVi4M8=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHRAkKaVg3zE=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRAkKaVjtmc=", + "_parent": { + "$ref": "AAAAAAFdHRAkKaVi4M8=" + }, + "model": { + "$ref": "AAAAAAFdHRAkKaVg3zE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 297, + "top": 582, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHRAkKaVi4M8=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRAkKqVk7LU=", + "_parent": { + "$ref": "AAAAAAFdHRAkKaVi4M8=" + }, + "model": { + "$ref": "AAAAAAFdHRAkKaVg3zE=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 256, + "top": 582, + "width": 53, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHRAkKaVi4M8=" + }, + "edgePosition": 1, + "underline": false, + "text": "«extend»", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRAkKqVlFnA=", + "_parent": { + "$ref": "AAAAAAFdHRAkKaVi4M8=" + }, + "model": { + "$ref": "AAAAAAFdHRAkKaVg3zE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 326, + "top": 583, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHRAkKaVi4M8=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "tail": { + "$ref": "AAAAAAFdHQ/+ZqTrAgU=" + }, + "lineStyle": 1, + "points": "312:607;312:571", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHRAkKaVjtmc=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHRAkKqVk7LU=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHRAkKqVlFnA=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFdHRA1LqWixAs=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWeYgw=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6WjkHo=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWeYgw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 232, + "top": 555, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6WkyuM=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWeYgw=" + }, + "visible": null, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 240, + "top": 542, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6Wl/Us=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWeYgw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 217, + "top": 580, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6Wm/vw=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWfgCc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 199, + "top": 536, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6WnyBs=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWfgCc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 208, + "top": 525, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6WollM=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWfgCc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 182, + "top": 557, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 2, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6WpMj4=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWgex0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 266, + "top": 574, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6WqZWg=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWgex0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 270, + "top": 562, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRA1L6WrUmo=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWgex0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 256, + "top": 600, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "edgePosition": 0, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdHRA1L6WsvHA=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWfgCc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFdHRA1L6WtjWo=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWixAs=" + }, + "model": { + "$ref": "AAAAAAFdHRA1LqWgex0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 0, + "top": 0, + "width": 10, + "height": 10, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdHQ/+ZqTrAgU=" + }, + "tail": { + "$ref": "AAAAAAFdGAKakqRiXVU=" + }, + "lineStyle": 1, + "points": "170:542;281:607", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHRA1L6WjkHo=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHRA1L6WkyuM=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHRA1L6Wl/Us=" + }, + "showMultiplicity": true, + "showType": true, + "tailRoleNameLabel": { + "$ref": "AAAAAAFdHRA1L6Wm/vw=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFdHRA1L6WnyBs=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFdHRA1L6WollM=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFdHRA1L6WpMj4=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFdHRA1L6WqZWg=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFdHRA1L6WrUmo=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFdHRA1L6WsvHA=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFdHRA1L6WtjWo=" + } + }, + { + "_type": "UMLIncludeView", + "_id": "AAAAAAFdHRBbZKYcUQM=", + "_parent": { + "$ref": "AAAAAAFdF8yd/5z3Wwc=" + }, + "model": { + "$ref": "AAAAAAFdHRBbZKYaDv0=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRBbZaYdj30=", + "_parent": { + "$ref": "AAAAAAFdHRBbZKYcUQM=" + }, + "model": { + "$ref": "AAAAAAFdHRBbZKYaDv0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 421, + "top": 516, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHRBbZKYcUQM=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRBbZaYeH/M=", + "_parent": { + "$ref": "AAAAAAFdHRBbZKYcUQM=" + }, + "model": { + "$ref": "AAAAAAFdHRBbZKYaDv0=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 400, + "top": 530, + "width": 55, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFdHRBbZKYcUQM=" + }, + "edgePosition": 1, + "underline": false, + "text": "«include»", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHRBbZaYfqBU=", + "_parent": { + "$ref": "AAAAAAFdHRBbZKYcUQM=" + }, + "model": { + "$ref": "AAAAAAFdHRBbZKYaDv0=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 410, + "top": 489, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFdHRBbZKYcUQM=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdGAW4LqTsTLE=" + }, + "tail": { + "$ref": "AAAAAAFdGAY0uaVJfPE=" + }, + "lineStyle": 1, + "points": "477:483;355:535", + "stereotypeDisplay": "label", + "showVisibility": true, + "showProperty": true, + "nameLabel": { + "$ref": "AAAAAAFdHRBbZaYdj30=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHRBbZaYeH/M=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHRBbZaYfqBU=" + } + } + ] + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFdF9Jh5Z1ciZA=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "Player", + "ownedElements": [ + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdF9dc2J3pDD0=", + "_parent": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdF9dc2J3qoKU=", + "_parent": { + "$ref": "AAAAAAFdF9dc2J3pDD0=" + }, + "reference": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "visibility": "public", + "navigable": false, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdF9dc2Z3rpO4=", + "_parent": { + "$ref": "AAAAAAFdF9dc2J3pDD0=" + }, + "reference": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdG6VR1p1Gsno=", + "_parent": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6VR1p1HuPE=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1Gsno=" + }, + "reference": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6VR1p1IHBQ=", + "_parent": { + "$ref": "AAAAAAFdG6VR1p1Gsno=" + }, + "reference": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + } + ], + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false, + "isActive": false + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFdF9NBMZ2Jv50=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "DiceGame", + "ownedElements": [ + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdF99KOaCQNwo=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdF99KOaCRrPU=", + "_parent": { + "$ref": "AAAAAAFdF99KOaCQNwo=" + }, + "reference": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdF99KOaCSiy0=", + "_parent": { + "$ref": "AAAAAAFdF99KOaCQNwo=" + }, + "reference": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "composite", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdG6MH7Zmtypw=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6MH7ZmuDN4=", + "_parent": { + "$ref": "AAAAAAFdG6MH7Zmtypw=" + }, + "reference": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6MH7Zmvqpw=", + "_parent": { + "$ref": "AAAAAAFdG6MH7Zmtypw=" + }, + "reference": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "composite", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdG6TzIJwX5cs=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6TzIJwYZJ8=", + "_parent": { + "$ref": "AAAAAAFdG6TzIJwX5cs=" + }, + "reference": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6TzIJwZeVE=", + "_parent": { + "$ref": "AAAAAAFdG6TzIJwX5cs=" + }, + "reference": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + } + ], + "visibility": "public", + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFdF9tkT58TEw0=", + "_parent": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "name": "play", + "visibility": "public", + "isStatic": false, + "isLeaf": false, + "concurrency": "sequential", + "isQuery": false, + "isAbstract": false + } + ], + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false, + "isActive": false + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFdF9RF6Z25s+k=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "Dice", + "ownedElements": [ + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdG6Mw9ZoppUM=", + "_parent": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6Mw9ZoqSLc=", + "_parent": { + "$ref": "AAAAAAFdG6Mw9ZoppUM=" + }, + "reference": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6Mw9porfGs=", + "_parent": { + "$ref": "AAAAAAFdG6Mw9ZoppUM=" + }, + "reference": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "composite", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdG6S2iZusc0s=", + "_parent": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6S2iZutrMs=", + "_parent": { + "$ref": "AAAAAAFdG6S2iZusc0s=" + }, + "reference": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdG6S2iZuu5hA=", + "_parent": { + "$ref": "AAAAAAFdG6S2iZusc0s=" + }, + "reference": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "shared", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + } + ], + "visibility": "public", + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFdF9yOrp8l+p4=", + "_parent": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "name": "roll", + "visibility": "public", + "isStatic": false, + "isLeaf": false, + "concurrency": "sequential", + "isQuery": false, + "isAbstract": false + } + ], + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false, + "isActive": false + }, + { + "_type": "UMLActor", + "_id": "AAAAAAFdGAKakKRgInE=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "用户", + "ownedElements": [ + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdGBfGHaYFPwU=", + "_parent": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdGBfGHaYGRkw=", + "_parent": { + "$ref": "AAAAAAFdGBfGHaYFPwU=" + }, + "reference": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdGBfGHaYHyF4=", + "_parent": { + "$ref": "AAAAAAFdGBfGHaYFPwU=" + }, + "reference": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdGBfedKZIprQ=", + "_parent": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdGBfedaZJO7I=", + "_parent": { + "$ref": "AAAAAAFdGBfedKZIprQ=" + }, + "reference": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdGBfedaZKKu0=", + "_parent": { + "$ref": "AAAAAAFdGBfedKZIprQ=" + }, + "reference": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdGBf23qaao/Y=", + "_parent": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdGBf23qabaUY=", + "_parent": { + "$ref": "AAAAAAFdGBf23qaao/Y=" + }, + "reference": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdGBf23qacez0=", + "_parent": { + "$ref": "AAAAAAFdGBf23qaao/Y=" + }, + "reference": { + "$ref": "AAAAAAFdGAVH16S6bA0=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdGBgGqabpFws=", + "_parent": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdGBgGqabqC0k=", + "_parent": { + "$ref": "AAAAAAFdGBgGqabpFws=" + }, + "reference": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdGBgGqabrjBY=", + "_parent": { + "$ref": "AAAAAAFdGBgGqabpFws=" + }, + "reference": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdHQ9cPqL2MKE=", + "_parent": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdHQ9cPqL3JSg=", + "_parent": { + "$ref": "AAAAAAFdHQ9cPqL2MKE=" + }, + "reference": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdHQ9cPqL4Obc=", + "_parent": { + "$ref": "AAAAAAFdHQ9cPqL2MKE=" + }, + "reference": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdHQ/nC6SIpV8=", + "_parent": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdHQ/nC6SJEfc=", + "_parent": { + "$ref": "AAAAAAFdHQ/nC6SIpV8=" + }, + "reference": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdHQ/nC6SKfbM=", + "_parent": { + "$ref": "AAAAAAFdHQ/nC6SIpV8=" + }, + "reference": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFdHRA1LqWeYgw=", + "_parent": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdHRA1LqWfgCc=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWeYgw=" + }, + "reference": { + "$ref": "AAAAAAFdGAKakKRgInE=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFdHRA1LqWgex0=", + "_parent": { + "$ref": "AAAAAAFdHRA1LqWeYgw=" + }, + "reference": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "visibility": "public", + "navigable": true, + "aggregation": "none", + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "isID": false + }, + "visibility": "public", + "isDerived": false + } + ], + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdGAO/iaSMYxI=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "搜索产品", + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdGAVH16S6bA0=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "查看产品细节", + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdGAW4LaTq8JA=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "登录", + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdGAXoAqUZa/0=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "加入购物车", + "ownedElements": [ + { + "_type": "UMLExtend", + "_id": "AAAAAAFdHQ7gj6Gn9wA=", + "_parent": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "source": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "target": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "visibility": "public" + }, + { + "_type": "UMLExtend", + "_id": "AAAAAAFdHQ8AdqIKyBQ=", + "_parent": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "source": { + "$ref": "AAAAAAFdGAXoAqUZa/0=" + }, + "target": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "visibility": "public" + } + ], + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdGAY0uKVHc28=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "下订单", + "ownedElements": [ + { + "_type": "UMLInclude", + "_id": "AAAAAAFdGBT5vaXucnQ=", + "_parent": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "source": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "target": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visibility": "public" + }, + { + "_type": "UMLExtend", + "_id": "AAAAAAFdHQ+6bqQVrTI=", + "_parent": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "source": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "target": { + "$ref": "AAAAAAFdHQ882KKXixg=" + }, + "visibility": "public" + }, + { + "_type": "UMLInclude", + "_id": "AAAAAAFdHRBbZKYaDv0=", + "_parent": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "source": { + "$ref": "AAAAAAFdGAY0uKVHc28=" + }, + "target": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visibility": "public" + } + ], + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdGAfYTKV2bvY=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "产品", + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCaseSubject", + "_id": "AAAAAAFdGBPCQaWkzJE=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "UseCaseSubject1", + "visibility": "public" + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFdG6RIwpshRVw=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "Display", + "visibility": "public", + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFdG6UEzJx4aDY=", + "_parent": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "name": "showResult", + "visibility": "public", + "isStatic": false, + "isLeaf": false, + "concurrency": "sequential", + "isQuery": false, + "isAbstract": false + } + ], + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false, + "isActive": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdHQ4fLZ+9HuM=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "查看产品详情", + "ownedElements": [ + { + "_type": "UMLExtend", + "_id": "AAAAAAFdHQ57DaAopRI=", + "_parent": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "source": { + "$ref": "AAAAAAFdHQ4fLZ+9HuM=" + }, + "target": { + "$ref": "AAAAAAFdGAO/iaSMYxI=" + }, + "visibility": "public" + } + ], + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdHQ882KKXixg=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "显示购物车", + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + }, + { + "_type": "UMLUseCase", + "_id": "AAAAAAFdHQ/+ZqTpmg8=", + "_parent": { + "$ref": "AAAAAAFdF8bUGpzmKj4=" + }, + "name": "注册", + "ownedElements": [ + { + "_type": "UMLExtend", + "_id": "AAAAAAFdHRAkKaVg3zE=", + "_parent": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "source": { + "$ref": "AAAAAAFdHQ/+ZqTpmg8=" + }, + "target": { + "$ref": "AAAAAAFdGAW4LaTq8JA=" + }, + "visibility": "public" + } + ], + "visibility": "public", + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + } + ], + "visibility": "public" + }, + { + "_type": "UMLCollaboration", + "_id": "AAAAAAFdF9ENuJ1Khbw=", + "_parent": { + "$ref": "AAAAAAFF+h6SjaM2Hec=" + }, + "name": "Collaboration", + "ownedElements": [ + { + "_type": "UMLInteraction", + "_id": "AAAAAAFdF9ENuJ1LFdg=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1Khbw=" + }, + "name": "Interaction", + "ownedElements": [ + { + "_type": "UMLSequenceDiagram", + "_id": "AAAAAAFdF9ENuJ1MVCI=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "掷骰子顺序图", + "visible": true, + "defaultDiagram": false, + "ownedViews": [ + { + "_type": "UMLFrameView", + "_id": "AAAAAAFdF9ENuJ1NVPk=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdF9ENuZ1OWM4=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1NVPk=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 76, + "top": 10, + "width": 79, + "height": 13, + "autoResize": false, + "underline": false, + "text": "掷骰子顺序图", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF9ENuZ1P378=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1NVPk=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 10, + "top": 10, + "width": 61, + "height": 13, + "autoResize": false, + "underline": false, + "text": "interaction", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 5, + "top": 5, + "width": 695, + "height": 595, + "autoResize": false, + "nameLabel": { + "$ref": "AAAAAAFdF9ENuZ1OWM4=" + }, + "frameTypeLabel": { + "$ref": "AAAAAAFdF9ENuZ1P378=" + } + }, + { + "_type": "UMLSeqLifelineView", + "_id": "AAAAAAFdF+OdeqGXCpA=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdF+OdeqGWcbc=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdF+OdeqGYEEU=", + "_parent": { + "$ref": "AAAAAAFdF+OdeqGXCpA=" + }, + "model": { + "$ref": "AAAAAAFdF+OdeqGWcbc=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdF+Ode6GZUBc=", + "_parent": { + "$ref": "AAAAAAFdF+OdeqGYEEU=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -160, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+Ode6GavkA=", + "_parent": { + "$ref": "AAAAAAFdF+OdeqGYEEU=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 85, + "top": 47, + "width": 95, + "height": 13, + "autoResize": false, + "underline": false, + "text": "player: Player", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+Ode6Gb7JQ=", + "_parent": { + "$ref": "AAAAAAFdF+OdeqGYEEU=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -160, + "top": 0, + "width": 99, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from Interaction)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+OdfKGc5R8=", + "_parent": { + "$ref": "AAAAAAFdF+OdeqGYEEU=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -160, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 80, + "top": 40, + "width": 105, + "height": 40, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdF+Ode6GZUBc=" + }, + "nameLabel": { + "$ref": "AAAAAAFdF+Ode6GavkA=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdF+Ode6Gb7JQ=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdF+OdfKGc5R8=" + } + }, + { + "_type": "UMLLinePartView", + "_id": "AAAAAAFdF+OdfKGdq7U=", + "_parent": { + "$ref": "AAAAAAFdF+OdeqGXCpA=" + }, + "model": { + "$ref": "AAAAAAFdF+OdeqGWcbc=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 133, + "top": 80, + "width": 1, + "height": 271, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 80, + "top": 40, + "width": 105, + "height": 311, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdF+OdeqGYEEU=" + }, + "wordWrap": false, + "linePart": { + "$ref": "AAAAAAFdF+OdfKGdq7U=" + } + }, + { + "_type": "UMLSeqLifelineView", + "_id": "AAAAAAFdF+RP86G5S4s=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdF+RP86G6V2w=", + "_parent": { + "$ref": "AAAAAAFdF+RP86G5S4s=" + }, + "model": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdF+RP86G7KPw=", + "_parent": { + "$ref": "AAAAAAFdF+RP86G6V2w=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -80, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+RP9KG8g9w=", + "_parent": { + "$ref": "AAAAAAFdF+RP86G6V2w=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 205, + "top": 47, + "width": 143, + "height": 13, + "autoResize": false, + "underline": false, + "text": "diceGame: DiceGame", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+RP9KG9Bck=", + "_parent": { + "$ref": "AAAAAAFdF+RP86G6V2w=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -80, + "top": 0, + "width": 99, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from Interaction)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+RP9KG+FO0=", + "_parent": { + "$ref": "AAAAAAFdF+RP86G6V2w=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -80, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 200, + "top": 40, + "width": 153, + "height": 40, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdF+RP86G7KPw=" + }, + "nameLabel": { + "$ref": "AAAAAAFdF+RP9KG8g9w=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdF+RP9KG9Bck=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdF+RP9KG+FO0=" + } + }, + { + "_type": "UMLLinePartView", + "_id": "AAAAAAFdF+RP9KG/qmo=", + "_parent": { + "$ref": "AAAAAAFdF+RP86G5S4s=" + }, + "model": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 277, + "top": 80, + "width": 1, + "height": 283, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 200, + "top": 40, + "width": 153, + "height": 323, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdF+RP86G6V2w=" + }, + "wordWrap": false, + "linePart": { + "$ref": "AAAAAAFdF+RP9KG/qmo=" + } + }, + { + "_type": "UMLSeqLifelineView", + "_id": "AAAAAAFdF+UgqKHvECc=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdF+Ugp6Huy74=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdF+UgqKHwKJY=", + "_parent": { + "$ref": "AAAAAAFdF+UgqKHvECc=" + }, + "model": { + "$ref": "AAAAAAFdF+Ugp6Huy74=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdF+UgqaHx/1c=", + "_parent": { + "$ref": "AAAAAAFdF+UgqKHwKJY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -96, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+UgqaHy7Ec=", + "_parent": { + "$ref": "AAAAAAFdF+UgqKHwKJY=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 373, + "top": 47, + "width": 78, + "height": 13, + "autoResize": false, + "underline": false, + "text": "dice1: Dice", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+UgqaHzfxg=", + "_parent": { + "$ref": "AAAAAAFdF+UgqKHwKJY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -96, + "top": 0, + "width": 99, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from Interaction)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdF+UgqaH0Efk=", + "_parent": { + "$ref": "AAAAAAFdF+UgqKHwKJY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -96, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 368, + "top": 40, + "width": 88, + "height": 40, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdF+UgqaHx/1c=" + }, + "nameLabel": { + "$ref": "AAAAAAFdF+UgqaHy7Ec=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdF+UgqaHzfxg=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdF+UgqaH0Efk=" + } + }, + { + "_type": "UMLLinePartView", + "_id": "AAAAAAFdF+UgqaH1Ack=", + "_parent": { + "$ref": "AAAAAAFdF+UgqKHvECc=" + }, + "model": { + "$ref": "AAAAAAFdF+Ugp6Huy74=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 412, + "top": 80, + "width": 1, + "height": 209, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 368, + "top": 40, + "width": 88, + "height": 249, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdF+UgqKHwKJY=" + }, + "wordWrap": false, + "linePart": { + "$ref": "AAAAAAFdF+UgqaH1Ack=" + } + }, + { + "_type": "UMLSeqMessageView", + "_id": "AAAAAAFdF+TkA6HYtTw=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdF+TkA6HXVqw=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdF+TkBKHZZ+Y=", + "_parent": { + "$ref": "AAAAAAFdF+TkA6HYtTw=" + }, + "model": { + "$ref": "AAAAAAFdF+TkA6HXVqw=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 162, + "top": 167, + "width": 79, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdF+TkA6HYtTw=" + }, + "edgePosition": 1, + "underline": false, + "text": "1 : play", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdF+TkBKHaWq4=", + "_parent": { + "$ref": "AAAAAAFdF+TkA6HYtTw=" + }, + "model": { + "$ref": "AAAAAAFdF+TkA6HXVqw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 201, + "top": 152, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdF+TkA6HYtTw=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdF+TkBKHbuuY=", + "_parent": { + "$ref": "AAAAAAFdF+TkA6HYtTw=" + }, + "model": { + "$ref": "AAAAAAFdF+TkA6HXVqw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 201, + "top": 187, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdF+TkA6HYtTw=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLActivationView", + "_id": "AAAAAAFdF+TkBKHctG4=", + "_parent": { + "$ref": "AAAAAAFdF+TkA6HYtTw=" + }, + "model": { + "$ref": "AAAAAAFdF+TkA6HXVqw=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 270, + "top": 183, + "width": 14, + "height": 154, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdF+RP9KG/qmo=" + }, + "tail": { + "$ref": "AAAAAAFdF+OdfKGdq7U=" + }, + "lineStyle": 0, + "points": "133:183;270:183", + "nameLabel": { + "$ref": "AAAAAAFdF+TkBKHZZ+Y=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdF+TkBKHaWq4=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdF+TkBKHbuuY=" + }, + "activation": { + "$ref": "AAAAAAFdF+TkBKHctG4=" + }, + "showProperty": true, + "showType": true + }, + { + "_type": "UMLSeqMessageView", + "_id": "AAAAAAFdF/sfZqPnl+I=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdF/sfZaPm+zc=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdF/sfZqPogK0=", + "_parent": { + "$ref": "AAAAAAFdF/sfZqPnl+I=" + }, + "model": { + "$ref": "AAAAAAFdF/sfZaPm+zc=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 305, + "top": 178, + "width": 79, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdF/sfZqPnl+I=" + }, + "edgePosition": 1, + "underline": false, + "text": "2 : roll", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdF/sfZqPp5uY=", + "_parent": { + "$ref": "AAAAAAFdF/sfZqPnl+I=" + }, + "model": { + "$ref": "AAAAAAFdF/sfZaPm+zc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 344, + "top": 163, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdF/sfZqPnl+I=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdF/sfZqPqawY=", + "_parent": { + "$ref": "AAAAAAFdF/sfZqPnl+I=" + }, + "model": { + "$ref": "AAAAAAFdF/sfZaPm+zc=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 344, + "top": 198, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdF/sfZqPnl+I=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLActivationView", + "_id": "AAAAAAFdF/sfZqPrd6c=", + "_parent": { + "$ref": "AAAAAAFdF/sfZqPnl+I=" + }, + "model": { + "$ref": "AAAAAAFdF/sfZaPm+zc=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 405, + "top": 194, + "width": 14, + "height": 29, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdF+UgqaH1Ack=" + }, + "tail": { + "$ref": "AAAAAAFdF+RP9KG/qmo=" + }, + "lineStyle": 0, + "points": "283:194;405:194", + "nameLabel": { + "$ref": "AAAAAAFdF/sfZqPogK0=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdF/sfZqPp5uY=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdF/sfZqPqawY=" + }, + "activation": { + "$ref": "AAAAAAFdF/sfZqPrd6c=" + }, + "showProperty": true, + "showType": true + }, + { + "_type": "UMLSeqMessageView", + "_id": "AAAAAAFdHQp4LZ8Q7dM=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdHQp4LZ8P0ZU=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQp4LZ8R3GI=", + "_parent": { + "$ref": "AAAAAAFdHQp4LZ8Q7dM=" + }, + "model": { + "$ref": "AAAAAAFdHQp4LZ8P0ZU=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 357, + "top": 232, + "width": 79, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdHQp4LZ8Q7dM=" + }, + "edgePosition": 1, + "underline": false, + "text": "3 : roll", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQp4LZ8S8XE=", + "_parent": { + "$ref": "AAAAAAFdHQp4LZ8Q7dM=" + }, + "model": { + "$ref": "AAAAAAFdHQp4LZ8P0ZU=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 396, + "top": 217, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHQp4LZ8Q7dM=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQp4LZ8TEEM=", + "_parent": { + "$ref": "AAAAAAFdHQp4LZ8Q7dM=" + }, + "model": { + "$ref": "AAAAAAFdHQp4LZ8P0ZU=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 396, + "top": 252, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdHQp4LZ8Q7dM=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLActivationView", + "_id": "AAAAAAFdHQp4LZ8UAbU=", + "_parent": { + "$ref": "AAAAAAFdHQp4LZ8Q7dM=" + }, + "model": { + "$ref": "AAAAAAFdHQp4LZ8P0ZU=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 509, + "top": 248, + "width": 14, + "height": 29, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdHQn7x57ralA=" + }, + "tail": { + "$ref": "AAAAAAFdF+RP9KG/qmo=" + }, + "lineStyle": 0, + "points": "283:248;509:248", + "nameLabel": { + "$ref": "AAAAAAFdHQp4LZ8R3GI=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQp4LZ8S8XE=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQp4LZ8TEEM=" + }, + "activation": { + "$ref": "AAAAAAFdHQp4LZ8UAbU=" + }, + "showProperty": true, + "showType": true + }, + { + "_type": "UMLSeqLifelineView", + "_id": "AAAAAAFdHQn7xp7lBR4=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdHQn7xp7kRhc=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdHQn7x57mVek=", + "_parent": { + "$ref": "AAAAAAFdHQn7xp7lBR4=" + }, + "model": { + "$ref": "AAAAAAFdHQn7xp7kRhc=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdHQn7x57nLbY=", + "_parent": { + "$ref": "AAAAAAFdHQn7x57mVek=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -176, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQn7x57o4+o=", + "_parent": { + "$ref": "AAAAAAFdHQn7x57mVek=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 477, + "top": 47, + "width": 78, + "height": 13, + "autoResize": false, + "underline": false, + "text": "dice2: Dice", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQn7x57pTmg=", + "_parent": { + "$ref": "AAAAAAFdHQn7x57mVek=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -176, + "top": 0, + "width": 99, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from Interaction)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQn7x57qzPQ=", + "_parent": { + "$ref": "AAAAAAFdHQn7x57mVek=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -176, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 472, + "top": 40, + "width": 88, + "height": 40, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQn7x57nLbY=" + }, + "nameLabel": { + "$ref": "AAAAAAFdHQn7x57o4+o=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdHQn7x57pTmg=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQn7x57qzPQ=" + } + }, + { + "_type": "UMLLinePartView", + "_id": "AAAAAAFdHQn7x57ralA=", + "_parent": { + "$ref": "AAAAAAFdHQn7xp7lBR4=" + }, + "model": { + "$ref": "AAAAAAFdHQn7xp7kRhc=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 516, + "top": 80, + "width": 1, + "height": 233, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 472, + "top": 40, + "width": 88, + "height": 273, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdHQn7x57mVek=" + }, + "wordWrap": false, + "linePart": { + "$ref": "AAAAAAFdHQn7x57ralA=" + } + }, + { + "_type": "UMLSeqMessageView", + "_id": "AAAAAAFdHQrka58ztv8=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdHQrkap8ywZE=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQrka580RZc=", + "_parent": { + "$ref": "AAAAAAFdHQrka58ztv8=" + }, + "model": { + "$ref": "AAAAAAFdHQrkap8ywZE=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 280, + "top": 259, + "width": 84, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdHQrka58ztv8=" + }, + "edgePosition": 1, + "underline": false, + "text": "4 : checkIfWin", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQrka581cj0=", + "_parent": { + "$ref": "AAAAAAFdHQrka58ztv8=" + }, + "model": { + "$ref": "AAAAAAFdHQrkap8ywZE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 337, + "top": 259, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHQrka58ztv8=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQrka582R4Q=", + "_parent": { + "$ref": "AAAAAAFdHQrka58ztv8=" + }, + "model": { + "$ref": "AAAAAAFdHQrkap8ywZE=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 303, + "top": 260, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdHQrka58ztv8=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLActivationView", + "_id": "AAAAAAFdHQrka5831N4=", + "_parent": { + "$ref": "AAAAAAFdHQrka58ztv8=" + }, + "model": { + "$ref": "AAAAAAFdHQrkap8ywZE=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 277, + "top": 276, + "width": 14, + "height": 29, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdF+RP9KG/qmo=" + }, + "tail": { + "$ref": "AAAAAAFdF+RP9KG/qmo=" + }, + "lineStyle": 0, + "points": "283:256;313:256;313:276;290:276", + "nameLabel": { + "$ref": "AAAAAAFdHQrka580RZc=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQrka581cj0=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQrka582R4Q=" + }, + "activation": { + "$ref": "AAAAAAFdHQrka5831N4=" + }, + "showProperty": true, + "showType": true + }, + { + "_type": "UMLSeqMessageView", + "_id": "AAAAAAFdHQtT8J9UAqo=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdHQtT8J9TQQw=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQtT8J9VOo0=", + "_parent": { + "$ref": "AAAAAAFdHQtT8J9UAqo=" + }, + "model": { + "$ref": "AAAAAAFdHQtT8J9TQQw=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 191, + "top": 276, + "width": 19, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdHQtT8J9UAqo=" + }, + "edgePosition": 1, + "underline": false, + "text": "5 : ", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQtT8J9WSys=", + "_parent": { + "$ref": "AAAAAAFdHQtT8J9UAqo=" + }, + "model": { + "$ref": "AAAAAAFdHQtT8J9TQQw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 200, + "top": 291, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHQtT8J9UAqo=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQtT8Z9XeJ4=", + "_parent": { + "$ref": "AAAAAAFdHQtT8J9UAqo=" + }, + "model": { + "$ref": "AAAAAAFdHQtT8J9TQQw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 201, + "top": 256, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdHQtT8J9UAqo=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLActivationView", + "_id": "AAAAAAFdHQtT8Z9YmtM=", + "_parent": { + "$ref": "AAAAAAFdHQtT8J9UAqo=" + }, + "model": { + "$ref": "AAAAAAFdHQtT8J9TQQw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 133, + "top": 272, + "width": 14, + "height": 25, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdF+OdfKGdq7U=" + }, + "tail": { + "$ref": "AAAAAAFdF+RP9KG/qmo=" + }, + "lineStyle": 0, + "points": "270:272;133:272", + "nameLabel": { + "$ref": "AAAAAAFdHQtT8J9VOo0=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQtT8J9WSys=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQtT8Z9XeJ4=" + }, + "activation": { + "$ref": "AAAAAAFdHQtT8Z9YmtM=" + }, + "showProperty": true, + "showType": true + }, + { + "_type": "UMLSeqLifelineView", + "_id": "AAAAAAFdHQt8mJ9qCGY=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdHQt8mJ9p6E8=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFdHQt8mJ9ruWw=", + "_parent": { + "$ref": "AAAAAAFdHQt8mJ9qCGY=" + }, + "model": { + "$ref": "AAAAAAFdHQt8mJ9p6E8=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFdHQt8mZ9sOEM=", + "_parent": { + "$ref": "AAAAAAFdHQt8mJ9ruWw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -192, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQt8mZ9tGhY=", + "_parent": { + "$ref": "AAAAAAFdHQt8mJ9ruWw=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;1", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 573, + "top": 47, + "width": 109, + "height": 13, + "autoResize": false, + "underline": false, + "text": "display: Display", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQt8mZ9uDAY=", + "_parent": { + "$ref": "AAAAAAFdHQt8mJ9ruWw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -192, + "top": 0, + "width": 99, + "height": 13, + "autoResize": false, + "underline": false, + "text": "(from Interaction)", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "LabelView", + "_id": "AAAAAAFdHQt8mZ9vP4w=", + "_parent": { + "$ref": "AAAAAAFdHQt8mJ9ruWw=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": -192, + "top": 0, + "width": 0, + "height": 13, + "autoResize": false, + "underline": false, + "horizontalAlignment": 1, + "verticalAlignment": 5, + "wordWrap": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 568, + "top": 40, + "width": 119, + "height": 40, + "autoResize": false, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQt8mZ9sOEM=" + }, + "nameLabel": { + "$ref": "AAAAAAFdHQt8mZ9tGhY=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFdHQt8mZ9uDAY=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQt8mZ9vP4w=" + } + }, + { + "_type": "UMLLinePartView", + "_id": "AAAAAAFdHQt8mZ9w62Y=", + "_parent": { + "$ref": "AAAAAAFdHQt8mJ9qCGY=" + }, + "model": { + "$ref": "AAAAAAFdHQt8mJ9p6E8=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 628, + "top": 80, + "width": 1, + "height": 283, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 568, + "top": 40, + "width": 119, + "height": 323, + "autoResize": false, + "stereotypeDisplay": "label", + "showVisibility": true, + "showNamespace": false, + "showProperty": true, + "showType": true, + "nameCompartment": { + "$ref": "AAAAAAFdHQt8mJ9ruWw=" + }, + "wordWrap": false, + "linePart": { + "$ref": "AAAAAAFdHQt8mZ9w62Y=" + } + }, + { + "_type": "UMLSeqMessageView", + "_id": "AAAAAAFdHQxJ4p+Q4MA=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1MVCI=" + }, + "model": { + "$ref": "AAAAAAFdHQxJ4p+P7MY=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQxJ45+RqsQ=", + "_parent": { + "$ref": "AAAAAAFdHQxJ4p+Q4MA=" + }, + "model": { + "$ref": "AAAAAAFdHQxJ4p+P7MY=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 409, + "top": 304, + "width": 86, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdHQxJ4p+Q4MA=" + }, + "edgePosition": 1, + "underline": false, + "text": "6 : showResult", + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQxJ45+STu4=", + "_parent": { + "$ref": "AAAAAAFdHQxJ4p+Q4MA=" + }, + "model": { + "$ref": "AAAAAAFdHQxJ4p+P7MY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 452, + "top": 289, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": 1.5707963267948966, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFdHQxJ4p+Q4MA=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFdHQxJ45+TGcs=", + "_parent": { + "$ref": "AAAAAAFdHQxJ4p+Q4MA=" + }, + "model": { + "$ref": "AAAAAAFdHQxJ4p+P7MY=" + }, + "visible": false, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 452, + "top": 324, + "width": 0, + "height": 13, + "autoResize": false, + "alpha": -1.5707963267948966, + "distance": 10, + "hostEdge": { + "$ref": "AAAAAAFdHQxJ4p+Q4MA=" + }, + "edgePosition": 1, + "underline": false, + "horizontalAlignment": 2, + "verticalAlignment": 5, + "wordWrap": false + }, + { + "_type": "UMLActivationView", + "_id": "AAAAAAFdHQxJ45+UKO0=", + "_parent": { + "$ref": "AAAAAAFdHQxJ4p+Q4MA=" + }, + "model": { + "$ref": "AAAAAAFdHQxJ4p+P7MY=" + }, + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "left": 621, + "top": 320, + "width": 14, + "height": 29, + "autoResize": false + } + ], + "visible": true, + "enabled": true, + "lineColor": "#000000", + "fillColor": "#ffffff", + "fontColor": "#000000", + "font": "Arial;13;0", + "showShadow": true, + "containerChangeable": false, + "containerExtending": false, + "head": { + "$ref": "AAAAAAFdHQt8mZ9w62Y=" + }, + "tail": { + "$ref": "AAAAAAFdF+RP9KG/qmo=" + }, + "lineStyle": 0, + "points": "283:320;621:320", + "nameLabel": { + "$ref": "AAAAAAFdHQxJ45+RqsQ=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFdHQxJ45+STu4=" + }, + "propertyLabel": { + "$ref": "AAAAAAFdHQxJ45+TGcs=" + }, + "activation": { + "$ref": "AAAAAAFdHQxJ45+UKO0=" + }, + "showProperty": true, + "showType": true + } + ], + "showSequenceNumber": true, + "showSignature": true, + "showActivation": true + } + ], + "visibility": "public", + "isReentrant": true, + "messages": [ + { + "_type": "UMLMessage", + "_id": "AAAAAAFdF+TkA6HXVqw=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "play", + "source": { + "$ref": "AAAAAAFdF+OdeqGWcbc=" + }, + "target": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "visibility": "public", + "messageSort": "synchCall", + "isConcurrentIteration": false + }, + { + "_type": "UMLMessage", + "_id": "AAAAAAFdF/sfZaPm+zc=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "roll", + "source": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "target": { + "$ref": "AAAAAAFdF+Ugp6Huy74=" + }, + "visibility": "public", + "messageSort": "synchCall", + "isConcurrentIteration": false + }, + { + "_type": "UMLMessage", + "_id": "AAAAAAFdHQp4LZ8P0ZU=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "roll", + "source": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "target": { + "$ref": "AAAAAAFdHQn7xp7kRhc=" + }, + "visibility": "public", + "messageSort": "synchCall", + "isConcurrentIteration": false + }, + { + "_type": "UMLMessage", + "_id": "AAAAAAFdHQrkap8ywZE=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "checkIfWin", + "source": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "target": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "visibility": "public", + "messageSort": "synchCall", + "isConcurrentIteration": false + }, + { + "_type": "UMLMessage", + "_id": "AAAAAAFdHQtT8J9TQQw=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "source": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "target": { + "$ref": "AAAAAAFdF+OdeqGWcbc=" + }, + "visibility": "public", + "messageSort": "reply", + "isConcurrentIteration": false + }, + { + "_type": "UMLMessage", + "_id": "AAAAAAFdHQxJ4p+P7MY=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "showResult", + "source": { + "$ref": "AAAAAAFdF+RP86G4mVc=" + }, + "target": { + "$ref": "AAAAAAFdHQt8mJ9p6E8=" + }, + "visibility": "public", + "messageSort": "synchCall", + "isConcurrentIteration": false + } + ], + "participants": [ + { + "_type": "UMLLifeline", + "_id": "AAAAAAFdF+OdeqGWcbc=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "player", + "visibility": "public", + "represent": { + "$ref": "AAAAAAFdF+OdeaGVt7c=" + }, + "isMultiInstance": false + }, + { + "_type": "UMLLifeline", + "_id": "AAAAAAFdF+RP86G4mVc=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "diceGame", + "visibility": "public", + "represent": { + "$ref": "AAAAAAFdF+RP8qG3O3c=" + }, + "isMultiInstance": false + }, + { + "_type": "UMLLifeline", + "_id": "AAAAAAFdF+Ugp6Huy74=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "dice1", + "visibility": "public", + "represent": { + "$ref": "AAAAAAFdF+Ugp6Htms4=" + }, + "isMultiInstance": false + }, + { + "_type": "UMLLifeline", + "_id": "AAAAAAFdHQn7xp7kRhc=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "dice2", + "visibility": "public", + "represent": { + "$ref": "AAAAAAFdHQn7xZ7jTMM=" + }, + "isMultiInstance": false + }, + { + "_type": "UMLLifeline", + "_id": "AAAAAAFdHQt8mJ9p6E8=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1LFdg=" + }, + "name": "display", + "visibility": "public", + "represent": { + "$ref": "AAAAAAFdHQt8mJ9oW1c=" + }, + "isMultiInstance": false + } + ] + } + ], + "visibility": "public", + "attributes": [ + { + "_type": "UMLAttribute", + "_id": "AAAAAAFdF+OdeaGVt7c=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1Khbw=" + }, + "name": "Role1", + "visibility": "public", + "isStatic": false, + "isLeaf": false, + "type": { + "$ref": "AAAAAAFdF9Jh5Z1ciZA=" + }, + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "aggregation": "none", + "isID": false + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFdF+RP8qG3O3c=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1Khbw=" + }, + "name": "Role2", + "visibility": "public", + "isStatic": false, + "isLeaf": false, + "type": { + "$ref": "AAAAAAFdF9NBMZ2Jv50=" + }, + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "aggregation": "none", + "isID": false + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFdF+Ugp6Htms4=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1Khbw=" + }, + "name": "Role3", + "visibility": "public", + "isStatic": false, + "isLeaf": false, + "type": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "aggregation": "none", + "isID": false + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFdHQn7xZ7jTMM=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1Khbw=" + }, + "name": "Role4", + "visibility": "public", + "isStatic": false, + "isLeaf": false, + "type": { + "$ref": "AAAAAAFdF9RF6Z25s+k=" + }, + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "aggregation": "none", + "isID": false + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFdHQt8mJ9oW1c=", + "_parent": { + "$ref": "AAAAAAFdF9ENuJ1Khbw=" + }, + "name": "Role5", + "visibility": "public", + "isStatic": false, + "isLeaf": false, + "type": { + "$ref": "AAAAAAFdG6RIwpshRVw=" + }, + "isReadOnly": false, + "isOrdered": false, + "isUnique": false, + "isDerived": false, + "aggregation": "none", + "isID": false + } + ], + "isAbstract": false, + "isFinalSpecialization": false, + "isLeaf": false + } + ] +} \ No newline at end of file diff --git a/students/281918307/.gitignore b/students/281918307/.gitignore new file mode 100644 index 0000000000..15a7d78fcb --- /dev/null +++ b/students/281918307/.gitignore @@ -0,0 +1,153 @@ +/target/ +/.idea +/*.iml +/**/*.iml +/.setting +/*.project +.DS_Store +thrid-chongwu/.DS_Store +thrid-chongwu/src/.DS_Store +thrid-chongwu/src/main/.DS_Store +thrid-chongwu/src/main/assembly/.DS_Store +thrid-chongwu/src/main/resources/.DS_Store +thrid-chongwu/src/main/resources/templates/.DS_Store +thrid-chongwu/src/main/webapp/ +thrid-chongwu/src/test/ +thrid-chongwu/target/ +### Java template +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +### macOS template +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk +### Windows template +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk +### Archives template +# It's better to unpack these files and commit the raw source because +# git has its own built in compression methods. +*.7z +*.gz +*.bzip +*.bz2 +*.xz +*.lzma + +#packing-only formats +*.iso +*.tar + +#package management formats +*.dmg +*.xpi +*.gem +*.egg +*.deb +*.rpm +### SVN template +.svn/ diff --git a/students/281918307/ood-ocp/pom.xml b/students/281918307/ood-ocp/pom.xml new file mode 100644 index 0000000000..60ad55a370 --- /dev/null +++ b/students/281918307/ood-ocp/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + + + com.ood + ood-application + 1.0.0-SNAPSHOT + ../pom.xml + + + ood-ocp + jar + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + + + + org.springframework.boot + spring-boot-starter-freemarker + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-devtools + provided + true + + + org.apache.tomcat.embed + tomcat-embed-core + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + com.dajia.customization.Application + -Dfile.encoding=${project.build.sourceEncoding} + + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + \ No newline at end of file diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/Application.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/Application.java new file mode 100644 index 0000000000..5fc79ba891 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/Application.java @@ -0,0 +1,14 @@ +package com.ood.ocp; + +import org.apache.log4j.Logger; + +/** + * Created by ajaxfeng on 2017/6/20. + */ +public class Application { + static final Logger logger = Logger.getLogger(Application.class); + + public static void main(String[] args) { + logger.error("Application running ..."); + } +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/config/LoggerConfig.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/config/LoggerConfig.java new file mode 100644 index 0000000000..fac6f09e8c --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/config/LoggerConfig.java @@ -0,0 +1,31 @@ +package com.ood.ocp.logs.config; + +import com.ood.ocp.logs.content.ContentService; + +import java.util.List; + +/** + * Created by ajaxfeng on 2017/6/24. + */ +public interface LoggerConfig { + + public final int RAW_LOG = 1; + public final int RAW_LOG_WITH_DATE = 2; + public final int EMAIL_LOG = 1; + public final int SMS_LOG = 2; + public final int PRINT_LOG = 3; + + /** + * + * @return + */ + public ContentService getContentService(); + + /** + * 设置类型 + * + * @param sendTypeList + */ + public void setSendTypeList(List sendTypeList); + +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/config/LoggerConfigImpl.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/config/LoggerConfigImpl.java new file mode 100644 index 0000000000..f8ef1661cd --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/config/LoggerConfigImpl.java @@ -0,0 +1,78 @@ +package com.ood.ocp.logs.config; + +import com.ood.ocp.logs.content.ContentService; +import com.ood.ocp.logs.sender.LoggerSender; +import com.ood.ocp.logs.sender.LoggerSenderWacher; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * Created by ajaxfeng on 2017/6/24. + */ +@Service +public class LoggerConfigImpl implements LoggerConfig { + @Autowired + private LoggerSenderWacher loggerSenderWacher; + + private int contentType; + + private List sendTypeList; + @Autowired + private LoggerSender mailLoggerSender; + @Autowired + private LoggerSender smsLoggerSender; + @Autowired + private LoggerSender consoleLoggerSender; + @Autowired + private ContentService contentService; + @Autowired + private ContentService dateContentService; + + + @Override + public ContentService getContentService() { + if (RAW_LOG == contentType) { + return contentService; + } + if (RAW_LOG_WITH_DATE == contentType) { + return dateContentService; + } + + return contentService; + } + + private void initLoggerWacher(){ + if(sendTypeList.contains(EMAIL_LOG)){ + loggerSenderWacher.addLoggerSender(mailLoggerSender); + } + if(sendTypeList.contains(SMS_LOG)){ + loggerSenderWacher.addLoggerSender(smsLoggerSender); + } + if(sendTypeList.contains(PRINT_LOG)){ + loggerSenderWacher.addLoggerSender(consoleLoggerSender); + } + } + + public int getContentType() { + return contentType; + } + + public void setContentType(int contentType) { + this.contentType = contentType; + } + + public List getSendTypeList() { + return sendTypeList; + } + + /** + * 设置类型 + * @param sendTypeList + */ + public void setSendTypeList(List sendTypeList) { + this.sendTypeList = sendTypeList; + initLoggerWacher(); + } +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/ContentService.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/ContentService.java new file mode 100644 index 0000000000..b10fedb33a --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/ContentService.java @@ -0,0 +1,9 @@ +package com.ood.ocp.logs.content; + +/** + * Created by ajaxfeng on 2017/6/24. + */ +public interface ContentService { + + public String getConteng(String logMsg); +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/DateContentServiceImpl.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/DateContentServiceImpl.java new file mode 100644 index 0000000000..a088d537a0 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/DateContentServiceImpl.java @@ -0,0 +1,17 @@ +package com.ood.ocp.logs.content; + +import com.ood.ocp.util.DateUtil; +import org.springframework.stereotype.Service; + +/** + * 日期+log + * Created by ajaxfeng on 2017/6/24. + */ +@Service("dateContentService") +public class DateContentServiceImpl implements ContentService { + + @Override + public String getConteng(String logMsg) { + return DateUtil.getCurrentDateAsString() + ":" + logMsg; + } +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/DefaultContentServiceImpl.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/DefaultContentServiceImpl.java new file mode 100644 index 0000000000..2fee453d79 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/content/DefaultContentServiceImpl.java @@ -0,0 +1,14 @@ +package com.ood.ocp.logs.content; + +import org.springframework.stereotype.Service; + +/** + * Created by ajaxfeng on 2017/6/24. + */ +@Service("contentService") +public class DefaultContentServiceImpl implements ContentService { + @Override + public String getConteng(String logMsg) { + return logMsg; + } +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/logger/LoggerService.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/logger/LoggerService.java new file mode 100644 index 0000000000..07cda40042 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/logger/LoggerService.java @@ -0,0 +1,10 @@ +package com.ood.ocp.logs.logger; + +/** + * 发送日志 + * Created by ajaxfeng on 2017/6/24. + */ +public interface LoggerService { + + public String logger(String logMsg); +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/logger/LoggerServiceImpl.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/logger/LoggerServiceImpl.java new file mode 100644 index 0000000000..b1d370e4c6 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/logger/LoggerServiceImpl.java @@ -0,0 +1,43 @@ +package com.ood.ocp.logs.logger; + +import com.ood.ocp.logs.config.LoggerConfig; +import com.ood.ocp.logs.content.ContentService; +import com.ood.ocp.logs.sender.LoggerSender; +import com.ood.ocp.logs.sender.LoggerSenderWacher; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by ajaxfeng on 2017/6/24. + */ +@Service +public class LoggerServiceImpl implements LoggerService { + + @Autowired + LoggerConfig loggerConfig; + @Autowired + LoggerSenderWacher loggerSenderWacher; + + + @Override + public String logger(String logMsg) { + + List typeList=new ArrayList(); + typeList.add(1); + typeList.add(2); + typeList.add(3); + + loggerConfig.setSendTypeList(typeList); + + //构造内容 + ContentService contentService = loggerConfig.getContentService(); + String content = contentService.getConteng(logMsg); + + //推送消息 + loggerSenderWacher.watch(content); + return "success"; + } +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/ConsoleLoggerSender.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/ConsoleLoggerSender.java new file mode 100644 index 0000000000..ec20cb1229 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/ConsoleLoggerSender.java @@ -0,0 +1,15 @@ +package com.ood.ocp.logs.sender; + +import org.springframework.stereotype.Service; + +/** + * Created by ajaxfeng on 2017/6/25. + */ +@Service("consoleLoggerSender") +public class ConsoleLoggerSender implements LoggerSender { + @Override + public String sendLog(String logMsg) { + System.out.println(logMsg); + return null; + } +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/LoggerSender.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/LoggerSender.java new file mode 100644 index 0000000000..1aee4b6ae1 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/LoggerSender.java @@ -0,0 +1,11 @@ +package com.ood.ocp.logs.sender; + +/** + * 日志发送 + * Created by ajaxfeng on 2017/6/24. + */ +public interface LoggerSender { + + public String sendLog(String logMsg); + +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/LoggerSenderWacher.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/LoggerSenderWacher.java new file mode 100644 index 0000000000..72f5c8013a --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/LoggerSenderWacher.java @@ -0,0 +1,39 @@ +package com.ood.ocp.logs.sender; + +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 日志观察者 + * Created by ajaxfeng on 2017/6/26. + */ +@Service +public class LoggerSenderWacher { + private List loggerSenders; + + public List getLoggerSenders() { + return loggerSenders; + } + + public void addLoggerSender(LoggerSender loggerSender){ + if(!loggerSenders.contains(loggerSender)){ + loggerSenders.add(loggerSender); + } + } + + public void setLoggerSenders(List loggerSenders) { + this.loggerSenders = loggerSenders; + } + + /** + * 调用观察者发送消息 + * @param content + */ + public void watch(String content){ + for(LoggerSender loggerSender:loggerSenders){ + loggerSender.sendLog(content); + } + } + +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/MailLoggerSender.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/MailLoggerSender.java new file mode 100644 index 0000000000..513f352ff1 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/MailLoggerSender.java @@ -0,0 +1,17 @@ +package com.ood.ocp.logs.sender; + +import com.ood.ocp.util.MailUtil; +import org.springframework.stereotype.Service; + +/** + * 邮件实现类 + * Created by ajaxfeng on 2017/6/24. + */ +@Service("mailLoggerSender") +public class MailLoggerSender implements LoggerSender { + @Override + public String sendLog(String logMsg) { + MailUtil.send(logMsg); + return "success"; + } +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/SMSLoggerSender.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/SMSLoggerSender.java new file mode 100644 index 0000000000..3d6f8f3ea9 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/logs/sender/SMSLoggerSender.java @@ -0,0 +1,17 @@ +package com.ood.ocp.logs.sender; + +import com.ood.ocp.util.SMSUtil; +import org.springframework.stereotype.Service; + +/** + * 短信 + * Created by ajaxfeng on 2017/6/24. + */ +@Service("smsLoggerSender") +public class SMSLoggerSender implements LoggerSender { + @Override + public String sendLog(String logMsg) { + SMSUtil.send(logMsg); + return null; + } +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/DateUtil.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/DateUtil.java new file mode 100644 index 0000000000..927250a6c5 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/DateUtil.java @@ -0,0 +1,10 @@ +package com.ood.ocp.util; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return null; + } + +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/MailUtil.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/MailUtil.java new file mode 100644 index 0000000000..d2be222460 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/MailUtil.java @@ -0,0 +1,10 @@ +package com.ood.ocp.util; + +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/SMSUtil.java b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/SMSUtil.java new file mode 100644 index 0000000000..30851cbb40 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/java/com/ood/ocp/util/SMSUtil.java @@ -0,0 +1,10 @@ +package com.ood.ocp.util; + +public class SMSUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/281918307/ood-ocp/src/main/resources/log4j.properties b/students/281918307/ood-ocp/src/main/resources/log4j.properties new file mode 100644 index 0000000000..e70566ce70 --- /dev/null +++ b/students/281918307/ood-ocp/src/main/resources/log4j.properties @@ -0,0 +1,6 @@ +log4j.rootLogger=debug, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %l - %m%n +# Third party loggers +log4j.logger.com.ood=debug diff --git a/students/281918307/ood-srp/pom.xml b/students/281918307/ood-srp/pom.xml new file mode 100644 index 0000000000..e2c51f2ab2 --- /dev/null +++ b/students/281918307/ood-srp/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + + + com.ood + ood-application + 1.0.0-SNAPSHOT + ../pom.xml + + + ood-srp + jar + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + + + + org.springframework.boot + spring-boot-starter-freemarker + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.springframework.boot + spring-boot-devtools + provided + true + + + org.apache.tomcat.embed + tomcat-embed-core + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + com.dajia.customization.Application + -Dfile.encoding=${project.build.sourceEncoding} + + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + \ No newline at end of file diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/Application.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/Application.java new file mode 100644 index 0000000000..bc76120dd9 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/Application.java @@ -0,0 +1,18 @@ +package com.ood.srp; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.ComponentScan; + +/** + * Created by ajaxfeng on 2017/4/28. + */ +@SpringBootApplication +@EnableConfigurationProperties +@ComponentScan("com.ood.srp") +public class Application { + public static void main(String[] args) throws Exception { + SpringApplication.run(Application.class, args); + } +} \ No newline at end of file diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/file/FileService.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/file/FileService.java new file mode 100644 index 0000000000..17da5e5add --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/file/FileService.java @@ -0,0 +1,18 @@ +package com.ood.srp.file; + +import java.util.List; + +/** + * 读取文件内容 + * Created by ajaxfeng on 2017/6/20. + */ +public interface FileService { + + /** + * 读取文件内容,放到List内 + * + * @param filePath + * @return + */ + List readFile(String filePath) throws Exception; +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/file/impl/FileServiceImpl.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/file/impl/FileServiceImpl.java new file mode 100644 index 0000000000..71385b81ad --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/file/impl/FileServiceImpl.java @@ -0,0 +1,35 @@ +package com.ood.srp.file.impl; + +import com.ood.srp.file.FileService; +import com.ood.srp.util.FileUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 文件处理类 + * Created by yuxia on 2017/6/21. + */ +@Service +public class FileServiceImpl implements FileService { + + + /** + * 获取信息 + * + * @param filePath + * @return + * @throws Exception + */ + public List readFile(String filePath) throws Exception { + List lineList = new ArrayList<>(); + FileUtil fileUtil = new FileUtil(filePath); + while (fileUtil.hasNext()) { + String s = fileUtil.readLine(); + lineList.add(s); + } + fileUtil.close(); + return lineList; + } +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/Configuration.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/Configuration.java new file mode 100644 index 0000000000..88eb7af347 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/Configuration.java @@ -0,0 +1,27 @@ +package com.ood.srp.mail; + +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + static Map configurations = new HashMap<>(); + + static { + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * + * @param key + * @return + */ + public String getProperty(String key) { + + return configurations.get(key); + } + +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/ConfigurationKeys.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/ConfigurationKeys.java new file mode 100644 index 0000000000..8199bf780d --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/ConfigurationKeys.java @@ -0,0 +1,9 @@ +package com.ood.srp.mail; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/MailService.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/MailService.java new file mode 100644 index 0000000000..c85740e19e --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/MailService.java @@ -0,0 +1,29 @@ +package com.ood.srp.mail; + +import com.ood.srp.user.UserInfo; + +import java.util.List; + +/** + * Created by ajaxfeng on 2017/6/20. + */ +public interface MailService { + + /** + * 主SMTP服务器地址 + */ + public static final String SMTP_SERVER = "smtp.163.com"; + + /** + * 备用SMTP服务器地址 + */ + public static final String ALT_SMTP_SERVER = "smtp1.163.com"; + + /** + * 以哪个邮箱地址发送给用户 + */ + public static final String EMAIL_ADMIN = "admin@company.com"; + + + public String sendEmail(List userInfoList); +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/impl/MailServiceImpl.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/impl/MailServiceImpl.java new file mode 100644 index 0000000000..e633f94a55 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/mail/impl/MailServiceImpl.java @@ -0,0 +1,62 @@ +package com.ood.srp.mail.impl; + +import com.ood.srp.mail.MailService; +import com.ood.srp.user.UserInfo; +import com.ood.srp.util.MailUtil; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * Created by yuxia on 2017/6/21. + */ +@Service +public class MailServiceImpl implements MailService { + + /** + * 发送邮件 + * + * @param userInfoList + * @return + */ + @Override + public String sendEmail(List userInfoList) { + if (userInfoList == null) { + System.out.println("没有邮件发送"); + return "none"; + } + + for (UserInfo info : userInfoList) { + if (!info.getEmail().isEmpty()) { + String emailInfo = generatePromotionEmail(info); + try { + MailUtil.sendPromotionEmail(emailInfo); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + } + return "success"; + } + + /** + * 根据用户信息生成促销邮件内容。 + * + * @param userInfo 用户信息。 + * @return 返回生成的邮件。 + */ + private static String generatePromotionEmail(UserInfo userInfo) { + StringBuilder buffer = new StringBuilder(); + + buffer.append("From:").append(EMAIL_ADMIN).append("\n"); + buffer.append("To:").append(userInfo.getEmail()).append("\n"); + buffer.append("Subject:").append("您关注的产品降价了").append("\n"); + buffer.append("Content:").append("尊敬的").append(userInfo.getName()); + buffer.append(", 您关注的产品 ").append(userInfo.getProductDesc()); + buffer.append(" 降价了,欢迎购买!").append("\n"); + + System.out.println(buffer.toString()); + + return buffer.toString(); + } +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/product/ProductDetail.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/product/ProductDetail.java new file mode 100644 index 0000000000..71bfc3e52c --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/product/ProductDetail.java @@ -0,0 +1,27 @@ +package com.ood.srp.product; + +/** + * 产品信息数据类。 + * + * @since 06.18.2017 + */ +public class ProductDetail { + private String id; + private String description; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/product/ProductDetailService.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/product/ProductDetailService.java new file mode 100644 index 0000000000..0ed1920a18 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/product/ProductDetailService.java @@ -0,0 +1,17 @@ +package com.ood.srp.product; + +import java.util.List; + +/** + * 产品信息 + * Created by ajaxfeng on 2017/6/20. + */ +public interface ProductDetailService { + /** + * 获取产品详情 + * + * @param lineList + * @return + */ + public List getProductDetailList(List lineList); +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/product/impl/ProductDetailServiceImpl.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/product/impl/ProductDetailServiceImpl.java new file mode 100644 index 0000000000..9e5f4434a1 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/product/impl/ProductDetailServiceImpl.java @@ -0,0 +1,43 @@ +package com.ood.srp.product.impl; + +import com.ood.srp.product.ProductDetail; +import com.ood.srp.product.ProductDetailService; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 商品信息逻辑 + * Created by yuxia on 2017/6/21. + */ +@Service +public class ProductDetailServiceImpl implements ProductDetailService { + + /** + * 获取商品信息 + * + * @param lineList + * @return + */ + public List getProductDetailList(List lineList) { + List productDetailList = new ArrayList<>(); + lineList.forEach(line -> { + String[] splitInfo = line.split(" "); + if (splitInfo.length >= 2) { + String id = splitInfo[0]; + String description = splitInfo[1]; + ProductDetail productDetail = getProductDetail(id, description); + productDetailList.add(productDetail); + } + }); + return productDetailList; + } + + private ProductDetail getProductDetail(String id, String description) { + ProductDetail productDetail = new ProductDetail(); + productDetail.setId(id); + productDetail.setDescription(description); + return productDetail; + } +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/promotion/PromotionService.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/promotion/PromotionService.java new file mode 100644 index 0000000000..1653a981c6 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/promotion/PromotionService.java @@ -0,0 +1,16 @@ +package com.ood.srp.promotion; + +/** + * 促销处理类 + * Created by ajaxfeng on 2017/6/20. + */ +public interface PromotionService { + + /** + * 发布促销信息 + * + * @return + */ + String promotion() throws Exception; + +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/promotion/impl/PromotionServiceImpl.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/promotion/impl/PromotionServiceImpl.java new file mode 100644 index 0000000000..c7e104dde5 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/promotion/impl/PromotionServiceImpl.java @@ -0,0 +1,63 @@ +package com.ood.srp.promotion.impl; + +import com.ood.srp.file.FileService; +import com.ood.srp.mail.MailService; +import com.ood.srp.product.ProductDetail; +import com.ood.srp.product.ProductDetailService; +import com.ood.srp.promotion.PromotionService; +import com.ood.srp.user.UserInfo; +import com.ood.srp.user.UserInfoService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.ArrayList; +import java.util.List; + +/** + * 发布促销信息 + * Created by yuxia on 2017/6/21. + */ +public class PromotionServiceImpl implements PromotionService { + + private static final String FILE_PATH = "pro.text"; + + @Autowired + FileService fileService; + @Autowired + ProductDetailService productDetailService; + @Autowired + UserInfoService userInfoService; + @Autowired + MailService mailService; + + /** + *

促销


+ * 1. 获取文件内容
+ * 2. 根据文件内容,获取商品信息
+ * 3. 根据商品信息,获得用户信息
+ * 4. 针对用户信息,进行邮件发送
+ * 可扩展行: + * 1. 发送促销信息,可抽象一个接口:具体可以通过邮件、短信等手段发送 + * @return + * @throws Exception + */ + @Override + public String promotion() throws Exception { + List strings = fileService.readFile(FILE_PATH); + List productDetailList = + productDetailService.getProductDetailList(strings); + List idList = productDetailList2IDList(productDetailList); + List userInfoList = userInfoService.listUserInfo(idList); + String s = mailService.sendEmail(userInfoList); + System.out.println(s); + return s; + } + + List productDetailList2IDList(List productDetails) { + List idList = new ArrayList<>(); + for (ProductDetail productDetail : productDetails) { + idList.add(productDetail.getId()); + } + return idList; + } + +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/user/UserInfo.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/user/UserInfo.java new file mode 100644 index 0000000000..14c363fa43 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/user/UserInfo.java @@ -0,0 +1,30 @@ +package com.ood.srp.user; + +/** + * 用户数据类。 + * + * @since 06.18.2017 + */ +public class UserInfo { + private String name; + private String email; + private String productDesc; + + public UserInfo(String name, String email, String productDesc) { + this.name = name; + this.email = email; + this.productDesc = productDesc; + } + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + public String getProductDesc() { + return productDesc; + } +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/user/UserInfoService.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/user/UserInfoService.java new file mode 100644 index 0000000000..da206c4a5a --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/user/UserInfoService.java @@ -0,0 +1,25 @@ +package com.ood.srp.user; + +import java.util.List; + +/** + * 用户逻辑 + * Created by ajaxfeng on 2017/6/20. + */ +public interface UserInfoService { + /** + * 获取用户信息 + * + * @param productID + * @return + */ + public List listUserInfo(String productID); + + /** + * 获取用户信息 + * + * @param productID + * @return + */ + public List listUserInfo(List productID); +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/user/impl/UserInfoServiceImpl.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/user/impl/UserInfoServiceImpl.java new file mode 100644 index 0000000000..5ddd5f6a45 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/user/impl/UserInfoServiceImpl.java @@ -0,0 +1,31 @@ +package com.ood.srp.user.impl; + +import com.ood.srp.user.UserInfo; +import com.ood.srp.user.UserInfoService; +import com.ood.srp.util.DBUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yuxia on 2017/6/21. + */ +@Service +public class UserInfoServiceImpl implements UserInfoService { + @Override + public List listUserInfo(String productID) { + List userInfoList = DBUtil.query(productID); + return userInfoList; + } + + @Override + public List listUserInfo(List productIDList) { + List userInfoAll = new ArrayList<>(); + for (String id : productIDList) { + List userInfoList = listUserInfo(id); + userInfoAll.addAll(userInfoList); + } + return userInfoAll; + } +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/util/DBUtil.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/util/DBUtil.java new file mode 100644 index 0000000000..dc9affd22f --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/util/DBUtil.java @@ -0,0 +1,42 @@ +package com.ood.srp.util; + + +import com.ood.srp.user.UserInfo; + +import java.util.ArrayList; +import java.util.List; + +/** + * 数据库操作类。 + * 管理数据库连接,查询等操作。 + * + * @since 06.19.2017 + */ +public class DBUtil { + + //TODO 此处添加数据库连接信息 + + + /** + * 应该从数据库读, 但是简化为直接生成。 + * 给一个产品详情,返回一个Array List记载所有订阅该产品的用户信息(名字,邮箱,订阅的产品名称)。 + * + * @param productID 传产品详情。产品id用来查询数据库。产品名称用于和用户信息绑定 + * @return 返回数据库中所有的查询到的结果。 + */ + public static List query(String productID) { + if (productID == null) + return new ArrayList<>(); + + String sendMailQuery = "Select name from subscriptions " + + "where product_id= '" + productID + "' " + + "and send_mail=1 "; + //假装用sendMilQuery查了数据库,生成了userList作为查询结果 + List userList = new ArrayList<>(); + for (int i = 1; i <= 3; i++) { + UserInfo newInfo = new UserInfo("User" + i, "aa@bb.com", ""); + userList.add(newInfo); + } + return userList; + } +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/util/FileUtil.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/util/FileUtil.java new file mode 100644 index 0000000000..05aa9d9c5b --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/util/FileUtil.java @@ -0,0 +1,37 @@ +package com.ood.srp.util; + + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; + +/** + * 文件操作类。 + * 负责文件句柄的维护。 + * 此类会打开促销文件,促销文件默认按照: + * "id" 空格 "产品名称" + * 进行存储,每行一条促销信息。 + * + * @since 06.19.2017 + */ +public class FileUtil { + private Scanner scanner; + + + public FileUtil(String filePath) throws FileNotFoundException { + scanner = new Scanner(new File(filePath)); + } + + public String readLine() { + String wholeInfo = scanner.nextLine(); + return wholeInfo; + } + + public boolean hasNext() { + return scanner.hasNextLine(); + } + + public void close() { + scanner.close(); + } +} diff --git a/students/281918307/ood-srp/src/main/java/com/ood/srp/util/MailUtil.java b/students/281918307/ood-srp/src/main/java/com/ood/srp/util/MailUtil.java new file mode 100644 index 0000000000..a6953d5306 --- /dev/null +++ b/students/281918307/ood-srp/src/main/java/com/ood/srp/util/MailUtil.java @@ -0,0 +1,37 @@ +package com.ood.srp.util; + + +/** + * 邮件发送类。 + * 管理邮箱连接,发送等操作。 + * + * @since 06.19.2017 + */ +public class MailUtil { + + /** + * SMTP连接失败异常。 + * 可用getMessage()获得异常内容。 + */ + public static class SMTPConnectionFailedException extends Throwable { + public SMTPConnectionFailedException(String message) { + super(message); + } + } + + + /** + * 假装在发邮件。默认使用主SMTP发送,若发送失败则使用备用SMTP发送。 + * 仍然失败,则抛出SMTPConnectFailException异常。 + * + * @param emailInfo 要发送的邮件内容 + * @throws SMTPConnectionFailedException 若主副SMTP服务器均连接失败,抛出异常。异常中包含完整的发送失败的邮件内容。可通过getMessage()方法获得邮件内容。 + */ + public static void sendPromotionEmail(String emailInfo) throws Exception { + //默认以SMTP_SERVER 发送 + //如果发送失败以ALT_SMTP_SERVER 重新发送 + //如果还失败,throw new SMTPConnectionFailedException(emailInfo). + } + + +} diff --git a/students/281918307/ood-srp/src/main/resources/application.properties b/students/281918307/ood-srp/src/main/resources/application.properties new file mode 100644 index 0000000000..a7e97d369d --- /dev/null +++ b/students/281918307/ood-srp/src/main/resources/application.properties @@ -0,0 +1,2 @@ +server.port=8080 +spring.application.name=ood-srp diff --git a/students/281918307/ood-srp/src/main/resources/log4j.properties b/students/281918307/ood-srp/src/main/resources/log4j.properties new file mode 100644 index 0000000000..e70566ce70 --- /dev/null +++ b/students/281918307/ood-srp/src/main/resources/log4j.properties @@ -0,0 +1,6 @@ +log4j.rootLogger=debug, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %l - %m%n +# Third party loggers +log4j.logger.com.ood=debug diff --git a/students/281918307/pom.xml b/students/281918307/pom.xml new file mode 100644 index 0000000000..61717fdeb7 --- /dev/null +++ b/students/281918307/pom.xml @@ -0,0 +1,80 @@ + + + 4.0.0 + + com.ood + ood-application + pom + 1.0.0-SNAPSHOT + + + ood-ocp + ood-srp + + + + + + aliyun maven + http://maven.aliyun.com/nexus/content/groups/public + + + maven.nuxeo.org + http://maven.nuxeo.org/nexus/content/groups/public/ + + + + + + + UTF-8 + + 1.8 + UTF-8 + 1.5.3.RELEASE + + + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + junit + junit + 4.12 + test + + + + log4j + log4j + 1.2.16 + + + org.slf4j + slf4j-api + 1.6.1 + + + org.slf4j + slf4j-log4j12 + 1.6.1 + + + + + + + \ No newline at end of file diff --git a/students/281918307/readme.md b/students/281918307/readme.md new file mode 100644 index 0000000000..fdf99a9b89 --- /dev/null +++ b/students/281918307/readme.md @@ -0,0 +1,2 @@ +ood application + diff --git a/students/2831099157/ood-assignment/out/production/main/com/coderising/ood/srp/product_promotion.txt b/students/2831099157/ood-assignment/out/production/main/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..b7a974adb3 --- /dev/null +++ b/students/2831099157/ood-assignment/out/production/main/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/2831099157/ood-assignment/pom.xml b/students/2831099157/ood-assignment/pom.xml new file mode 100644 index 0000000000..cac49a5328 --- /dev/null +++ b/students/2831099157/ood-assignment/pom.xml @@ -0,0 +1,32 @@ + + 4.0.0 + + com.coderising + ood-assignment + 0.0.1-SNAPSHOT + jar + + ood-assignment + http://maven.apache.org + + + UTF-8 + + + + + + junit + junit + 4.12 + + + + + + aliyunmaven + http://maven.aliyun.com/nexus/content/groups/public/ + + + diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java new file mode 100644 index 0000000000..cd49152e09 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java @@ -0,0 +1,20 @@ +package com.coderising.ood.ocp; + +import com.coderising.ood.ocp.formatter.Formatter; +import com.coderising.ood.ocp.sender.Sender; + +public class Logger { + private Formatter formatter; + private Sender sender; + + public Logger(Formatter formatter,Sender sender){ + this.formatter = formatter; + this.sender = sender; + } + public void log(String msg){ + sender.send(formatter.format(msg)) ; + } + + +} + diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/MainTest.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/MainTest.java new file mode 100644 index 0000000000..cfa756a14e --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/MainTest.java @@ -0,0 +1,20 @@ +package com.coderising.ood.ocp; + +import com.coderising.ood.ocp.formatter.FormatterFactory; +import com.coderising.ood.ocp.sender.SenderFactory; + +/** + * Created by Iden on 2017/6/21. + */ +public class MainTest { + public static void main(String[] args) { + + Logger logger = new Logger(FormatterFactory.createFormatter(FormatterFactory.ONLY_STRING), + SenderFactory.createSender(SenderFactory.ENAIL)); + logger.log("Messge 1"); + + Logger logger2 = new Logger(FormatterFactory.createFormatter(FormatterFactory.WITH_CURRENT_DATA), + SenderFactory.createSender(SenderFactory.SMS)); + logger2.log("Messge 2"); + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/Formatter.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/Formatter.java new file mode 100644 index 0000000000..aee4b86da5 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/Formatter.java @@ -0,0 +1,9 @@ +package com.coderising.ood.ocp.formatter; + +/** + * Created by Iden on 2017/6/21. + */ +public interface Formatter { + + String format(String msg); +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/FormatterFactory.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/FormatterFactory.java new file mode 100644 index 0000000000..8a1b99fe6a --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/FormatterFactory.java @@ -0,0 +1,21 @@ +package com.coderising.ood.ocp.formatter; + +/** + * Created by Iden on 2017/6/21. + */ +public class FormatterFactory { + + public static final int ONLY_STRING = 1; + public static final int WITH_CURRENT_DATA = 2; + + public static Formatter createFormatter(int type) { + if (type == ONLY_STRING) { + return new OnlyStringFormatter(); + } + if (type == WITH_CURRENT_DATA) { + return new WithCurrentDateFormatter(); + } + return null; + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/OnlyStringFormatter.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/OnlyStringFormatter.java new file mode 100644 index 0000000000..312a2c8d90 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/OnlyStringFormatter.java @@ -0,0 +1,12 @@ +package com.coderising.ood.ocp.formatter; + +/** + * Created by Iden on 2017/6/21. + */ +public class OnlyStringFormatter implements Formatter{ + + @Override + public String format(String msg) { + return msg; + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/WithCurrentDateFormatter.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/WithCurrentDateFormatter.java new file mode 100644 index 0000000000..bec30c2b15 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/formatter/WithCurrentDateFormatter.java @@ -0,0 +1,16 @@ +package com.coderising.ood.ocp.formatter; + +import com.coderising.ood.ocp.utils.DateUtil; + +/** + * Created by Iden on 2017/6/21. + */ +public class WithCurrentDateFormatter implements Formatter{ + + @Override + public String format(String msg) { + String txtDate = DateUtil.getCurrentDateAsString(); + String logMsg = txtDate + ": " + msg; + return logMsg; + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/EmailSender.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/EmailSender.java new file mode 100644 index 0000000000..921003ba6f --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/EmailSender.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.sender; + +/** + * Created by Iden on 2017/6/21. + */ +public class EmailSender implements Sender { + @Override + public void send(String msg) { + System.out.println("Email发送,内容为:"+msg); + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/PrintSender.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/PrintSender.java new file mode 100644 index 0000000000..af3ce1dc57 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/PrintSender.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.sender; + +/** + * Created by Iden on 2017/6/21. + */ +public class PrintSender implements Sender { + @Override + public void send(String msg) { + System.out.println("Print发送,内容为:"+msg); + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/SMSSender.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/SMSSender.java new file mode 100644 index 0000000000..6dabed6969 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/SMSSender.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.sender; + +/** + * Created by Iden on 2017/6/21. + */ +public class SMSSender implements Sender { + @Override + public void send(String msg) { + System.out.println("SMS发送,内容为:"+ msg); + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/Sender.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/Sender.java new file mode 100644 index 0000000000..7187f23f6a --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/Sender.java @@ -0,0 +1,9 @@ +package com.coderising.ood.ocp.sender; + +/** + * Created by Iden on 2017/6/21. + */ +public interface Sender { + + void send(String msg); +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/SenderFactory.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/SenderFactory.java new file mode 100644 index 0000000000..ff2346ce58 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/sender/SenderFactory.java @@ -0,0 +1,30 @@ +package com.coderising.ood.ocp.sender; + +import com.coderising.ood.ocp.formatter.Formatter; +import com.coderising.ood.ocp.formatter.OnlyStringFormatter; +import com.coderising.ood.ocp.formatter.WithCurrentDateFormatter; + +/** + * Created by Iden on 2017/6/21. + */ +public class SenderFactory { + + public static final int ENAIL = 1; + public static final int SMS = 2; + public static final int PRINT = 3; + + + public static Sender createSender(int type) { + if (type == ENAIL) { + return new EmailSender(); + } + if (type == SMS) { + return new SMSSender(); + } + if (type == PRINT) { + return new PrintSender(); + } + return null; + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/DateUtil.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/DateUtil.java new file mode 100644 index 0000000000..4b1cf6c78d --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/DateUtil.java @@ -0,0 +1,13 @@ +package com.coderising.ood.ocp.utils; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return SimpleDateFormat.getInstance().format(new Date()); + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/MailUtil.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/MailUtil.java new file mode 100644 index 0000000000..7214e763b5 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/MailUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp.utils; + +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/SMSUtil.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/SMSUtil.java new file mode 100644 index 0000000000..d59b7e6644 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/ocp/utils/SMSUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp.utils; + +public class SMSUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java new file mode 100644 index 0000000000..9eb1b21f29 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java @@ -0,0 +1,21 @@ +package com.coderising.ood.srp; + +import com.coderising.ood.srp.service.GoodsArrivalNotice; +import com.coderising.ood.srp.service.Notice; + +/** + * 可以根据不同运营方案,添加GetProductsFunction,SendMailFunction接口实现类及Notice子类,向订阅者发送通告 + */ +public class PromotionMail { + + public static void main(String[] args) throws Exception { + //降价促销 +// Notice notice = new PricePromotion(); + //到货通知 + Notice notice = new GoodsArrivalNotice(); + notice.sendMail(notice.getProducts()); + + } + + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/configure/Configuration.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/configure/Configuration.java new file mode 100644 index 0000000000..5c0697782a --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/configure/Configuration.java @@ -0,0 +1,23 @@ +package com.coderising.ood.srp.configure; +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + static Map configurations = new HashMap<>(); + static{ + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * @param key + * @return + */ + public String getProperty(String key) { + + return configurations.get(key); + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/configure/ConfigurationKeys.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/configure/ConfigurationKeys.java new file mode 100644 index 0000000000..c9cfba4974 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/configure/ConfigurationKeys.java @@ -0,0 +1,9 @@ +package com.coderising.ood.srp.configure; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/dao/DBUtil.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/dao/DBUtil.java new file mode 100644 index 0000000000..c0e7f6508d --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/dao/DBUtil.java @@ -0,0 +1,27 @@ +package com.coderising.ood.srp.dao; +import com.coderising.ood.srp.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class DBUtil { + + /** + * 应该从数据库读, 但是简化为直接生成。 + * @param sql + * @return + */ + public static List query(String sql){ + + List userList = new ArrayList(); + for (int i = 1; i <= 3; i++) { + User user = new User(); + user.setName("User" + i); + user.seteMail("aa@bb.com"); + userList.add(user); + } + + return userList; + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/interfaces/GetProductsFunction.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/interfaces/GetProductsFunction.java new file mode 100644 index 0000000000..f0894ea3c7 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/interfaces/GetProductsFunction.java @@ -0,0 +1,13 @@ +package com.coderising.ood.srp.interfaces; + +import com.coderising.ood.srp.model.Product; + +import java.util.List; + +/** + * Created by Iden on 2017/6/14. + */ +public interface GetProductsFunction { + + List getProducts(); +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/interfaces/SendMailFunction.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/interfaces/SendMailFunction.java new file mode 100644 index 0000000000..cd27a45767 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/interfaces/SendMailFunction.java @@ -0,0 +1,13 @@ +package com.coderising.ood.srp.interfaces; + +import com.coderising.ood.srp.model.Product; + +import java.util.List; + +/** + * Created by Iden on 2017/6/14. + */ +public interface SendMailFunction { + + void sendMail(List products); +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/Mail.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/Mail.java new file mode 100644 index 0000000000..b94f27b29d --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/Mail.java @@ -0,0 +1,112 @@ +package com.coderising.ood.srp.model; + +import com.coderising.ood.srp.configure.Configuration; +import com.coderising.ood.srp.configure.ConfigurationKeys; + +/** + * Created by Iden on 2017/6/14. + */ +public class Mail { + private String fromAddress; + private String toAddress; + private String subject; + private String content; + private String smtpHost = null; + private String altSmtpHost = null; + + public Mail() { + Configuration config = new Configuration(); + fromAddress = config.getProperty(ConfigurationKeys.EMAIL_ADMIN); + smtpHost = config.getProperty(ConfigurationKeys.SMTP_SERVER); + altSmtpHost = config.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + } + + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public String getToAddress() { + return toAddress; + } + + public void setToAddress(String toAddress) { + this.toAddress = toAddress; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + + public String getSmtpHost() { + return smtpHost; + } + + public void setSmtpHost(String smtpHost) { + this.smtpHost = smtpHost; + } + + public String getAltSmtpHost() { + return altSmtpHost; + } + + public void setAltSmtpHost(String altSmtpHost) { + this.altSmtpHost = altSmtpHost; + } + + + public void send() { + if(null==toAddress){ + System.out.println("发送地址不能为空"); + return; + } + try { + sendMailBySmtpHost(); + } catch (Exception e) { + try { + sendMailBySmtpHost(); + } catch (Exception e2) { + System.out.println("通过备用 SMTP服务器发送邮件失败: " + e2.getMessage()); + } + + } + } + + private void sendMailBySmtpHost() { + System.out.println("通过SMTP服务器开始发送邮件"); + //假装发了一封邮件 + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(toAddress).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(content).append("\n"); + System.out.println(buffer.toString()); + } + + private void sendMailByAlSmtpHost() { + System.out.println("通过备用SMTP服务器开始发送邮件"); + //假装发了一封邮件 + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(toAddress).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(content).append("\n"); + System.out.println(buffer.toString()); + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/Product.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/Product.java new file mode 100644 index 0000000000..f9f5b5a145 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/Product.java @@ -0,0 +1,46 @@ +package com.coderising.ood.srp.model; + +import com.coderising.ood.srp.dao.DBUtil; + +import java.util.List; + +/** + * Created by Iden on 2017/6/14. + */ +public class Product { + String id; + String description; + + public Product(String id, String descript) { + this.id = id; + this.description = descript; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getSubscribers() { + List userList = null; + String sendMailQuery = "Select name from subscriptions " + + "where product_id= '" + id + "' " + + "and send_mail=1 "; + userList = DBUtil.query(sendMailQuery); + return userList; + + } + + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/User.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/User.java new file mode 100644 index 0000000000..38bec29f59 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/model/User.java @@ -0,0 +1,25 @@ +package com.coderising.ood.srp.model; + +/** + * Created by Iden on 2017/6/14. + */ +public class User { + String name; + String eMail; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String geteMail() { + return eMail; + } + + public void seteMail(String eMail) { + this.eMail = eMail; + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..b7a974adb3 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/GetProductsFromFile.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/GetProductsFromFile.java new file mode 100644 index 0000000000..92a1090c5e --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/GetProductsFromFile.java @@ -0,0 +1,47 @@ +package com.coderising.ood.srp.service; + +import com.coderising.ood.srp.interfaces.GetProductsFunction; +import com.coderising.ood.srp.model.Product; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Iden on 2017/6/14. + */ +public class GetProductsFromFile implements GetProductsFunction { + public String filePath = "E:\\StudyProjects\\Java\\Workspace\\HomeWork\\coding2017\\liuxin\\ood\\ood-assignment\\" + + "src\\main\\java\\com\\coderising\\ood\\srp\\product_promotion.txt"; + + @Override + public List getProducts() { + BufferedReader br = null; + List products = new ArrayList<>(); + try { + File file = new File(filePath); + br = new BufferedReader(new FileReader(file)); + String temp = null; + while ((temp = br.readLine()) != null) { + String[] data = temp.split(" "); + Product product = new Product(data[0], data[1]); + System.out.println("促销产品ID = " + product.getId()); + System.out.println("促销产品描述 = " + product.getDescription()); + products.add(product); + } + + } catch (IOException e) { + System.out.println("读取文件失败"); + } finally { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return products; + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/GoodsArrivalNotice.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/GoodsArrivalNotice.java new file mode 100644 index 0000000000..ee4723ec06 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/GoodsArrivalNotice.java @@ -0,0 +1,13 @@ +package com.coderising.ood.srp.service; + +/** + * Created by Iden on 2017/6/14. + * 到货通知 + */ +public class GoodsArrivalNotice extends Notice { + public GoodsArrivalNotice() { + getProductsFunction = new GetProductsFromFile(); + sendMailFunction = new SendGoodsArrivalMail(); + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/Notice.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/Notice.java new file mode 100644 index 0000000000..6ac8e62402 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/Notice.java @@ -0,0 +1,25 @@ +package com.coderising.ood.srp.service; + +import com.coderising.ood.srp.interfaces.GetProductsFunction; +import com.coderising.ood.srp.interfaces.SendMailFunction; +import com.coderising.ood.srp.model.Product; + +import java.util.List; + +/** + * Created by Iden on 2017/6/14. + * 各类通知(降价促销,抢购活动,到货通知等等) + */ +public abstract class Notice { + GetProductsFunction getProductsFunction; + SendMailFunction sendMailFunction; + + public List getProducts() { + return getProductsFunction.getProducts(); + } + + public void sendMail(List products) { + sendMailFunction.sendMail(products); + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/PricePromotion.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/PricePromotion.java new file mode 100644 index 0000000000..ebb59571c0 --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/PricePromotion.java @@ -0,0 +1,12 @@ +package com.coderising.ood.srp.service; + +/** + * Created by Iden on 2017/6/14. + */ +public class PricePromotion extends Notice { + public PricePromotion() { + getProductsFunction = new GetProductsFromFile(); + sendMailFunction = new SendPriceMail(); + } + +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/SendGoodsArrivalMail.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/SendGoodsArrivalMail.java new file mode 100644 index 0000000000..79f3a6985f --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/SendGoodsArrivalMail.java @@ -0,0 +1,42 @@ +package com.coderising.ood.srp.service; + +import com.coderising.ood.srp.interfaces.SendMailFunction; +import com.coderising.ood.srp.model.Mail; +import com.coderising.ood.srp.model.Product; +import com.coderising.ood.srp.model.User; + +import java.util.Iterator; +import java.util.List; + +/** + * Created by Iden on 2017/6/14. + */ +public class SendGoodsArrivalMail implements SendMailFunction { + + + @Override + public void sendMail(List products) { + if (null == products || products.size() == 0) { + System.out.println("没有发现到货的产品"); + return; + } + Iterator iterator = products.iterator(); + while (iterator.hasNext()) { + Product product = iterator.next(); + List userList = product.getSubscribers(); + if (null == userList || userList.size() == 0) { + System.out.println("没有人订阅" + product.getDescription() + " 信息"); + continue; + } + Iterator iter = userList.iterator(); + while (iter.hasNext()) { + User user = (User) iter.next(); + Mail mail = new Mail(); + mail.setSubject("您关注的产品到货了"); + mail.setContent("尊敬的 " + user.getName() + ", 您关注的产品 " + product.getDescription() + " 到货了,欢迎购买"); + mail.setToAddress(user.geteMail()); + mail.send(); + } + } + } +} diff --git a/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/SendPriceMail.java b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/SendPriceMail.java new file mode 100644 index 0000000000..bae4803e3f --- /dev/null +++ b/students/2831099157/ood-assignment/src/main/java/com/coderising/ood/srp/service/SendPriceMail.java @@ -0,0 +1,42 @@ +package com.coderising.ood.srp.service; + +import com.coderising.ood.srp.interfaces.SendMailFunction; +import com.coderising.ood.srp.model.Mail; +import com.coderising.ood.srp.model.Product; +import com.coderising.ood.srp.model.User; + +import java.util.Iterator; +import java.util.List; + +/** + * Created by Iden on 2017/6/14. + */ +public class SendPriceMail implements SendMailFunction { + + + @Override + public void sendMail(List products) { + if (null == products || products.size() == 0) { + System.out.println("没有发现需要促销的产品"); + return; + } + Iterator iterator = products.iterator(); + while (iterator.hasNext()) { + Product product = iterator.next(); + List userList = product.getSubscribers(); + if (null == userList || userList.size() == 0) { + System.out.println("没有人订阅 " + product.getDescription() + " 信息"); + continue; + } + Iterator iter = userList.iterator(); + while (iter.hasNext()) { + User user = (User) iter.next(); + Mail mail = new Mail(); + mail.setSubject("您关注的产品降价了"); + mail.setContent("尊敬的 " + user.getName() + ", 您关注的产品 " + product.getDescription() + " 降价了,欢迎购买"); + mail.setToAddress(user.geteMail()); + mail.send(); + } + } + } +} diff --git "a/students/2831099157/ood-assignment/\344\277\203\351\224\200Mail\345\217\221\351\200\201\347\273\203\344\271\240\357\274\210\351\207\215\346\236\204\357\274\211.md" "b/students/2831099157/ood-assignment/\344\277\203\351\224\200Mail\345\217\221\351\200\201\347\273\203\344\271\240\357\274\210\351\207\215\346\236\204\357\274\211.md" new file mode 100644 index 0000000000..33634cb9a9 --- /dev/null +++ "b/students/2831099157/ood-assignment/\344\277\203\351\224\200Mail\345\217\221\351\200\201\347\273\203\344\271\240\357\274\210\351\207\215\346\236\204\357\274\211.md" @@ -0,0 +1,23 @@ +# 第一次OOD练习 # + +## 需求 ## +### 原项目已经实现根据产品列表文件发送促销Mail,需求一直在变化,比如通过数据库获取促销产品或者促销活动改为到货通知,抢购等;为了应变各种变化,需重构代码。 ### +## 需求分析 ## +需求可变因素:
+ +1. 促销产品列表文件可能会变更,或者变更获取方式(如通过数据库获取) +2. 促销活动会根据运营情况变更 +## 重构方案 ## +1. 提取GetProductsFunction,SendMailFunction接口 +2. 添加Notice抽象类,针对接口添加getProducts,sendMai方法 -------各类通知(降价促销,抢购活动,到货通知等等) +3. 添加Mail,Product,User实体类 +4. Mail初始化设置smtpHost,alSmtpHost,fromAddress参数,添加sendMail功能 +5. Product添加getSubscribers功能 +6. 添加GetProductsFunction,SendMailFunction接口实现类 +7. 添加PricePromotion继承Promotion,实现降价促销功能,实例化GetProductsFunction,SendMailFunction接口 +8. 主函数调用sendMail方法 + +## 重构后 ## +重构后项目,可以根据不同运营方案,添加GetProductsFunction,SendMailFunction接口实现类及Notice子类,向订阅者发送通告 + + diff --git a/students/2831099157/out/production/main/com/coderising/ood/srp/product_promotion.txt b/students/2831099157/out/production/main/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..b7a974adb3 --- /dev/null +++ b/students/2831099157/out/production/main/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java new file mode 100644 index 0000000000..ba80f9de7d --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java @@ -0,0 +1,13 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class DateUtil { + + public static String getCurrentDateAsString() { + + return null; + } + +} \ No newline at end of file diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatByDate.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatByDate.java new file mode 100644 index 0000000000..8fcc9464cf --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatByDate.java @@ -0,0 +1,12 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class FormatByDate implements FormatLog { + @Override + public String format(String msg) { + String txtDate = DateUtil.getCurrentDateAsString(); + return txtDate + ": " + msg; + } +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatByRaw.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatByRaw.java new file mode 100644 index 0000000000..7f66cf725f --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatByRaw.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class FormatByRaw implements FormatLog { + @Override + public String format(String msg) { + return msg; + } +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatLog.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatLog.java new file mode 100644 index 0000000000..6349f02b13 --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/FormatLog.java @@ -0,0 +1,9 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public interface FormatLog { + + String format(String msg); +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java new file mode 100644 index 0000000000..e107cfd906 --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java @@ -0,0 +1,21 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class Logger { + private FormatLog formatLog; + private SendLog sendLog; + + public Logger(FormatLog f, SendLog s) { + this.formatLog = f; + this.sendLog = s; + } + + public void log(String msg) { + + String logMsg = formatLog.format(msg); + sendLog.send(logMsg); + + } +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java new file mode 100644 index 0000000000..42657a6066 --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java @@ -0,0 +1,12 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/README.md b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/README.md new file mode 100644 index 0000000000..35b2240cbd --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/README.md @@ -0,0 +1,4 @@ +ocp(开闭原则): +一个软件实体如类、模块和函数应该对扩展开放,对修改关闭。 + + diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java new file mode 100644 index 0000000000..3b2add666c --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class SMSUtil { + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLog.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLog.java new file mode 100644 index 0000000000..e9a2ed4c30 --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLog.java @@ -0,0 +1,8 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public interface SendLog { + void send(String msg); +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogByMail.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogByMail.java new file mode 100644 index 0000000000..047aab0bd9 --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogByMail.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class SendLogByMail implements SendLog { + @Override + public void send(String msg) { + MailUtil.send(msg); + } +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogByPrint.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogByPrint.java new file mode 100644 index 0000000000..86be0bc442 --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogByPrint.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class SendLogByPrint implements SendLog { + @Override + public void send(String msg) { + System.out.println(msg); + } +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogBySMS.java b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogBySMS.java new file mode 100644 index 0000000000..0898cb2f27 --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SendLogBySMS.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +/** + * Created by john on 2017/6/20. + */ +public class SendLogBySMS implements SendLog { + @Override + public void send(String msg) { + SMSUtil.send(msg); + } +} diff --git a/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/srp/README.md b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/srp/README.md new file mode 100644 index 0000000000..34afa8edb8 --- /dev/null +++ b/students/315863321/ood/ood-assignment/src/main/java/com/coderising/ood/srp/README.md @@ -0,0 +1,4 @@ +srp(单一职责原则): +应该有且仅有一个原因引起类的变更,也就是接口或类和职责的关系是一一对应的。 + + diff --git a/students/370677080/ood-assignment/pom.xml b/students/370677080/ood-assignment/pom.xml new file mode 100644 index 0000000000..d1ed73a0bf --- /dev/null +++ b/students/370677080/ood-assignment/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + + com.coderising + ood-assignment + 0.0.1-SNAPSHOT + jar + + ood-assignment + http://maven.apache.org + + + UTF-8 + + + + + + junit + junit + 4.12 + + + org.jetbrains + annotations-java5 + RELEASE + + + + + + aliyunmaven + http://maven.aliyun.com/nexus/content/groups/public/ + + + diff --git a/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/DO/ProductDetail.java b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/DO/ProductDetail.java new file mode 100644 index 0000000000..7b3041a000 --- /dev/null +++ b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/DO/ProductDetail.java @@ -0,0 +1,26 @@ +package com.coderising.ood.srp.DO; + +/** + * 产品信息数据类。 + * @since 06.18.2017 + */ +public class ProductDetail { + private String id; + private String description; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/DO/UserInfo.java b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/DO/UserInfo.java new file mode 100644 index 0000000000..14eff3c68a --- /dev/null +++ b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/DO/UserInfo.java @@ -0,0 +1,29 @@ +package com.coderising.ood.srp.DO; + +/** + * 用户数据类。 + * @since 06.18.2017 + */ +public class UserInfo { + private String name; + private String email; + private String productDesc; + + public UserInfo(String name, String email, String productDesc){ + this.name = name; + this.email = email; + this.productDesc = productDesc; + } + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + public String getProductDesc() { + return productDesc; + } +} diff --git a/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java new file mode 100644 index 0000000000..2ec66a4d47 --- /dev/null +++ b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java @@ -0,0 +1,43 @@ +package com.coderising.ood.srp; + +import com.coderising.ood.srp.DO.ProductDetail; +import com.coderising.ood.srp.DO.UserInfo; +import com.coderising.ood.srp.util.DBUtil; +import com.coderising.ood.srp.util.FileUtil; +import com.coderising.ood.srp.util.MailUtil; + +import java.io.FileNotFoundException; +import java.util.List; + +/** + * 程序入口点。 + * @since 06.19.2017 + */ +public class PromotionMail { + + public static void main(String[] args){ + final String FILE_PATH = "test.txt"; + FileUtil fileUtil; + + //尝试打开促销文件 + try { + fileUtil = new FileUtil(FILE_PATH); + } catch (FileNotFoundException e){ + System.out.println("促销文件打开失败,请确认文件路径!"); + return; + } + + sendAllEMails(fileUtil); + + fileUtil.close(); + } + + + private static void sendAllEMails(FileUtil fileUtil){ + while (fileUtil.hasNext()) { + ProductDetail productDetail = fileUtil.getNextProduct(); + List usersList = DBUtil.query(productDetail); + MailUtil.sendEmails(usersList); + } + } +} diff --git a/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/DBUtil.java b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/DBUtil.java new file mode 100644 index 0000000000..e1e0012855 --- /dev/null +++ b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/DBUtil.java @@ -0,0 +1,38 @@ +package com.coderising.ood.srp.util; +import com.coderising.ood.srp.DO.ProductDetail; +import com.coderising.ood.srp.DO.UserInfo; + +import java.util.*; + +/** + * 数据库操作类。 + * 管理数据库连接,查询等操作。 + * @since 06.19.2017 + */ +public class DBUtil { + + //TODO 此处添加数据库连接信息 + + + /** + * 应该从数据库读, 但是简化为直接生成。 + * 给一个产品详情,返回一个Array List记载所有订阅该产品的用户信息(名字,邮箱,订阅的产品名称)。 + * @param productDetail 传产品详情。产品id用来查询数据库。产品名称用于和用户信息绑定 + * @return 返回数据库中所有的查询到的结果。 + */ + public static List query(ProductDetail productDetail){ + if (productDetail == null || productDetail.getId() == null) + return new ArrayList<>(); + + String sendMailQuery = "Select name from subscriptions " + + "where product_id= '" + productDetail.getId() +"' " + + "and send_mail=1 "; + //假装用sendMilQuery查了数据库,生成了userList作为查询结果 + List userList = new ArrayList<>(); + for (int i = 1; i <= 3; i++) { + UserInfo newInfo = new UserInfo("User" + i,"aa@bb.com", productDetail.getDescription()); + userList.add(newInfo); + } + return userList; + } +} diff --git a/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/FileUtil.java b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/FileUtil.java new file mode 100644 index 0000000000..991f81a537 --- /dev/null +++ b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/FileUtil.java @@ -0,0 +1,49 @@ +package com.coderising.ood.srp.util; + + +import com.coderising.ood.srp.DO.ProductDetail; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; + +/** + * 文件操作类。 + * 负责文件句柄的维护。 + * 此类会打开促销文件,促销文件默认按照: + * "id" 空格 "产品名称" + * 进行存储,每行一条促销信息。 + * @since 06.19.2017 + */ +public class FileUtil { + private Scanner scanner; + + + public FileUtil(String filePath) throws FileNotFoundException { + scanner = new Scanner(new File(filePath)); + } + + public ProductDetail getNextProduct(){ + String wholeInfo; + ProductDetail nextProduct = new ProductDetail(); + wholeInfo = scanner.nextLine(); + + String[] splitInfo = wholeInfo.split(" "); + if (splitInfo.length < 2) + return nextProduct; + + //促销文件按照 - "id" 空格 "产品名称" 进行记录的 + nextProduct.setId(splitInfo[0]); + nextProduct.setDescription(splitInfo[1]); + + return nextProduct; + } + + public boolean hasNext(){ + return scanner.hasNextLine(); + } + + public void close(){ + scanner.close(); + } +} diff --git a/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/MailUtil.java b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/MailUtil.java new file mode 100644 index 0000000000..065286d4f9 --- /dev/null +++ b/students/370677080/ood-assignment/src/main/java/com/coderising/ood/srp/util/MailUtil.java @@ -0,0 +1,97 @@ +package com.coderising.ood.srp.util; + +import com.coderising.ood.srp.DO.UserInfo; + +import java.util.List; + + +/** + * 邮件发送类。 + * 管理邮箱连接,发送等操作。 + * @since 06.19.2017 + */ +public class MailUtil { + + /** + * SMTP连接失败异常。 + * 可用getMessage()获得异常内容。 + */ + public static class SMTPConnectionFailedException extends Throwable{ + public SMTPConnectionFailedException(String message){ + super(message); + } + } + + /** + * 主SMTP服务器地址 + */ + public static final String SMTP_SERVER = "smtp.163.com"; + + /** + * 备用SMTP服务器地址 + */ + public static final String ALT_SMTP_SERVER = "smtp1.163.com"; + + /** + * 以哪个邮箱地址发送给用户 + */ + public static final String EMAIL_ADMIN = "admin@company.com"; + + + /** + * 邮件发送操作。 + * 将降价促销邮件逐个发送给用户信息表中对应的用户。 + * 捕获SMTPConnectionFailedException。提示手动发送。并继续发送下一封邮件。 + * @param usersList 用户信息表。包含用户姓名,邮箱和订阅产品名称。 + */ + public static void sendEmails(List usersList){ + if (usersList == null) { + System.out.println("没有邮件发送"); + return; + } + + for (UserInfo info : usersList){ + if (!info.getEmail().isEmpty()) { + String emailInfo = generatePromotionEmail(info); + try { + sendPromotionEmail(emailInfo); + } catch (SMTPConnectionFailedException e){ + System.out.println("SMTP主副服务器连接失败,请手动发送以下邮件: \n"); + System.out.println(e.getMessage()); + } + } + } + } + + /** + * 假装在发邮件。默认使用主SMTP发送,若发送失败则使用备用SMTP发送。 + * 仍然失败,则抛出SMTPConnectFailException异常。 + * @param emailInfo 要发送的邮件内容 + * @throws SMTPConnectionFailedException 若主副SMTP服务器均连接失败,抛出异常。异常中包含完整的发送失败的邮件内容。可通过getMessage()方法获得邮件内容。 + */ + private static void sendPromotionEmail(String emailInfo) throws SMTPConnectionFailedException{ + //默认以SMTP_SERVER 发送 + //如果发送失败以ALT_SMTP_SERVER 重新发送 + //如果还失败,throw new SMTPConnectionFailedException(emailInfo). + } + + /** + * 根据用户信息生成促销邮件内容。 + * @param userInfo 用户信息。 + * @return 返回生成的邮件。 + */ + private static String generatePromotionEmail(UserInfo userInfo){ + StringBuilder buffer = new StringBuilder(); + + buffer.append("From:").append(EMAIL_ADMIN).append("\n"); + buffer.append("To:").append(userInfo.getEmail()).append("\n"); + buffer.append("Subject:").append("您关注的产品降价了").append("\n"); + buffer.append("Content:").append("尊敬的").append(userInfo.getName()); + buffer.append(", 您关注的产品 ").append(userInfo.getProductDesc()); + buffer.append(" 降价了,欢迎购买!").append("\n"); + + System.out.println(buffer.toString()); + + return buffer.toString(); + } +} diff --git a/students/370677080/ood-assignment/test.txt b/students/370677080/ood-assignment/test.txt new file mode 100644 index 0000000000..cb2d21edc4 --- /dev/null +++ b/students/370677080/ood-assignment/test.txt @@ -0,0 +1,5 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 +p123 diff --git a/students/395860968/OCP/AbstractNotifier.java b/students/395860968/OCP/AbstractNotifier.java new file mode 100644 index 0000000000..4aaffa4dc3 --- /dev/null +++ b/students/395860968/OCP/AbstractNotifier.java @@ -0,0 +1,10 @@ +package com.company; + +/** + * Created by kenhuang on 2017/6/20. + */ +public abstract class AbstractNotifier { + public void send(String logMsg) { + + } +} diff --git a/students/395860968/OCP/ConsoleUtil.java b/students/395860968/OCP/ConsoleUtil.java new file mode 100644 index 0000000000..e7a1e5e0ad --- /dev/null +++ b/students/395860968/OCP/ConsoleUtil.java @@ -0,0 +1,11 @@ +package com.company; + +/** + * Created by kenhuang on 2017/6/20. + */ +public class ConsoleUtil extends AbstractNotifier { + public void send(String logMsg) { + // TODO Auto-generated method stub + System.out.println("Console send: " + logMsg); + } +} diff --git a/students/395860968/OCP/DateFormatter.java b/students/395860968/OCP/DateFormatter.java new file mode 100644 index 0000000000..37719ae800 --- /dev/null +++ b/students/395860968/OCP/DateFormatter.java @@ -0,0 +1,13 @@ +package com.company; + +/** + * Created by kenhuang on 2017/6/20. + */ +public class DateFormatter extends Formatter { + @Override + public String formatMessage(String msg) { + String txtDate = DateUtil.getCurrentDateAsString(); + return txtDate + " : " + msg; + + } +} diff --git a/students/395860968/OCP/DateUtil.java b/students/395860968/OCP/DateUtil.java new file mode 100644 index 0000000000..5d0e77a475 --- /dev/null +++ b/students/395860968/OCP/DateUtil.java @@ -0,0 +1,10 @@ +package com.company; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return "20170101"; + } + +} diff --git a/students/395860968/OCP/Formatter.java b/students/395860968/OCP/Formatter.java new file mode 100644 index 0000000000..453d2a98d9 --- /dev/null +++ b/students/395860968/OCP/Formatter.java @@ -0,0 +1,10 @@ +package com.company; + +/** + * Created by kenhuang on 2017/6/20. + */ +public class Formatter { + public String formatMessage(String msg) { + return msg; + } +} diff --git a/students/395860968/OCP/Logger.java b/students/395860968/OCP/Logger.java new file mode 100644 index 0000000000..29b4396cb4 --- /dev/null +++ b/students/395860968/OCP/Logger.java @@ -0,0 +1,15 @@ +package com.company; + +public class Logger { + private AbstractNotifier notifier; + private Formatter formatter; + public Logger(Formatter formatter, AbstractNotifier notifier){ + this.formatter = formatter; + this.notifier = notifier; + } + public void log(String msg){ + String logMsg = this.formatter.formatMessage(msg); + notifier.send(logMsg); + } +} + diff --git a/students/395860968/OCP/MailUtil.java b/students/395860968/OCP/MailUtil.java new file mode 100644 index 0000000000..3b38eb1630 --- /dev/null +++ b/students/395860968/OCP/MailUtil.java @@ -0,0 +1,11 @@ +package com.company; + +public class MailUtil extends AbstractNotifier { + + @Override + public void send(String logMsg) { + // TODO Auto-generated method stub + System.out.println("Mail send: " + logMsg); + } + +} diff --git a/students/395860968/OCP/Main.java b/students/395860968/OCP/Main.java new file mode 100644 index 0000000000..cee3424004 --- /dev/null +++ b/students/395860968/OCP/Main.java @@ -0,0 +1,17 @@ +package com.company; + +public class Main { + + public static void main(String[] args) { + // write your code here + ConsoleUtil consoleUtil = new ConsoleUtil(); + Formatter formatter = new Formatter(); + Logger logger = new Logger(formatter,consoleUtil); + logger.log("abc"); + MailUtil mailUtil = new MailUtil(); + DateFormatter dateformatter = new DateFormatter(); + Logger logger2 = new Logger(dateformatter,mailUtil); + logger2.log("efg"); + + } +} diff --git a/students/395860968/OCP/SMSUtil.java b/students/395860968/OCP/SMSUtil.java new file mode 100644 index 0000000000..1bd29a0613 --- /dev/null +++ b/students/395860968/OCP/SMSUtil.java @@ -0,0 +1,10 @@ +package com.company; + +public class SMSUtil extends AbstractNotifier { + + public void send(String logMsg) { + // TODO Auto-generated method stub + System.out.println("SMS send: " + logMsg); + } + +} diff --git a/students/395860968/ood-assignment/Configuration.java b/students/395860968/SRP/Configuration.java similarity index 100% rename from students/395860968/ood-assignment/Configuration.java rename to students/395860968/SRP/Configuration.java diff --git a/students/395860968/ood-assignment/ConfigurationKeys.java b/students/395860968/SRP/ConfigurationKeys.java similarity index 100% rename from students/395860968/ood-assignment/ConfigurationKeys.java rename to students/395860968/SRP/ConfigurationKeys.java diff --git a/students/395860968/ood-assignment/DBUtil.java b/students/395860968/SRP/DBUtil.java similarity index 100% rename from students/395860968/ood-assignment/DBUtil.java rename to students/395860968/SRP/DBUtil.java diff --git a/students/395860968/ood-assignment/FileUtil.java b/students/395860968/SRP/FileUtil.java similarity index 100% rename from students/395860968/ood-assignment/FileUtil.java rename to students/395860968/SRP/FileUtil.java diff --git a/students/395860968/ood-assignment/MailUtil.java b/students/395860968/SRP/MailUtil.java similarity index 100% rename from students/395860968/ood-assignment/MailUtil.java rename to students/395860968/SRP/MailUtil.java diff --git a/students/395860968/ood-assignment/Product.java b/students/395860968/SRP/Product.java similarity index 100% rename from students/395860968/ood-assignment/Product.java rename to students/395860968/SRP/Product.java diff --git a/students/395860968/ood-assignment/PromotionMail.java b/students/395860968/SRP/PromotionMail.java similarity index 100% rename from students/395860968/ood-assignment/PromotionMail.java rename to students/395860968/SRP/PromotionMail.java diff --git a/students/395860968/ood-assignment/product_promotion.txt b/students/395860968/SRP/product_promotion.txt similarity index 100% rename from students/395860968/ood-assignment/product_promotion.txt rename to students/395860968/SRP/product_promotion.txt diff --git a/students/395860968/ood-assignment/src b/students/395860968/SRP/src similarity index 100% rename from students/395860968/ood-assignment/src rename to students/395860968/SRP/src diff --git a/students/41689722.eulerlcs/regularexpression/pom.xml b/students/41689722.eulerlcs/regularexpression/pom.xml new file mode 100644 index 0000000000..86657499f5 --- /dev/null +++ b/students/41689722.eulerlcs/regularexpression/pom.xml @@ -0,0 +1,111 @@ + + 4.0.0 + com.github.eulerlcs + jmr-71-regularexpression + 0.0.1-SNAPSHOT + eulerlcs regular expression + + + + 1.7.24 + 4.12 + 2.17 + 1.8 + 1.8 + + + + + + org.projectlombok + lombok + 1.16.14 + provided + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + + + junit + junit + ${junit.version} + test + + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + + attach-source + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + true + 1.8 + protected + UTF-8 + UTF-8 + UTF-8 + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.19.1 + + true + + + + + + + + org.apache.maven.plugins + maven-source-plugin + + + + \ No newline at end of file diff --git a/students/41689722.eulerlcs/regularexpression/src/main/java/com/github/eulerlcs/regularexpression/Utils.java b/students/41689722.eulerlcs/regularexpression/src/main/java/com/github/eulerlcs/regularexpression/Utils.java new file mode 100644 index 0000000000..aa5e45c5ed --- /dev/null +++ b/students/41689722.eulerlcs/regularexpression/src/main/java/com/github/eulerlcs/regularexpression/Utils.java @@ -0,0 +1,27 @@ +package com.github.eulerlcs.regularexpression; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class Utils { + + public static String readAllFromResouce(String resourceName) { + byte[] fileContentBytes; + try { + Path path = Paths.get(ClassLoader.getSystemResource(resourceName).toURI()); + fileContentBytes = Files.readAllBytes(path); + String fileContentStr = new String(fileContentBytes, StandardCharsets.UTF_8); + + return fileContentStr; + } catch (IOException | URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return ""; + } +} diff --git a/students/41689722.eulerlcs/regularexpression/src/main/resources/.gitkeep b/students/41689722.eulerlcs/regularexpression/src/main/resources/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/students/41689722.eulerlcs/regularexpression/src/main/resources/log4j.xml b/students/41689722.eulerlcs/regularexpression/src/main/resources/log4j.xml new file mode 100644 index 0000000000..831b8d9ce3 --- /dev/null +++ b/students/41689722.eulerlcs/regularexpression/src/main/resources/log4j.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/students/41689722.eulerlcs/regularexpression/src/test/java/.gitkeep b/students/41689722.eulerlcs/regularexpression/src/test/java/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/students/41689722.eulerlcs/regularexpression/src/test/java/com/github/eulerlcs/regularexpression/UtilsTest.java b/students/41689722.eulerlcs/regularexpression/src/test/java/com/github/eulerlcs/regularexpression/UtilsTest.java new file mode 100644 index 0000000000..3fa9e25c8d --- /dev/null +++ b/students/41689722.eulerlcs/regularexpression/src/test/java/com/github/eulerlcs/regularexpression/UtilsTest.java @@ -0,0 +1,316 @@ +package com.github.eulerlcs.regularexpression; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.junit.Test; + +// http://www.cnblogs.com/playing/archive/2011/03/15/1984943.html + +public class UtilsTest { + + /** + * 多行模式-1 + */ + @Test + public void test01_01() { + String t1 = Utils.readAllFromResouce("01.txt"); + + // 默认 单行模式 + Pattern p1 = Pattern.compile("^def$"); + Matcher m1 = p1.matcher(t1); + + if (m1.find()) { + System.out.println("found!"); + } else { + System.out.println("not found!"); + } + } + + /** + *
+	 * 多行模式-2 
+	 *  (?m)		Pattern.MULTILINE
+	 * 
+ */ + @Test + public void test01_02() { + String t1 = Utils.readAllFromResouce("01.txt"); + + // 多行模式 写法一 + // Pattern p1 = Pattern.compile("(?m)^def$"); + // 多行模式 写法二 + Pattern p1 = Pattern.compile("^def$", Pattern.MULTILINE); + + Matcher m1 = p1.matcher(t1); + + if (m1.find()) { + System.out.println("found!"); + } else { + System.out.println("not found!"); + } + } + + /** + * flag设定和(?X)的等价关系 + * + *
+	 *  (?m)		Pattern.MULTILINE
+	 *  (?i)		Pattern.CASE_INSENSITIVE
+	 *  (?u)		Pattern.UNICODE_CASE
+	 *  (?s)		Pattern.DOTALL
+	 *  (?d)		Pattern.UNIX_LINES
+	 *  (?x)		Pattern.COMMENTS
+	 * 
+ */ + + /** + *
+	 * ascii大小写
+	 *  (?i)		Pattern.CASE_INSENSITIVE
+	 * 
+ */ + @Test + public void test02_01() { + String t1 = "abc AbC aCd abc ABc 2343"; + String r1 = "abc"; + + // 默认 区分大小写 + // Pattern p1 = Pattern.compile(r1); + + // 忽略ascii大小,写法一 + Pattern p1 = Pattern.compile("(?i)abc"); + + // 忽略ascii大小,写法而 + // Pattern p1 = Pattern.compile(r1, Pattern.CASE_INSENSITIVE ); + + Matcher m1 = p1.matcher(t1); + + while (m1.find()) { + System.out.println(m1.group()); + } + } + + /** + *
+	 * unicode大小写
+	 *  (?u)		Pattern.UNICODE_CASE
+	 * 
+ */ + @Test + public void test03_01() { + String t1 = "abc AbC aCd abc ABc 2343"; + String r1 = "abc";// 日文输入法下,全角abc,也就是宽字体 + + // 默认 区分大小写只适用于ascii + // Pattern p1 = Pattern.compile((?i)abc); + + // 忽略ascii大小,写法一 + Pattern p1 = Pattern.compile("(?iu)abc"); + + // 忽略ascii大小,写法而 + // Pattern p1 = Pattern.compile(r1, Pattern.UNICODE_CASE); + + Matcher m1 = p1.matcher(t1); + + while (m1.find()) { + System.out.println(m1.group()); + } + } + + /** 通过设定标志位忽略大小写 */ + @Test + public void test03_02() { + String t1 = "abc AbC aCd\nABCD 2343"; + String r1 = "(?i)(?m)abc"; + Pattern p1 = Pattern.compile(r1); + Matcher m1 = p1.matcher(t1); + + while (m1.find()) { + System.out.println(m1.group()); + } + } + + @Test + public void test04_01_dotall() { + Pattern p = null; + Matcher m = null; + + String text1 = "width height"; + String text2 = "width\nheight"; + // Pattern p = Pattern.compile("(?s)width.height"); + p = Pattern.compile("width.height", Pattern.DOTALL); + + m = p.matcher(text1); + boolean result1 = m.find(); + if (result1) { + System.out.println("text1 found"); + } else { + System.out.println("text1 not found"); + } + + m = p.matcher(text2); + boolean result2 = m.find(); + if (result2) { + System.out.println("text2 found"); + } else { + System.out.println("text2 not found"); + } + } + + /** + * group + * + *
+	 * group(0):正则表达式的匹配值 
+	 * group(1):第一个子串
+	 * 
+ */ + @Test + public void test05_01() { + Pattern p = Pattern.compile("([a-z]+)-(\\d+)"); + Matcher m = p.matcher("type x-235, type y-3, type zw-465"); + + while (m.find()) { + for (int i = 0; i < m.groupCount() + 1; i++) { + System.out.println("group(" + i + ")=" + m.group(i)); + } + System.out.println("---------------------"); + } + } + + /** + * 字符串分割的例子 + */ + @Test + public void test05_02() { + String abc = "a///b/c"; + + // 分割后的数组中包含空字符 + String[] array1 = abc.split("/"); + for (String str : array1) { + System.out.println(str); + } + + System.out.println("---------------------"); + + // 分割后的数组中取出了空字符 + String[] array2 = abc.split("/+"); + for (String str : array2) { + System.out.println(str); + } + } + + /** + * 替换 + */ + @Test + public void test06_01() { + String str = "Orange is 100yuan, Banana is 180 yuan."; + String regex = "\\d+\\s*yuan"; + Pattern p = Pattern.compile(regex); + + Matcher m = p.matcher(str); + System.out.println(m.find()); + String result = m.replaceFirst("_$0_"); + + System.out.println(result); + } + + /** + * 替换 + */ + @Test + public void test06_02() { + String str = "Orange is 100yuan, Banana is 180 yuan."; + String regex = "(\\d)\\s*(yuan)"; + + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(str); + + String result = m.replaceAll("$2_$1"); + + System.out.println(result); + } + + /** + * 命名分组,替换 + */ + @Test + public void test06_03() { + String pathfFilename = "aa/notepad.exe"; + + String regex = "^.+/(?.+)$"; + String replacement = "${filename}"; + + String filename = pathfFilename.replaceFirst(regex, replacement); + System.out.println(filename); + } + + /** + * 从文本中读取多行数据后,建议先把回车符删掉 + */ + @Test + public void test07_01() { + String t1 = Utils.readAllFromResouce("07.txt"); + System.out.println("--orignal text start--"); + System.out.print(t1); + System.out.println("--orignal text end --"); + + // 统一换行符 + String ret1 = t1.replaceAll("(\r\n)|\r", "\n"); + System.out.println("--统一换行符 start--"); + System.out.print(ret1); + System.out.println("--统一换行符 end --"); + + // 行单位前后trim + String ret2 = ret1.replaceAll("(?m)^\\s*(.*?)\\s*$", "$1"); + System.out.println("--行单位前后trim start--"); + System.out.println(ret2); + System.out.println("--行单位前后trim end --"); + + assertFalse(ret2.equals(t1)); + } + + @Test + public void test01_04_Zz() { + Pattern p = null; + Matcher m = null; + boolean result1 = false; + boolean result2 = false; + boolean result3 = false; + + String text1 = "abc def"; + String text2 = "def abc"; + String text3 = "def abc\n"; + + p = Pattern.compile("abc\\z"); + + m = p.matcher(text1); + result1 = m.find(); + + m = p.matcher(text2); + result2 = m.find(); + + m = p.matcher(text3); + result3 = m.find(); + + p = Pattern.compile("abc\\Z"); + + m = p.matcher(text1); + result1 = m.find(); + + m = p.matcher(text2); + result2 = m.find(); + + m = p.matcher(text3); + result3 = m.find(); + + assertFalse(result1); + assertTrue(result2); + assertTrue(result3); + } +} diff --git a/students/41689722.eulerlcs/regularexpression/src/test/resources/.gitkeep b/students/41689722.eulerlcs/regularexpression/src/test/resources/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/students/41689722.eulerlcs/regularexpression/src/test/resources/01.txt b/students/41689722.eulerlcs/regularexpression/src/test/resources/01.txt new file mode 100644 index 0000000000..5f5521fae2 --- /dev/null +++ b/students/41689722.eulerlcs/regularexpression/src/test/resources/01.txt @@ -0,0 +1,2 @@ +abc +def diff --git a/students/41689722.eulerlcs/regularexpression/src/test/resources/07.txt b/students/41689722.eulerlcs/regularexpression/src/test/resources/07.txt new file mode 100644 index 0000000000..be72da22ea --- /dev/null +++ b/students/41689722.eulerlcs/regularexpression/src/test/resources/07.txt @@ -0,0 +1,5 @@ + abc +def + +gh + diff --git a/students/471398827/ood-assignment/pom.xml b/students/471398827/ood-assignment/pom.xml new file mode 100644 index 0000000000..cac49a5328 --- /dev/null +++ b/students/471398827/ood-assignment/pom.xml @@ -0,0 +1,32 @@ + + 4.0.0 + + com.coderising + ood-assignment + 0.0.1-SNAPSHOT + jar + + ood-assignment + http://maven.apache.org + + + UTF-8 + + + + + + junit + junit + 4.12 + + + + + + aliyunmaven + http://maven.aliyun.com/nexus/content/groups/public/ + + + diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/Config.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/Config.java new file mode 100644 index 0000000000..13520f693c --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/Config.java @@ -0,0 +1,12 @@ +package com.coderising.ood.ocp; + +/** + * Created by szf on 6/20/17. + */ +public class Config { + public static final int RAW_LOG = 1; + public static final int RAW_LOG_WITH_DATE = 2; + public static final int EMAIL_LOG = 1; + public static final int SMS_LOG = 2; + public static final int PRINT_LOG = 3; +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/DateMessage.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/DateMessage.java new file mode 100644 index 0000000000..cac875e053 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/DateMessage.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +/** + * Created by szf on 6/20/17. + */ +public class DateMessage implements IMessage{ + @Override + public String getMessage(String msg) { + return DateUtil.getCurrentDateAsString() + msg; + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java new file mode 100644 index 0000000000..e9d919c378 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return "date : 8/20 "; + } + +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/ILog.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/ILog.java new file mode 100644 index 0000000000..40a34666b8 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/ILog.java @@ -0,0 +1,8 @@ +package com.coderising.ood.ocp; + +/** + * Created by szf on 6/20/17. + */ +public interface ILog { + public void printLog(String msg); +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/IMessage.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/IMessage.java new file mode 100644 index 0000000000..2ec8103863 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/IMessage.java @@ -0,0 +1,8 @@ +package com.coderising.ood.ocp; + +/** + * Created by szf on 6/20/17. + */ +public interface IMessage { + public String getMessage(String msg); +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/LogFactory.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/LogFactory.java new file mode 100644 index 0000000000..8ba78c7b1d --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/LogFactory.java @@ -0,0 +1,25 @@ +package com.coderising.ood.ocp; + +import com.coderising.ood.srp.Mail; + +/** + * Created by szf on 6/20/17. + */ +public class LogFactory { + + static ILog produce(int logMethod) { + ILog log = null; + switch (logMethod) { + case Config.EMAIL_LOG: + log = new MailUtil(); + break; + case Config.SMS_LOG: + log = new SMSUtil(); + break; + case Config.PRINT_LOG: + log = new PrintUtil(); + break; + } + return log; + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java new file mode 100644 index 0000000000..c0579975de --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java @@ -0,0 +1,22 @@ +package com.coderising.ood.ocp; + +public class Logger { + ILog myLog; + IMessage myMessage; + + public Logger(int logType, int logMethod){ + myMessage = MessageFactory.produce(logType); + myLog = LogFactory.produce(logMethod); + } + public void log(String msg){ + + myLog.printLog(myMessage.getMessage(msg)); + + } + + public static void main(String[] args) { + Logger logger = new Logger(Config.RAW_LOG_WITH_DATE, Config.EMAIL_LOG); + logger.log("this is a log message"); + } +} + diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java new file mode 100644 index 0000000000..76d830742a --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class MailUtil implements ILog{ + + @Override + public void printLog(String msg) { + msg = "Mail..." + "\n" + msg; + System.out.println(msg); + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/MessageFactory.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/MessageFactory.java new file mode 100644 index 0000000000..10faf8f6d0 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/MessageFactory.java @@ -0,0 +1,20 @@ +package com.coderising.ood.ocp; + +/** + * Created by szf on 6/20/17. + */ +public class MessageFactory { + + static IMessage produce(int messageType) { + IMessage msg = null; + switch (messageType) { + case Config.RAW_LOG: + msg = new RawMessage(); + break; + case Config.RAW_LOG_WITH_DATE: + msg = new DateMessage(); + break; + } + return msg; + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/PrintUtil.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/PrintUtil.java new file mode 100644 index 0000000000..4e337a3d42 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/PrintUtil.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +/** + * Created by szf on 6/20/17. + */ +public class PrintUtil implements ILog{ + @Override + public void printLog(String msg) { + System.out.println(msg); + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/RawMessage.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/RawMessage.java new file mode 100644 index 0000000000..0d6c48a796 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/RawMessage.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +/** + * Created by szf on 6/20/17. + */ +public class RawMessage implements IMessage{ + @Override + public String getMessage(String msg) { + return msg; + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java new file mode 100644 index 0000000000..c85286a465 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +public class SMSUtil implements ILog{ + + @Override + public void printLog(String msg) { + msg = "SMS..." + "\n" + msg; + System.out.println(msg); + } + +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java new file mode 100644 index 0000000000..bd0db32d2a --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java @@ -0,0 +1,26 @@ +package com.coderising.ood.srp; +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + static Map configurations = new HashMap<>(); + static boolean MAIL_DEBUG = false; + static{ + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + configurations.put(ConfigurationKeys.FILE_PATH, "/Users/szf/git/coding2017/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt"); + } + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * @param key + * @return + */ + public static String getProperty(String key) { + + return configurations.get(key); + + } + +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/ConfigurationKeys.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/ConfigurationKeys.java new file mode 100644 index 0000000000..d4acd3240f --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/ConfigurationKeys.java @@ -0,0 +1,10 @@ +package com.coderising.ood.srp; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + public static final String FILE_PATH = "file.path"; + +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java new file mode 100644 index 0000000000..140d505a65 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java @@ -0,0 +1,25 @@ +package com.coderising.ood.srp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class DBUtil { + + /** + * 应该从数据库读, 但是简化为直接生成。 + * @param sql + * @return + */ + public static List query(String sql){ + + List userList = new ArrayList(); + for (int i = 1; i <= 3; i++) { + String userName = "User" + i; + String email = "aa@bb.com"; + User user = new User(userName, email); + userList.add(user); + } + + return userList; + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Mail.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Mail.java new file mode 100644 index 0000000000..231947248d --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Mail.java @@ -0,0 +1,18 @@ +package com.coderising.ood.srp; + +/** + * Created by szf on 6/20/17. + */ +public class Mail { + private String host; + + public Mail(String host) { + this.host = host; + } + + public boolean send(Message msg) throws Exception { + System.out.println("Host: " + this.host); + msg.print(); + return true; + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java new file mode 100644 index 0000000000..502a7d96f0 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java @@ -0,0 +1,53 @@ +package com.coderising.ood.srp; + +public class MailUtil { + private static Mail firstSMPTHost, secondSMPTHost; + + static { + String host1 = Configuration.getProperty(ConfigurationKeys.SMTP_SERVER); + String host2 = Configuration.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + firstSMPTHost = new Mail(host1); + secondSMPTHost = new Mail(host2); + } + + + public static void sendEmail(Message msg) throws Exception{ + //假装发了一封邮件 + + if (msg != null) { + + System.out.println("开始发送邮件"); + + if (msg.checkFormat()) { + + System.out.println("发送邮件..."); + + try { + + firstSMPTHost.send(msg); + + System.out.println("发送邮件成功"); + + } catch (Exception e) { + try { + + secondSMPTHost.send(msg); + + } catch (Exception e2) { + + System.out.println("通过备用 SMTP服务器发送邮件失败: " + e2.getMessage()); + + } + } + } else { + + System.out.println("邮件格式不对"); + + } + } else { + + System.out.println("没有邮件发送"); + + } + } +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Message.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Message.java new file mode 100644 index 0000000000..a0a16d2756 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Message.java @@ -0,0 +1,65 @@ +package com.coderising.ood.srp; + +/** + * Created by szf on 6/20/17. + */ +public class Message { + private String toAddress; + private String fromAddress; + private String subject; + private String message; + + public Message(String toAddress, String fromAddress, String subject, String message) { + this.toAddress = toAddress; + this.fromAddress = fromAddress; + this.subject = subject; + this.message = message; + } + + public void print() { + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(toAddress).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(message).append("\n"); + System.out.println(buffer.toString()); + } + + public boolean checkFormat() { + return true; + } + + public String getToAddress() { + + return toAddress; + } + + public void setToAddress(String toAddress) { + this.toAddress = toAddress; + } + + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Product.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Product.java new file mode 100644 index 0000000000..5662ace67d --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/Product.java @@ -0,0 +1,33 @@ +package com.coderising.ood.srp; + +/** + * Created by szf on 6/20/17. + */ +public class Product { + public String getProductId() { + return productId; + } + + public Product(String productId, String productDesc) { + this.productId = productId; + this.productDesc = productDesc; + } + + public Product() { + } + + public void setProductId(String productId) { + this.productId = productId; + } + + public String getProductDesc() { + return productDesc; + } + + public void setProductDesc(String productDesc) { + this.productDesc = productDesc; + } + + private String productId; + private String productDesc; +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/ProductFactory.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/ProductFactory.java new file mode 100644 index 0000000000..f7366c27e4 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/ProductFactory.java @@ -0,0 +1,36 @@ +package com.coderising.ood.srp; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by szf on 6/20/17. + */ +public class ProductFactory { + List getNewProdcuts(File file) throws IOException { + BufferedReader br = null; + List newProducts = new ArrayList<>(); + try { + br = new BufferedReader(new FileReader(file)); + String temp = br.readLine(); + String[] data = temp.split(" "); + + Product product = new Product(data[0], data[1]); + newProducts.add(product); + + System.out.println("产品ID = " + product.getProductId() + "\n"); + System.out.println("产品描述 = " + product.getProductDesc() + "\n"); + + } catch (IOException e) { + throw new IOException(e.getMessage()); + } finally { + br.close(); + } + return newProducts; + } + +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java new file mode 100644 index 0000000000..fa90f9a539 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java @@ -0,0 +1,51 @@ +package com.coderising.ood.srp; +import java.io.File; +import java.util.List; + +public class PromotionMail { + + + public static void main(String[] args) throws Exception { + + PromotionMail pe = new PromotionMail(); + + } + + + public PromotionMail() throws Exception { + + if (Configuration.MAIL_DEBUG) { + System.out.println("debugging..."); + } + + ProductFactory factory = new ProductFactory(); + + File file = new File(Configuration.getProperty(ConfigurationKeys.FILE_PATH)); + List products = factory.getNewProdcuts(file); + + String productID = "1"; + String sql = "Select name from subscriptions " + + "where product_id= '" + productID +"' " + + "and send_mail=1 "; + + List users = DBUtil.query(sql); + + + for (User user : users) { + for (Product product : products) { + + String to_address = user.getEmail(); + String from_address = Configuration.getProperty(ConfigurationKeys.EMAIL_ADMIN); + String subject = "您关注的产品降价了"; + String message = "尊敬的 "+ user.getName() + ", 您关注的产品 " + product.getProductDesc() + " 降价了,欢迎购买!" ; + + Message msg = new Message(to_address, from_address, subject, message); + + MailUtil.sendEmail(msg); + } + + } + } + + +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/User.java b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/User.java new file mode 100644 index 0000000000..225f98b727 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/User.java @@ -0,0 +1,32 @@ +package com.coderising.ood.srp; + +/** + * Created by szf on 6/20/17. + */ +public class User { + private String Name; + + public User(String name, String email) { + Name = name; + Email = email; + } + + public String getName() { + + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getEmail() { + return Email; + } + + public void setEmail(String email) { + Email = email; + } + + private String Email; +} diff --git a/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..0c0124cc61 --- /dev/null +++ b/students/471398827/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/495232796/OOD/UML/DiceGame-class.jpg b/students/495232796/OOD/UML/DiceGame-class.jpg new file mode 100644 index 0000000000..869d72dd5e Binary files /dev/null and b/students/495232796/OOD/UML/DiceGame-class.jpg differ diff --git a/students/495232796/OOD/UML/DiceGame-sequence.jpg b/students/495232796/OOD/UML/DiceGame-sequence.jpg new file mode 100644 index 0000000000..8d6b90e9b3 Binary files /dev/null and b/students/495232796/OOD/UML/DiceGame-sequence.jpg differ diff --git a/students/495232796/OOD/UML/ShoppingSite.jpg b/students/495232796/OOD/UML/ShoppingSite.jpg new file mode 100644 index 0000000000..5e05336f62 Binary files /dev/null and b/students/495232796/OOD/UML/ShoppingSite.jpg differ diff --git a/students/495232796/OOD/ood-assignment/config/product_promotion.txt b/students/495232796/OOD/ood-assignment/config/product_promotion.txt new file mode 100644 index 0000000000..b7a974adb3 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/config/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/495232796/OOD/ood-assignment/pom.xml b/students/495232796/OOD/ood-assignment/pom.xml new file mode 100644 index 0000000000..cac49a5328 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/pom.xml @@ -0,0 +1,32 @@ + + 4.0.0 + + com.coderising + ood-assignment + 0.0.1-SNAPSHOT + jar + + ood-assignment + http://maven.apache.org + + + UTF-8 + + + + + + junit + junit + 4.12 + + + + + + aliyunmaven + http://maven.aliyun.com/nexus/content/groups/public/ + + + diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/ComSender.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/ComSender.java new file mode 100644 index 0000000000..19f2c796b0 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/ComSender.java @@ -0,0 +1,7 @@ +package com.coderising.ood.ocp; + +public class ComSender implements Sender { + public void send(String msg) { + System.out.println(msg); + } +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java new file mode 100644 index 0000000000..b6cf28c096 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return null; + } + +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/LogType.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/LogType.java new file mode 100644 index 0000000000..d33d7d0240 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/LogType.java @@ -0,0 +1,9 @@ +package com.coderising.ood.ocp; + +public class LogType { + public static final int RAW_LOG = 1; + public static final int RAW_LOG_WITH_DATE = 2; + public static final int EMAIL_LOG = 1; + public static final int SMS_LOG = 2; + public static final int PRINT_LOG = 3; +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java new file mode 100644 index 0000000000..45525df9ba --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java @@ -0,0 +1,25 @@ +package com.coderising.ood.ocp; + +public class Logger { + int type = 0; + int method = 0; + + public Logger(int logType, int logMethod){ + this.type = logType; + this.method = logMethod; + } + public void log(String msg){ + + String logMsg = msg; + + if(this.type == LogType.RAW_LOG){ + logMsg = msg; + } else if(this.type == LogType.RAW_LOG_WITH_DATE){ + String txtDate = DateUtil.getCurrentDateAsString(); + logMsg = txtDate + ": " + msg; + } + + SenderFactory.createSender(type).send(logMsg); + } +} + diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java new file mode 100644 index 0000000000..dff0eb9748 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class MailUtil implements Sender{ + + public void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java new file mode 100644 index 0000000000..be47b2c084 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class SMSUtil implements Sender { + + public void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/Sender.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/Sender.java new file mode 100644 index 0000000000..4bb54aa1e8 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/Sender.java @@ -0,0 +1,5 @@ +package com.coderising.ood.ocp; + +public interface Sender { + public void send(String msg); +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/SenderFactory.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/SenderFactory.java new file mode 100644 index 0000000000..6915ff2992 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/SenderFactory.java @@ -0,0 +1,15 @@ +package com.coderising.ood.ocp; + +public class SenderFactory { + public static Sender createSender(int type) { + if(type == LogType.EMAIL_LOG){ + return new MailUtil(); + } else if(type == LogType.SMS_LOG){ + return new SMSUtil(); + } else if(type == LogType.PRINT_LOG){ + return new ComSender(); + } + + return new ComSender(); + } +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Formatter.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Formatter.java new file mode 100644 index 0000000000..b6e2ccbc16 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Formatter.java @@ -0,0 +1,7 @@ +package com.coderising.ood.ocp.good; + +public interface Formatter { + + String format(String msg); + +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/FormatterFactory.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/FormatterFactory.java new file mode 100644 index 0000000000..3c2009a674 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/FormatterFactory.java @@ -0,0 +1,13 @@ +package com.coderising.ood.ocp.good; + +public class FormatterFactory { + public static Formatter createFormatter(int type){ + if(type == 1){ + return new RawFormatter(); + } + if (type == 2){ + return new HtmlFormatter(); + } + return null; + } +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/HtmlFormatter.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/HtmlFormatter.java new file mode 100644 index 0000000000..3d375f5acc --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/HtmlFormatter.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.good; + +public class HtmlFormatter implements Formatter { + + @Override + public String format(String msg) { + + return null; + } + +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Logger.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Logger.java new file mode 100644 index 0000000000..f206472d0d --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Logger.java @@ -0,0 +1,18 @@ +package com.coderising.ood.ocp.good; + +public class Logger { + + private Formatter formatter; + private Sender sender; + + public Logger(Formatter formatter,Sender sender){ + this.formatter = formatter; + this.sender = sender; + } + public void log(String msg){ + sender.send(formatter.format(msg)) ; + } + + +} + diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/RawFormatter.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/RawFormatter.java new file mode 100644 index 0000000000..7f1cb4ae30 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/RawFormatter.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.good; + +public class RawFormatter implements Formatter { + + @Override + public String format(String msg) { + + return null; + } + +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Sender.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Sender.java new file mode 100644 index 0000000000..aaa46c1fb7 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/ocp/good/Sender.java @@ -0,0 +1,7 @@ +package com.coderising.ood.ocp.good; + +public interface Sender { + + void send(String msg); + +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/CommonKeys.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/CommonKeys.java new file mode 100644 index 0000000000..2980cc40ca --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/CommonKeys.java @@ -0,0 +1,10 @@ +package com.coderising.ood.srp; + +public class CommonKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + public static final String NAME_KEY = "NAME"; + public static final String EMAIL_KEY = "EMAIL"; +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java new file mode 100644 index 0000000000..13cc1b5890 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java @@ -0,0 +1,23 @@ +package com.coderising.ood.srp; +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + static Map configurations = new HashMap<>(); + static{ + configurations.put(CommonKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(CommonKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(CommonKeys.EMAIL_ADMIN, "admin@company.com"); + } + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * @param key + * @return + */ + public String getProperty(String key) { + + return configurations.get(key); + } + +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java new file mode 100644 index 0000000000..ff8215b4d2 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java @@ -0,0 +1,25 @@ +package com.coderising.ood.srp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class DBUtil { + + /** + * 应该从数据库读, 但是简化为直接生成。 + * @param sql + * @return + */ + public static List query(String sql){ + + List userList = new ArrayList(); + for (int i = 1; i <= 3; i++) { + HashMap userInfo = new HashMap(); + userInfo.put(CommonKeys.NAME_KEY, "User" + i); + userInfo.put(CommonKeys.EMAIL_KEY, "aa@bb.com"); + userList.add(userInfo); + } + + return userList; + } +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailAddr.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailAddr.java new file mode 100644 index 0000000000..239166dd11 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailAddr.java @@ -0,0 +1,42 @@ +package com.coderising.ood.srp; + +public class MailAddr { + protected String smtpHost = null; + protected String altSmtpHost = null; + protected String fromAddress = null; + protected String toAddress = null; + + public MailAddr(Configuration config) { + reloadconfig(config); + } + + public void reloadconfig(Configuration config) { + smtpHost = config.getProperty(CommonKeys.SMTP_SERVER); + altSmtpHost = config.getProperty(CommonKeys.ALT_SMTP_SERVER); + fromAddress = config.getProperty(CommonKeys.EMAIL_ADMIN); + } + + public void setToAddress(String address) { + toAddress = address; + } + + public String getToAddress() { + return toAddress; + } + + public boolean checkToAddress() { + return toAddress.length() > 0; + } + + public String getSmtpHost() { + return smtpHost; + } + + public String getAltSmtpHost() { + return altSmtpHost; + } + + public String getFromAddress() { + return fromAddress; + } +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailMsg.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailMsg.java new file mode 100644 index 0000000000..dd834ccfef --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailMsg.java @@ -0,0 +1,19 @@ +package com.coderising.ood.srp; + +public class MailMsg { + protected String subject = null; + protected String message = null; + + public MailMsg(String sub, String msg) { + this.subject = sub; + this.message = msg; + } + + public String getSubject() { + return subject; + } + + public String getMessage() { + return message; + } +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java new file mode 100644 index 0000000000..cfb2cffa7c --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java @@ -0,0 +1,14 @@ +package com.coderising.ood.srp; + +public class MailUtil { + + public static void sendEmail(MailAddr mailAddr, MailMsg mailMsg, boolean debug) { + //假装发了一封邮件 + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(mailAddr.getFromAddress()).append("\n"); + buffer.append("To:").append(mailAddr.getToAddress()).append("\n"); + buffer.append("Subject:").append(mailMsg.getSubject()).append("\n"); + buffer.append("Content:").append(mailMsg.getMessage()).append("\n"); + System.out.println(buffer.toString()); + } +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/ProductInfo.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/ProductInfo.java new file mode 100644 index 0000000000..ad68f0a7eb --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/ProductInfo.java @@ -0,0 +1,49 @@ +package com.coderising.ood.srp; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +public class ProductInfo { + protected String productID = null; + protected String productDesc = null; + + public ProductInfo(String path) { + try { + readFile(path); + } catch (IOException e) { + e.printStackTrace(); + } + } + + protected void readFile(String path) throws IOException + { + File f = new File(path); + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(f)); + String temp = br.readLine(); + String[] data = temp.split(" "); + + this.productID = data[0]; + this.productDesc = data[1]; + + System.out.println("产品ID = " + productID + "\n"); + System.out.println("产品描述 = " + productDesc + "\n"); + + } catch (IOException e) { + throw new IOException(e.getMessage()); + } finally { + br.close(); + } + } + + public String getProductID() { + return productID; + } + + public String getProductDesc() { + return productDesc; + } +} diff --git a/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java new file mode 100644 index 0000000000..808caab9f8 --- /dev/null +++ b/students/495232796/OOD/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java @@ -0,0 +1,89 @@ +package com.coderising.ood.srp; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +public class PromotionMail { + protected String sendMailQuery = null; + protected boolean emailDebug = false; + protected ProductInfo productInfo = null; + protected MailAddr mailAddr = null; + private static Configuration config; + + public static void main(String[] args) throws Exception { + String path = "D:\\projects\\OOD\\project\\ood-assignment\\config\\product_promotion.txt"; + + PromotionMail pe = new PromotionMail(path, false); + pe.sendEmails(); + } + + public PromotionMail(String path, boolean mailDebug) throws Exception { + this.emailDebug = mailDebug; + productInfo = new ProductInfo(path); + config = new Configuration(); + mailAddr = new MailAddr(config); + } + + protected void setLoadQuery() throws Exception { + sendMailQuery = "Select name from subscriptions " + "where product_id= '" + this.productInfo.getProductID() + + "' " + "and send_mail=1 "; + + System.out.println("loadQuery set"); + } + + protected MailMsg setMessage(HashMap userInfo) throws IOException { + + String name = (String) userInfo.get(CommonKeys.NAME_KEY); + + String subject = "您关注的产品降价了"; + String message = "尊敬的 " + name + ", 您关注的产品 " + this.productInfo.getProductDesc() + " 降价了,欢迎购买!"; + + return new MailMsg(subject, message); + } + + protected List loadMailingList() throws Exception { + return DBUtil.query(this.sendMailQuery); + } + + public void sendEmails() { + try { + setLoadQuery(); + sendEMails(emailDebug, loadMailingList()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + protected void sendEMails(boolean debug, List mailingList) throws IOException { + System.out.println("开始发送邮件"); + + if (mailingList != null) { + Iterator iter = mailingList.iterator(); + while (iter.hasNext()) { + HashMap userInfo = (HashMap) iter.next(); + mailAddr.setToAddress((String) userInfo.get(CommonKeys.EMAIL_KEY)); + if (mailAddr.checkToAddress()) { + MailMsg mailmsg = setMessage(userInfo); + try { + MailUtil.sendEmail(mailAddr, mailmsg, debug); + } catch (Exception e) { + try { + MailUtil.sendEmail(mailAddr, mailmsg, debug); + } catch (Exception e2) { + System.out.println("通过备用 SMTP服务器发送邮件失败: " + e2.getMessage()); + } + } + } + } + } else { + System.out.println("没有邮件发送"); + } + + } +} diff --git a/students/495232796/OOD/payment/src/Affiliation/Affiliation.java b/students/495232796/OOD/payment/src/Affiliation/Affiliation.java new file mode 100644 index 0000000000..5e2dac8fa0 --- /dev/null +++ b/students/495232796/OOD/payment/src/Affiliation/Affiliation.java @@ -0,0 +1,7 @@ +package Affiliation; + +import PayCheck.PayCheck; + +public abstract class Affiliation { + public abstract double calculateDeduction(PayCheck pc); +} diff --git a/students/495232796/OOD/payment/src/Affiliation/NonAffiliation.java b/students/495232796/OOD/payment/src/Affiliation/NonAffiliation.java new file mode 100644 index 0000000000..d37c1e35ff --- /dev/null +++ b/students/495232796/OOD/payment/src/Affiliation/NonAffiliation.java @@ -0,0 +1,12 @@ +package Affiliation; + +import PayCheck.PayCheck; + +public class NonAffiliation extends Affiliation{ + + @Override + public double calculateDeduction(PayCheck pc) { + return 0.0; + } + +} diff --git a/students/495232796/OOD/payment/src/Affiliation/ServiceCharge.java b/students/495232796/OOD/payment/src/Affiliation/ServiceCharge.java new file mode 100644 index 0000000000..a7faa67adb --- /dev/null +++ b/students/495232796/OOD/payment/src/Affiliation/ServiceCharge.java @@ -0,0 +1,20 @@ +package Affiliation; + +import java.util.Date; + +public class ServiceCharge { + private Date date; + private double amount; + public double getAmount() { + return amount; + } + public void setAmount(double amount) { + this.amount = amount; + } + public Date getDate() { + return date; + } + public void setDate(Date date) { + this.date = date; + } +} diff --git a/students/495232796/OOD/payment/src/Affiliation/UnionAffiliation.java b/students/495232796/OOD/payment/src/Affiliation/UnionAffiliation.java new file mode 100644 index 0000000000..02e645ef1f --- /dev/null +++ b/students/495232796/OOD/payment/src/Affiliation/UnionAffiliation.java @@ -0,0 +1,27 @@ +package Affiliation; + +import java.util.Date; +import java.util.Map; + +import PayCheck.PayCheck; +import DateUtil.DateUtil; + +public class UnionAffiliation extends Affiliation{ + private String memId; + private double weeklyDue; + private Map serviceCharges; + @Override + public double calculateDeduction(PayCheck pc) { + int fridays = DateUtil.getFridays(pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate()); + double totalDue = fridays*this.weeklyDue; + + double totalCharges = 0.0; + for (ServiceCharge sc : serviceCharges.values()) { + if (DateUtil.between(sc.getDate(), pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate())) { + totalCharges += sc.getAmount(); + } + } + return totalDue+totalCharges; + } + +} diff --git a/students/495232796/OOD/payment/src/DateUtil/DateUtil.java b/students/495232796/OOD/payment/src/DateUtil/DateUtil.java new file mode 100644 index 0000000000..6ed884bfa8 --- /dev/null +++ b/students/495232796/OOD/payment/src/DateUtil/DateUtil.java @@ -0,0 +1,37 @@ +package DateUtil; + +import java.util.Date; + +public class DateUtil { + public static boolean isFriday(Date d) { + return true; + } + + public static Date add(Date d, int days) { + return new Date(); + } + + public static boolean isLastDayofMonth(Date d) { + return false; + } + + public static Date getFirstDay(Date d) { + return new Date(); + } + + public static long getDaysBetween(Date start, Date end) { + return 0; + } + + public static Date parseDay(String dayStr) { + return new Date(); + } + + public static boolean between(Date d, Date start, Date end) { + return true; + } + + public static int getFridays(Date start, Date end) { + return 0; + } +} diff --git a/students/495232796/OOD/payment/src/Employ/Employee.java b/students/495232796/OOD/payment/src/Employ/Employee.java new file mode 100644 index 0000000000..b21eec7869 --- /dev/null +++ b/students/495232796/OOD/payment/src/Employ/Employee.java @@ -0,0 +1,41 @@ +package Employ; + +import java.util.Date; + +import Affiliation.Affiliation; +import PayCheck.PayCheck; +import PaymentClassification.PaymentClassification; +import PaymentMethod.PaymentMethod; +import PaymentSchedule.PaymentSchedule; + +public class Employee { + private String id; + private String name; + private String address; + PaymentClassification payment; + PaymentSchedule paySch; + PaymentMethod payMethod; + Affiliation af; + + public Employee(String name, String address) { + this.name = name; + this.address = address; + } + public boolean isPayDay(Date d) { + return this.paySch.isPayDay(d); + } + + public Date getPayPeriodStartDate(Date d) { + return this.paySch.getPayPeriodStartDate(d); + } + + public void payDay(PayCheck pc) { + double grossPay = payment.calculatePay(pc); + double dedutions = af.calculateDeduction(pc); + double netPay = grossPay - dedutions; + pc.setGrossPay(grossPay); + pc.setDeductions(dedutions); + pc.setNetPay(netPay); + payMethod.pay(pc); + } +} diff --git a/students/495232796/OOD/payment/src/PayCheck/PayCheck.java b/students/495232796/OOD/payment/src/PayCheck/PayCheck.java new file mode 100644 index 0000000000..ceea1e41fe --- /dev/null +++ b/students/495232796/OOD/payment/src/PayCheck/PayCheck.java @@ -0,0 +1,36 @@ +package PayCheck; + +import java.util.Date; + +public class PayCheck { + private int payPeriodStart; + private int payPeriodEnd; + private double grossPay; + private double deductions; + private double netPay; + public double getGrossPay() { + return grossPay; + } + public void setGrossPay(double grossPay) { + this.grossPay = grossPay; + } + public double getDeductions() { + return deductions; + } + public void setDeductions(double deductions) { + this.deductions = deductions; + } + public double getNetPay() { + return netPay; + } + public void setNetPay(double netPay) { + this.netPay = netPay; + } + + public Date getPayPeriodStartDate() { + return new Date(); + } + public Date getPayPeriodEndDate() { + return new Date(); + } +} diff --git a/students/495232796/OOD/payment/src/PaymentClassification/CommissionClassification.java b/students/495232796/OOD/payment/src/PaymentClassification/CommissionClassification.java new file mode 100644 index 0000000000..e1b9edab23 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentClassification/CommissionClassification.java @@ -0,0 +1,23 @@ +package PaymentClassification; + +import java.util.Date; +import java.util.Map; + +import PayCheck.PayCheck; +import DateUtil.DateUtil; + +public class CommissionClassification extends PaymentClassification{ + private double rate = 0.0; + private double salary = 0.0; + private Map receipts; + @Override + public double calculatePay(PayCheck pc) { + double commission = 0.0; + for (SalesReceipt sr : receipts.values()) { + if (DateUtil.between(sr.getDate(), pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate())) { + commission += sr.getAmount()*rate; + } + } + return commission+salary; + } +} diff --git a/students/495232796/OOD/payment/src/PaymentClassification/HourlyClassification.java b/students/495232796/OOD/payment/src/PaymentClassification/HourlyClassification.java new file mode 100644 index 0000000000..00ae430777 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentClassification/HourlyClassification.java @@ -0,0 +1,38 @@ +package PaymentClassification; + +import java.util.Date; +import java.util.Map; + +import DateUtil.DateUtil; +import PayCheck.PayCheck; + +public class HourlyClassification extends PaymentClassification{ + private double hourlyRate = 0.0; + private Map timeCards; + + public void addTimeCard(TimeCard tc) { + timeCards.put(tc.getDate(), tc); + } + + @Override + public double calculatePay(PayCheck pc) { + double total = 0.0; + + for (TimeCard tc : timeCards.values()) { + if (DateUtil.between(tc.getDate(), pc.getPayPeriodStartDate(), pc.getPayPeriodEndDate())) { + total += calculatePayForTimeCard(tc); + } + } + + return total; + } + + private double calculatePayForTimeCard(TimeCard tc) { + int hours = tc.getHours(); + if (hours > 8) { + return 8*this.hourlyRate + (hours - 8)*this.hourlyRate*1.5; + } else { + return 8*this.hourlyRate; + } + } +} diff --git a/students/495232796/OOD/payment/src/PaymentClassification/PaymentClassification.java b/students/495232796/OOD/payment/src/PaymentClassification/PaymentClassification.java new file mode 100644 index 0000000000..f9b06d744f --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentClassification/PaymentClassification.java @@ -0,0 +1,7 @@ +package PaymentClassification; + +import PayCheck.PayCheck; + +public abstract class PaymentClassification { + public abstract double calculatePay(PayCheck pc); +} diff --git a/students/495232796/OOD/payment/src/PaymentClassification/SalariedClassification.java b/students/495232796/OOD/payment/src/PaymentClassification/SalariedClassification.java new file mode 100644 index 0000000000..941bde9869 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentClassification/SalariedClassification.java @@ -0,0 +1,12 @@ +package PaymentClassification; + +import PayCheck.PayCheck; + +public class SalariedClassification extends PaymentClassification { + private double salary = 0.0; + + @Override + public double calculatePay(PayCheck pc) { + return salary; + } +} diff --git a/students/495232796/OOD/payment/src/PaymentClassification/SalesReceipt.java b/students/495232796/OOD/payment/src/PaymentClassification/SalesReceipt.java new file mode 100644 index 0000000000..a9f07140bd --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentClassification/SalesReceipt.java @@ -0,0 +1,20 @@ +package PaymentClassification; + +import java.util.Date; + +public class SalesReceipt { + private Date date; + private double amount; + public Date getDate() { + return date; + } + public void setDate(Date date) { + this.date = date; + } + public double getAmount() { + return amount; + } + public void setAmount(double amount) { + this.amount = amount; + } +} diff --git a/students/495232796/OOD/payment/src/PaymentClassification/TimeCard.java b/students/495232796/OOD/payment/src/PaymentClassification/TimeCard.java new file mode 100644 index 0000000000..e4396ee603 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentClassification/TimeCard.java @@ -0,0 +1,21 @@ +package PaymentClassification; + +import java.util.Date; + +public class TimeCard { + private Date date; + private int startTime; + private int endTime; + + public Date getDate() { + return date; + } + public void setDate(Date date) { + this.date = date; + } + + public int getHours() { + return endTime - startTime; + } + +} diff --git a/students/495232796/OOD/payment/src/PaymentMethod/BankMethod.java b/students/495232796/OOD/payment/src/PaymentMethod/BankMethod.java new file mode 100644 index 0000000000..1ef31f13ba --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentMethod/BankMethod.java @@ -0,0 +1,13 @@ +package PaymentMethod; + +import PayCheck.PayCheck; + +public class BankMethod extends PaymentMethod{ + private String bank; + private double account; + @Override + public void pay(PayCheck pc) { + // TODO Auto-generated method stub + + } +} diff --git a/students/495232796/OOD/payment/src/PaymentMethod/HoldMethod.java b/students/495232796/OOD/payment/src/PaymentMethod/HoldMethod.java new file mode 100644 index 0000000000..62d9b4439c --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentMethod/HoldMethod.java @@ -0,0 +1,13 @@ +package PaymentMethod; + +import PayCheck.PayCheck; + +public class HoldMethod extends PaymentMethod{ + + @Override + public void pay(PayCheck pc) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/495232796/OOD/payment/src/PaymentMethod/MailMethod.java b/students/495232796/OOD/payment/src/PaymentMethod/MailMethod.java new file mode 100644 index 0000000000..f8a98e5113 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentMethod/MailMethod.java @@ -0,0 +1,13 @@ +package PaymentMethod; + +import PayCheck.PayCheck; + +public class MailMethod extends PaymentMethod{ + private String address; + + @Override + public void pay(PayCheck pc) { + // TODO Auto-generated method stub + + } +} diff --git a/students/495232796/OOD/payment/src/PaymentMethod/PaymentMethod.java b/students/495232796/OOD/payment/src/PaymentMethod/PaymentMethod.java new file mode 100644 index 0000000000..67093ae1a0 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentMethod/PaymentMethod.java @@ -0,0 +1,7 @@ +package PaymentMethod; + +import PayCheck.PayCheck; + +public abstract class PaymentMethod { + public abstract void pay(PayCheck pc); +} diff --git a/students/495232796/OOD/payment/src/PaymentSchedule/BiWeeklySchedule.java b/students/495232796/OOD/payment/src/PaymentSchedule/BiWeeklySchedule.java new file mode 100644 index 0000000000..ced0eb1d15 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentSchedule/BiWeeklySchedule.java @@ -0,0 +1,19 @@ +package PaymentSchedule; + +import java.util.Date; +import DateUtil.DateUtil; + +public class BiWeeklySchedule implements PaymentSchedule{ + Date firstFriday = DateUtil.parseDay("2017-01-01"); + @Override + public boolean isPayDay(Date date) { + long interval = DateUtil.getDaysBetween(firstFriday, date); + return interval%14 == 0; + } + + @Override + public Date getPayPeriodStartDate(Date date) { + return DateUtil.add(date, -13); + } + +} diff --git a/students/495232796/OOD/payment/src/PaymentSchedule/MothlySchedule.java b/students/495232796/OOD/payment/src/PaymentSchedule/MothlySchedule.java new file mode 100644 index 0000000000..edac34d480 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentSchedule/MothlySchedule.java @@ -0,0 +1,19 @@ +package PaymentSchedule; + +import java.util.Date; + +import DateUtil.DateUtil; + +public class MothlySchedule implements PaymentSchedule{ + + @Override + public boolean isPayDay(Date date) { + return DateUtil.isLastDayofMonth(date); + } + + @Override + public Date getPayPeriodStartDate(Date date) { + return DateUtil.getFirstDay(date); + } + +} diff --git a/students/495232796/OOD/payment/src/PaymentSchedule/PaymentSchedule.java b/students/495232796/OOD/payment/src/PaymentSchedule/PaymentSchedule.java new file mode 100644 index 0000000000..e1dea539f8 --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentSchedule/PaymentSchedule.java @@ -0,0 +1,10 @@ +package PaymentSchedule; + +import java.util.Date; + +public interface PaymentSchedule { + + public boolean isPayDay(Date date); + + public Date getPayPeriodStartDate(Date date); +} diff --git a/students/495232796/OOD/payment/src/PaymentSchedule/WeeklySchedule.java b/students/495232796/OOD/payment/src/PaymentSchedule/WeeklySchedule.java new file mode 100644 index 0000000000..9e8e4dfe9f --- /dev/null +++ b/students/495232796/OOD/payment/src/PaymentSchedule/WeeklySchedule.java @@ -0,0 +1,18 @@ +package PaymentSchedule; + +import java.util.Date; +import DateUtil.DateUtil; + +public class WeeklySchedule implements PaymentSchedule{ + + @Override + public boolean isPayDay(Date date) { + return DateUtil.isFriday(date); + } + + @Override + public Date getPayPeriodStartDate(Date date) { + return DateUtil.add(date, -6); + } + +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java new file mode 100644 index 0000000000..0d0d01098f --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/DateUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return null; + } + +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java new file mode 100644 index 0000000000..e404d9e702 --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/Logger.java @@ -0,0 +1,39 @@ +package com.coderising.ood.ocp; + +public class Logger { + + public final int RAW_LOG = 1; + public final int RAW_LOG_WITH_DATE = 2; + + public final int EMAIL_LOG = 1; + public final int SMS_LOG = 2; + public final int PRINT_LOG = 3; + + int type = 0; + int method = 0; + + public Logger(int logType, int logMethod){ + this.type = logType; + this.method = logMethod; + } + public void log(String msg){ + + String logMsg = msg; + + if(this.type == RAW_LOG){ + logMsg = msg; + } else if(this.type == RAW_LOG_WITH_DATE){ + String txtDate = DateUtil.getCurrentDateAsString(); + logMsg = txtDate + ": " + msg; + } + + if(this.method == EMAIL_LOG){ + MailUtil.send(logMsg); + } else if(this.method == SMS_LOG){ + SMSUtil.send(logMsg); + } else if(this.method == PRINT_LOG){ + System.out.println(logMsg); + } + } +} + diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java new file mode 100644 index 0000000000..59d77649a2 --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/MailUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java new file mode 100644 index 0000000000..fab4cd01b7 --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/SMSUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class SMSUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Fomatter.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Fomatter.java new file mode 100644 index 0000000000..6d107d54e9 --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Fomatter.java @@ -0,0 +1,8 @@ +package com.coderising.ood.ocp.mine; + +/** + * Created by guodongchow on 2017/6/21. + */ +public interface Fomatter { + public String format(String message); +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Logger.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Logger.java new file mode 100644 index 0000000000..e25da9ca4b --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Logger.java @@ -0,0 +1,19 @@ +package com.coderising.ood.ocp.mine; + +/** + * Created by guodongchow on 2017/6/21. + */ +public class Logger { + + private Fomatter fomatter; + private Processor processor; + + public Logger(Fomatter fomatter, Processor processor) { + this.fomatter = fomatter; + this.processor = processor; + } + + public void log(String message){ + processor.process(fomatter.format(message)); + } +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/MailProcessor.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/MailProcessor.java new file mode 100644 index 0000000000..c3ce50d5ec --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/MailProcessor.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp.mine; + +/** + * Created by guodongchow on 2017/6/21. + */ +public class MailProcessor implements Processor { + public void process(String message) { + System.out.println("Mail sending message :"+message); + } +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/PrintProcessor.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/PrintProcessor.java new file mode 100644 index 0000000000..13b983064d --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/PrintProcessor.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp.mine; + +/** + * Created by guodongchow on 2017/6/21. + */ +public class PrintProcessor implements Processor { + public void process(String message) { + System.out.println("Printing message :"+message); + } +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Processor.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Processor.java new file mode 100644 index 0000000000..4cca74572f --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/Processor.java @@ -0,0 +1,8 @@ +package com.coderising.ood.ocp.mine; + +/** + * Created by guodongchow on 2017/6/21. + */ +public interface Processor { + public void process(String message); +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/RawLogFormatter.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/RawLogFormatter.java new file mode 100644 index 0000000000..550361b511 --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/RawLogFormatter.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.mine; + +/** + * Created by guodongchow on 2017/6/21. + */ +public class RawLogFormatter implements Fomatter { + + public String format(String message) { + return message; + } +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/RawWithDateLogFormatter.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/RawWithDateLogFormatter.java new file mode 100644 index 0000000000..80da623d5d --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/RawWithDateLogFormatter.java @@ -0,0 +1,13 @@ +package com.coderising.ood.ocp.mine; + +import java.util.Date; + +/** + * Created by guodongchow on 2017/6/21. + */ +public class RawWithDateLogFormatter implements Fomatter { + public String format(String message) { + String txtDate = new Date().toString(); + return txtDate + ":" + message; + } +} diff --git a/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/SMSProcessor.java b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/SMSProcessor.java new file mode 100644 index 0000000000..946c14dea0 --- /dev/null +++ b/students/513274874/ood/ood-assignment/src/main/java/com/coderising/ood/ocp/mine/SMSProcessor.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp.mine; + +/** + * Created by guodongchow on 2017/6/21. + */ +public class SMSProcessor implements Processor { + public void process(String message) { + System.out.println("SMS sending message :" + message); + } +} diff --git a/students/641013587/ood/ood-assignment/pom.xml b/students/641013587/ood/ood-assignment/pom.xml new file mode 100644 index 0000000000..65607712c0 --- /dev/null +++ b/students/641013587/ood/ood-assignment/pom.xml @@ -0,0 +1,47 @@ + + 4.0.0 + + com.coderising + ood-assignment + 0.0.1-SNAPSHOT + jar + + ood-assignment + http://maven.apache.org + + + UTF-8 + + + + + + junit + junit + 4.12 + + + + + + aliyunmaven + http://maven.aliyun.com/nexus/content/groups/public/ + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.2 + + 1.7 + 1.7 + UTF-8 + + + + + diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/constant/CommonConstant.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/constant/CommonConstant.java new file mode 100644 index 0000000000..fcba3fc9c2 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/constant/CommonConstant.java @@ -0,0 +1,14 @@ +package com.coderising.ood.srp.constant; + +import com.coderising.ood.srp.entity.Product; +import com.coderising.ood.srp.entity.User; + +public class CommonConstant { + + public static final String SUBJECT = "您关注的产品降价了"; + + public static String getProductMessage(User user,Product product){ + return "尊敬的 "+user.getName()+", 您关注的产品 " + product.getProductDesc() + " 降价了,欢迎购买!"; + } + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/dao/UserDao.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/dao/UserDao.java new file mode 100644 index 0000000000..6b3d11c41b --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/dao/UserDao.java @@ -0,0 +1,26 @@ +package com.coderising.ood.srp.dao; +import java.util.ArrayList; +import java.util.List; + +import com.coderising.ood.srp.entity.User; + +public class UserDao { + + /** + * 应该从数据库读, 但是简化为直接生成。 + * @param sql + * @return + */ + public List query(String sql){ + + List userList = new ArrayList<>(); + for (int i = 1; i <= 3; i++) { + User userInfo = new User(); + userInfo.setName("User" + i); + userInfo.setEmail("aa@bb.com"); + userList.add(userInfo); + } + + return userList; + } +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/Msg.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/Msg.java new file mode 100644 index 0000000000..8b1bc8b132 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/Msg.java @@ -0,0 +1,50 @@ +package com.coderising.ood.srp.entity; + +public class Msg { + + private String smtpHost ; + private String altSmtpHost; + private String fromAddress; + private String toAddress; + private String subject ; + private String message ; + public String getSmtpHost() { + return smtpHost; + } + public void setSmtpHost(String smtpHost) { + this.smtpHost = smtpHost; + } + public String getAltSmtpHost() { + return altSmtpHost; + } + public void setAltSmtpHost(String altSmtpHost) { + this.altSmtpHost = altSmtpHost; + } + public String getFromAddress() { + return fromAddress; + } + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + public String getToAddress() { + return toAddress; + } + public void setToAddress(String toAddress) { + this.toAddress = toAddress; + } + public String getSubject() { + return subject; + } + public void setSubject(String subject) { + this.subject = subject; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/Product.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/Product.java new file mode 100644 index 0000000000..a721930d75 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/Product.java @@ -0,0 +1,21 @@ +package com.coderising.ood.srp.entity; + +public class Product { + private String productID; + private String productDesc; + public String getProductID() { + return productID; + } + public void setProductID(String productID) { + this.productID = productID; + } + public String getProductDesc() { + return productDesc; + } + public void setProductDesc(String productDesc) { + this.productDesc = productDesc; + } + + + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/User.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/User.java new file mode 100644 index 0000000000..78f83b38a1 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/entity/User.java @@ -0,0 +1,20 @@ +package com.coderising.ood.srp.entity; + +public class User { + private String name; + private String email; + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/main/PromotionMail.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/main/PromotionMail.java new file mode 100644 index 0000000000..217a42ceb1 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/main/PromotionMail.java @@ -0,0 +1,31 @@ +package com.coderising.ood.srp.main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import com.coderising.ood.srp.dao.UserDao; +import com.coderising.ood.srp.entity.Product; +import com.coderising.ood.srp.entity.User; +import com.coderising.ood.srp.service.EmailService; +import com.coderising.ood.srp.service.UserService; +import com.coderising.ood.srp.util.FileUtil; +import com.coderising.ood.srp.util.MailUtil; +import com.coderising.ood.srp.util.PropertiesUtil; + +public class PromotionMail { + + public static void main(String[] args) throws Exception { + EmailService emailService = new EmailService(); + UserService userService = new UserService(); + Product product = FileUtil.readRecommendProduct(); + List subscribeUsers = userService.getSubscribeUsers(product); + emailService.sendEMails(false, subscribeUsers, product); + + } + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..0c0124cc61 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/service/EmailService.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/service/EmailService.java new file mode 100644 index 0000000000..0bd0841517 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/service/EmailService.java @@ -0,0 +1,49 @@ +package com.coderising.ood.srp.service; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import com.coderising.ood.srp.constant.CommonConstant; +import com.coderising.ood.srp.entity.Msg; +import com.coderising.ood.srp.entity.Product; +import com.coderising.ood.srp.entity.User; +import com.coderising.ood.srp.util.MailUtil; +import com.coderising.ood.srp.util.PropertiesUtil; + +public class EmailService { + + public boolean sendEMails(boolean debug, List mailingList, Product product) throws IOException + { + + System.out.println("开始发送邮件"); + Msg basemsg = PropertiesUtil.BASEMSG; + for (User user : mailingList) { + try + { + basemsg.setToAddress(user.getEmail()); + basemsg.setSubject(CommonConstant.SUBJECT); + basemsg.setMessage(CommonConstant.getProductMessage(user, product)); + if (basemsg.getToAddress().length() > 0) + MailUtil.sendEmail(debug,basemsg); + } + catch (Exception e) + { + + try { + MailUtil.sendEmail(debug,basemsg); + + } catch (Exception e2) + { + System.out.println("通过备用 SMTP服务器发送邮件失败: " + e2.getMessage()); + } + return false; + } + + } + return true; + + } + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/service/UserService.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/service/UserService.java new file mode 100644 index 0000000000..214442bdcd --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/service/UserService.java @@ -0,0 +1,17 @@ +package com.coderising.ood.srp.service; + +import java.util.List; + +import com.coderising.ood.srp.dao.UserDao; +import com.coderising.ood.srp.entity.Product; +import com.coderising.ood.srp.entity.User; + +public class UserService { + + private UserDao userDao= new UserDao(); + + public List getSubscribeUsers(Product product){ + return userDao.query("Select name from subscriptions where product_id= '" + product.getProductID() +"' and send_mail=1"); + } + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/FileUtil.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/FileUtil.java new file mode 100644 index 0000000000..4f2908a2c6 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/FileUtil.java @@ -0,0 +1,32 @@ +package com.coderising.ood.srp.util; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; + +import com.coderising.ood.srp.entity.Product; + +public class FileUtil { + + public static final String FILE_URL="C:\\Users\\Administrator\\git\\coding2017\\students\\641013587\\ood\\ood-assignment\\src\\main\\java\\com\\coderising\\ood\\srp\\product_promotion.txt"; + + public static Product readRecommendProduct() throws IOException{ + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(FILE_URL)); + String temp = br.readLine(); + String[] data = temp.split(" "); + Product product = new Product(); + product.setProductID(data[0]); + product.setProductDesc(data[1]); + System.out.println("产品ID = " + product.getProductID() + "\n"); + System.out.println("产品描述 = " + product.getProductDesc() + "\n"); + return product; + } catch (IOException e) { + throw new IOException(e.getMessage()); + } finally { + br.close(); + } + } + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/MailUtil.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/MailUtil.java new file mode 100644 index 0000000000..4387e6e73b --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/MailUtil.java @@ -0,0 +1,20 @@ +package com.coderising.ood.srp.util; + +import com.coderising.ood.srp.entity.Msg; + +public class MailUtil { + + public static void sendEmail( + boolean debug,Msg msg) { + //假装发了一封邮件 + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(msg.getFromAddress()).append("\n"); + buffer.append("To:").append(msg.getToAddress()).append("\n"); + buffer.append("Subject:").append(msg.getSubject()).append("\n"); + buffer.append("Content:").append(msg.getMessage()).append("\n"); + System.out.println(buffer.toString()); + + } + + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/PropertiesUtil.java b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/PropertiesUtil.java new file mode 100644 index 0000000000..7033920b35 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/util/PropertiesUtil.java @@ -0,0 +1,39 @@ +package com.coderising.ood.srp.util; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +import com.coderising.ood.srp.entity.Msg; + +public class PropertiesUtil { + public static final Properties pro; + public static final Msg BASEMSG = new Msg(); + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + + + static{ + pro = new Properties(); + FileInputStream in = null ; + try { + in= new FileInputStream("C:\\Users\\Administrator\\git\\coding2017\\students\\641013587\\ood\\ood-assignment\\src\\main\\java\\com\\coderising\\ood\\srp\\values.properties"); + pro.load(in); + BASEMSG.setAltSmtpHost(pro.getProperty(ALT_SMTP_SERVER)); + BASEMSG.setSmtpHost(SMTP_SERVER); + BASEMSG.setFromAddress(EMAIL_ADMIN); + } catch (IOException e) { + e.printStackTrace(); + }finally { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + +} diff --git a/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/values.properties b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/values.properties new file mode 100644 index 0000000000..1f67810743 --- /dev/null +++ b/students/641013587/ood/ood-assignment/src/main/java/com/coderising/ood/srp/values.properties @@ -0,0 +1,3 @@ +smtp.server = smtp.163.com +alt.smtp.server = smtp1.163.com +email.admin = admin@company.com \ No newline at end of file diff --git a/students/702282822/2_assignment/course/bad/Course.java b/students/702282822/2_assignment/course/bad/Course.java new file mode 100644 index 0000000000..436d092f58 --- /dev/null +++ b/students/702282822/2_assignment/course/bad/Course.java @@ -0,0 +1,24 @@ +package com.coderising.ood.course.bad; + +import java.util.List; + +public class Course { + private String id; + private String desc; + private int duration ; + + List prerequisites; + + public List getPrerequisites() { + return prerequisites; + } + + + public boolean equals(Object o){ + if(o == null || !(o instanceof Course)){ + return false; + } + Course c = (Course)o; + return (c != null) && c.id.equals(id); + } +} diff --git a/students/702282822/2_assignment/course/bad/CourseOffering.java b/students/702282822/2_assignment/course/bad/CourseOffering.java new file mode 100644 index 0000000000..e24bcd2062 --- /dev/null +++ b/students/702282822/2_assignment/course/bad/CourseOffering.java @@ -0,0 +1,24 @@ +package com.coderising.ood.course.bad; + +import java.util.ArrayList; +import java.util.List; + + +public class CourseOffering { + private Course course; + private String location; + private String teacher; + private int maxStudents; + + List students = new ArrayList(); + + public void addStudent(Student st) + { + if(st.canAttend(course) && maxStudents > students.size()) + { + students.add(st); + } + } + + +} diff --git a/students/702282822/2_assignment/course/bad/CourseService.java b/students/702282822/2_assignment/course/bad/CourseService.java new file mode 100644 index 0000000000..3d06149ca2 --- /dev/null +++ b/students/702282822/2_assignment/course/bad/CourseService.java @@ -0,0 +1,12 @@ +package com.coderising.ood.course.bad; + + + +public class CourseService { + + public void chooseCourse(Student student, CourseOffering sc){ + //如果学生上过该科目的先修科目,并且该课程还未满, 则学生可以加入该课程 + sc.addStudent(student); + } + +} diff --git a/students/702282822/2_assignment/course/bad/Student.java b/students/702282822/2_assignment/course/bad/Student.java new file mode 100644 index 0000000000..6629b60bfb --- /dev/null +++ b/students/702282822/2_assignment/course/bad/Student.java @@ -0,0 +1,20 @@ +package com.coderising.ood.course.bad; + +import java.util.ArrayList; +import java.util.List; + +public class Student { + private String id; + private String name; + private List coursesAlreadyTaken = new ArrayList(); + + public List getCoursesAlreadyTaken() { + return coursesAlreadyTaken; + } + public boolean canAttend(Course course){ + return getCoursesAlreadyTaken().containsAll( + course.getPrerequisites()); + } + + +} diff --git a/students/702282822/2_assignment/course/good/Course.java b/students/702282822/2_assignment/course/good/Course.java new file mode 100644 index 0000000000..aefc9692bb --- /dev/null +++ b/students/702282822/2_assignment/course/good/Course.java @@ -0,0 +1,18 @@ +package com.coderising.ood.course.good; + +import java.util.List; + +public class Course { + private String id; + private String desc; + private int duration ; + + List prerequisites; + + public List getPrerequisites() { + return prerequisites; + } + +} + + diff --git a/students/702282822/2_assignment/course/good/CourseOffering.java b/students/702282822/2_assignment/course/good/CourseOffering.java new file mode 100644 index 0000000000..8660ec8109 --- /dev/null +++ b/students/702282822/2_assignment/course/good/CourseOffering.java @@ -0,0 +1,34 @@ +package com.coderising.ood.course.good; + +import java.util.ArrayList; +import java.util.List; + +public class CourseOffering { + private Course course; + private String location; + private String teacher; + private int maxStudents; + + List students = new ArrayList(); + + public List getStudents() { + return students; + } + public int getMaxStudents() { + return maxStudents; + } + public Course getCourse() { + return course; + } + + + // 第二步: 把主要逻辑移动到CourseOffering 中 + public void addStudent(Student student){ + + if(student.canAttend(course) + && this.maxStudents > students.size()){ + students.add(student); + } + } + // 第三步: 重构CourseService +} diff --git a/students/702282822/2_assignment/course/good/CourseService.java b/students/702282822/2_assignment/course/good/CourseService.java new file mode 100644 index 0000000000..22ba4a5450 --- /dev/null +++ b/students/702282822/2_assignment/course/good/CourseService.java @@ -0,0 +1,14 @@ +package com.coderising.ood.course.good; + + + +public class CourseService { + + public void chooseCourse(Student student, CourseOffering sc){ + //第一步:重构: canAttend , 但是还有问题 + if(student.canAttend(sc.getCourse()) + && sc.getMaxStudents() > sc.getStudents().size()){ + sc.getStudents().add(student); + } + } +} diff --git a/students/702282822/2_assignment/course/good/Student.java b/students/702282822/2_assignment/course/good/Student.java new file mode 100644 index 0000000000..2c7e128b2a --- /dev/null +++ b/students/702282822/2_assignment/course/good/Student.java @@ -0,0 +1,21 @@ +package com.coderising.ood.course.good; + +import java.util.ArrayList; +import java.util.List; + +public class Student { + private String id; + private String name; + private List coursesAlreadyTaken = new ArrayList(); + + public List getCoursesAlreadyTaken() { + return coursesAlreadyTaken; + } + + public boolean canAttend(Course course){ + return this.coursesAlreadyTaken.containsAll( + course.getPrerequisites()); + } +} + + diff --git a/students/702282822/2_assignment/ocp/DateUtil.java b/students/702282822/2_assignment/ocp/DateUtil.java new file mode 100644 index 0000000000..b6cf28c096 --- /dev/null +++ b/students/702282822/2_assignment/ocp/DateUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return null; + } + +} diff --git a/students/702282822/2_assignment/ocp/Deliver.java b/students/702282822/2_assignment/ocp/Deliver.java new file mode 100644 index 0000000000..377fcf3a64 --- /dev/null +++ b/students/702282822/2_assignment/ocp/Deliver.java @@ -0,0 +1,5 @@ + +public interface Dilever +{ + public void process(string str); +} diff --git a/students/702282822/2_assignment/ocp/DeliveryFactory.java b/students/702282822/2_assignment/ocp/DeliveryFactory.java new file mode 100644 index 0000000000..daf562759e --- /dev/null +++ b/students/702282822/2_assignment/ocp/DeliveryFactory.java @@ -0,0 +1,20 @@ + +public interface DeliveryFactory +{ + public static Deliver createDelivery(int type) + { + if(type == 1) + { + return new Email_Deliver(); + } + else if(type == 2) + { + return new SMS_Deliver(); + } + else if(type == 3) + { + return new Print_Deliver(); + } + } + +} diff --git a/students/702282822/2_assignment/ocp/Email_Deliver.java b/students/702282822/2_assignment/ocp/Email_Deliver.java new file mode 100644 index 0000000000..c4eee88ded --- /dev/null +++ b/students/702282822/2_assignment/ocp/Email_Deliver.java @@ -0,0 +1,9 @@ + +public class Email_Deliver implements dileverMsg +{ + public void process(string str) + { + MailUtil.send(logMsg); + } + +} diff --git a/students/702282822/2_assignment/ocp/Formatter.java b/students/702282822/2_assignment/ocp/Formatter.java new file mode 100644 index 0000000000..35cf0bf4e3 --- /dev/null +++ b/students/702282822/2_assignment/ocp/Formatter.java @@ -0,0 +1,4 @@ +public interface Formatter +{ + public string format(string msg); +} diff --git a/students/702282822/2_assignment/ocp/FormatterFactory.java b/students/702282822/2_assignment/ocp/FormatterFactory.java new file mode 100644 index 0000000000..1f9ef348fd --- /dev/null +++ b/students/702282822/2_assignment/ocp/FormatterFactory.java @@ -0,0 +1,14 @@ + +public class FormatterFactory { + public static Formatter createFormate(int type) + { + if(type == 1) + { + return new Raw_log(); + } + else if(type == 2) + { + return new Raw_log_withDate(); + } + } +} diff --git a/students/702282822/2_assignment/ocp/Logger.java b/students/702282822/2_assignment/ocp/Logger.java new file mode 100644 index 0000000000..839c8d74cd --- /dev/null +++ b/students/702282822/2_assignment/ocp/Logger.java @@ -0,0 +1,18 @@ +package com.coderising.ood.ocp; + +public class Logger { + + private Formatter formatter; + private Dilever deliver; + public Logger(Formatter formatter, Dilever deliver) + { + this.formatter = formatter; + this.deliver = deliver; + } + public void log(String msg) + { + String message = formatter.formate(msg); + deliver.process(message); + } +} + diff --git a/students/702282822/2_assignment/ocp/MailUtil.java b/students/702282822/2_assignment/ocp/MailUtil.java new file mode 100644 index 0000000000..ec54b839c5 --- /dev/null +++ b/students/702282822/2_assignment/ocp/MailUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/702282822/2_assignment/ocp/Print_Deliver.java b/students/702282822/2_assignment/ocp/Print_Deliver.java new file mode 100644 index 0000000000..10c31ba398 --- /dev/null +++ b/students/702282822/2_assignment/ocp/Print_Deliver.java @@ -0,0 +1,8 @@ + +public class Print_Deliver +{ + public void process(string str) + { + System.out.print(str); + } +} diff --git a/students/702282822/2_assignment/ocp/Raw_log.java b/students/702282822/2_assignment/ocp/Raw_log.java new file mode 100644 index 0000000000..5f6af6cf2c --- /dev/null +++ b/students/702282822/2_assignment/ocp/Raw_log.java @@ -0,0 +1,8 @@ + +public class Raw_log implements Formatter +{ + public string format(string msg) + { + return msg; + } +} diff --git a/students/702282822/2_assignment/ocp/Raw_log_withDate.java b/students/702282822/2_assignment/ocp/Raw_log_withDate.java new file mode 100644 index 0000000000..3458923e3f --- /dev/null +++ b/students/702282822/2_assignment/ocp/Raw_log_withDate.java @@ -0,0 +1,12 @@ + +public class Raw_log_withDate implements Raw_log +{ + public string format(string msg) + { + string msg = super.format(msg); + String txtDate = DateUtil.getCurrentDateAsString(); + return txtDate + ": " + msg; + } + + +} diff --git a/students/702282822/2_assignment/ocp/SMSUtil.java b/students/702282822/2_assignment/ocp/SMSUtil.java new file mode 100644 index 0000000000..13cf802418 --- /dev/null +++ b/students/702282822/2_assignment/ocp/SMSUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class SMSUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/702282822/2_assignment/ocp/SMS_Deliver.java b/students/702282822/2_assignment/ocp/SMS_Deliver.java new file mode 100644 index 0000000000..047cf55b28 --- /dev/null +++ b/students/702282822/2_assignment/ocp/SMS_Deliver.java @@ -0,0 +1,10 @@ + +public class SMS_Deliver implements dileverMsg +{ + public void process(string str) + { + SMSUtil.send(str); + } + + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/DateUtil.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/DateUtil.java" new file mode 100644 index 0000000000..b6cf28c096 --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/DateUtil.java" @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return null; + } + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/EmailLogger.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/EmailLogger.java" new file mode 100644 index 0000000000..7a51f98c23 --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/EmailLogger.java" @@ -0,0 +1,9 @@ +package com.coderising.ood.ocp; + +public class EmailLogger extends Logger{ + + public void log(String msg){ + MailUtil.send(msg); + } + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/LogOutput.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/LogOutput.java" new file mode 100644 index 0000000000..caf9986293 --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/LogOutput.java" @@ -0,0 +1,8 @@ +package com.coderising.ood.ocp; + +public abstract class LogOutput { + + + public abstract void logOutput(String msg,Logger logger); + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/Logger.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/Logger.java" new file mode 100644 index 0000000000..8913377e5a --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/Logger.java" @@ -0,0 +1,7 @@ +package com.coderising.ood.ocp; + +public abstract class Logger { + + public abstract void log(String msg); +} + diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/MailUtil.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/MailUtil.java" new file mode 100644 index 0000000000..ec54b839c5 --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/MailUtil.java" @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/PrintLogger.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/PrintLogger.java" new file mode 100644 index 0000000000..6960fb9af3 --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/PrintLogger.java" @@ -0,0 +1,9 @@ +package com.coderising.ood.ocp; + +public class PrintLogger extends Logger{ + +public void log(String msg){ + System.out.println(msg); + } + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/RawLogOutput.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/RawLogOutput.java" new file mode 100644 index 0000000000..9603d16687 --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/RawLogOutput.java" @@ -0,0 +1,9 @@ +package com.coderising.ood.ocp; + +public class RawLogOutput extends LogOutput{ + + public void logOutput(String msg,Logger logger) { + logger.log(msg); + } + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/RawLogWithDateOutput.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/RawLogWithDateOutput.java" new file mode 100644 index 0000000000..5f414d992d --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/RawLogWithDateOutput.java" @@ -0,0 +1,12 @@ +package com.coderising.ood.ocp; + +public class RawLogWithDateOutput extends LogOutput{ + + @Override + public void logOutput(String msg,Logger logger) { + String txtDate = DateUtil.getCurrentDateAsString(); + String logMsg = txtDate + ": " + msg; + logger.log(logMsg); + } + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/SMSUtil.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/SMSUtil.java" new file mode 100644 index 0000000000..13cf802418 --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/SMSUtil.java" @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class SMSUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git "a/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/SmsLogger.java" "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/SmsLogger.java" new file mode 100644 index 0000000000..8a22e52e78 --- /dev/null +++ "b/students/706097141/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232/ocp/SmsLogger.java" @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +public class SmsLogger extends Logger{ + + + public void log(String msg){ + + SMSUtil.send(msg); + } + +} diff --git a/students/724222786/ood/ood-assignment/.gitignore b/students/724222786/ood/ood-assignment/.gitignore new file mode 100644 index 0000000000..c948edfead --- /dev/null +++ b/students/724222786/ood/ood-assignment/.gitignore @@ -0,0 +1,4 @@ +.settings\ +target\ +.classpath +.project \ No newline at end of file diff --git a/students/724222786/ood/ood-assignment/pom.xml b/students/724222786/ood/ood-assignment/pom.xml new file mode 100644 index 0000000000..a4d92e7f05 --- /dev/null +++ b/students/724222786/ood/ood-assignment/pom.xml @@ -0,0 +1,38 @@ + + 4.0.0 + + com.coderising + ood-assignment + 0.0.1-SNAPSHOT + jar + + ood-assignment + http://maven.apache.org + + + UTF-8 + + + + + + junit + junit + 4.12 + + + + org.apache.logging.log4j + log4j-core + 2.8.2 + + + + + diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/Test.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/Test.java new file mode 100644 index 0000000000..8dc90b701e --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/Test.java @@ -0,0 +1,23 @@ +package com.coderising.ood.answer; + +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.coderising.ood.answer.entity.Product; +import com.coderising.ood.answer.service.MailService; +import com.coderising.ood.answer.utils.FileUtils; +import com.coderising.ood.answer.utils.ProductUtils; + +public class Test { + private static final Logger log = LogManager.getLogger(Test.class); + public static void main(String[] args) { + MailService service = new MailService(); + List list = ProductUtils.getList(FileUtils.readFile()); + service.sendMail(list); + + } + + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/config/config.properties b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/config/config.properties new file mode 100644 index 0000000000..b798e9274a --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/config/config.properties @@ -0,0 +1,5 @@ +smtp.server=smtp.163.com +alt.smtp.server=smtp1.163.com +email.admin=admin@company.com + +product.txt=com/coderising/ood/answer/config/product_promotion.txt \ No newline at end of file diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/config/product_promotion.txt b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/config/product_promotion.txt new file mode 100644 index 0000000000..b7a974adb3 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/config/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/MailMessage.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/MailMessage.java new file mode 100644 index 0000000000..cb95f6296c --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/MailMessage.java @@ -0,0 +1,63 @@ +package com.coderising.ood.answer.entity; + +import java.io.Serializable; + +import com.coderising.ood.answer.utils.ConfigUtils; + +/** + * 邮件类 + * @author readke + * + */ +public class MailMessage implements Serializable{ + + private static final long serialVersionUID = -3221160075625357827L; + + private String toAddr; + private String fromAddr; + private String subject; + private String content; + + public static MailMessage getMessage(String from,String subject,String content,Product p,User u){ + MailMessage m = new MailMessage(); + if(content != null && !content.isEmpty()) + content = "尊敬的 "+u.getName()+", 您关注的产品 " + p.getpDec() + " 降价了,欢迎购买!" ; + if(subject != null && !subject.isEmpty()){ + subject = "您关注的产品降价了"; + } + if(from != null && !from.isEmpty()){ + from = ConfigUtils.getProperty("smtp.server"); + } + m.setFromAddr(from); + m.setToAddr(u.getEmail()); + m.setSubject(subject); + m.setContent(content); + return m; + } + + public String getToAddr() { + return toAddr; + } + public void setToAddr(String toAddr) { + this.toAddr = toAddr; + } + public String getFromAddr() { + return fromAddr; + } + public void setFromAddr(String fromAddr) { + this.fromAddr = fromAddr; + } + public String getSubject() { + return subject; + } + public void setSubject(String subject) { + this.subject = subject; + } + public String getContent() { + return content; + } + public void setContent(String content) { + this.content = content; + } + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/Product.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/Product.java new file mode 100644 index 0000000000..2b4a81535e --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/Product.java @@ -0,0 +1,38 @@ +package com.coderising.ood.answer.entity; + +import java.io.Serializable; + +/** + * 产品类 + * @author readke + * + */ +public class Product implements Serializable{ + private static final long serialVersionUID = 409352331475497580L; + + private String pId; + private String pDec; + + public Product() { + + } + public Product(String pId, String pDec) { + super(); + this.pId = pId; + this.pDec = pDec; + } + public String getpId() { + return pId; + } + public void setpId(String pId) { + this.pId = pId; + } + public String getpDec() { + return pDec; + } + public void setpDec(String pDec) { + this.pDec = pDec; + } + + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/User.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/User.java new file mode 100644 index 0000000000..dd71a8e26f --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/entity/User.java @@ -0,0 +1,35 @@ +package com.coderising.ood.answer.entity; + +import java.io.Serializable; + +/** + * 用户类 + * @author readke + * + */ +public class User implements Serializable{ + private static final long serialVersionUID = -7916484660512326120L; + + private String id; + private String name; + private String email; + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/service/MailService.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/service/MailService.java new file mode 100644 index 0000000000..cb63b8a2d1 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/service/MailService.java @@ -0,0 +1,27 @@ +package com.coderising.ood.answer.service; + +import java.util.List; + +import com.coderising.ood.answer.entity.MailMessage; +import com.coderising.ood.answer.entity.Product; +import com.coderising.ood.answer.entity.User; +import com.coderising.ood.answer.utils.DBUtils; +import com.coderising.ood.answer.utils.MailUtils; + +/** + * 邮件发送服务 + * @author readke + * + */ +public class MailService { + public void sendMail(List list){ + + for(Product p: list){ + List uList = DBUtils.queryByProductID(p.getpId()); + for(User u : uList){ + MailMessage m = MailMessage.getMessage("","", "", p, u); + MailUtils.sendMail(m); + } + } + } +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/ConfigUtils.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/ConfigUtils.java new file mode 100644 index 0000000000..3b67cbf5fb --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/ConfigUtils.java @@ -0,0 +1,48 @@ +package com.coderising.ood.answer.utils; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * 配置文件读取工具 + * @author readke + * + */ +public class ConfigUtils { + + private static final Logger log = LogManager.getLogger(ConfigUtils.class); + private static Properties prop = null; + + static { + InputStream in = ConfigUtils.class.getResourceAsStream("../config/config.properties"); + prop = new Properties(); + //System.out.println(in); + try { + prop.load(in); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }finally { + if(in != null){ + try { + in.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + } + + public static String getProperty(String key){ + return prop.getProperty(key); + } + + public static void main(String[] args) { + log.info(ConfigUtils.getProperty("smtp.server")); + } +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/DBUtils.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/DBUtils.java new file mode 100644 index 0000000000..757098ef6c --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/DBUtils.java @@ -0,0 +1,32 @@ +package com.coderising.ood.answer.utils; + +import java.util.ArrayList; +import java.util.List; + +import com.coderising.ood.answer.entity.User; + +/** + * db工具 + * @author readke + * + */ +public class DBUtils { + + public static List queryByProductID(String productID){ + /** + * sql = "Select name from subscriptions " + + "where product_id= '" + productID +"' " + + "and send_mail=1 "; + */ + List userList = new ArrayList(); + + for (int i = 1; i <= 3; i++) { + User userInfo = new User(); + userInfo.setName("User" + i); + userInfo.setEmail("aa@bb.com"); + userList.add(userInfo); + } + + return userList; + } +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/FileUtils.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/FileUtils.java new file mode 100644 index 0000000000..03dfcfe66d --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/FileUtils.java @@ -0,0 +1,39 @@ +package com.coderising.ood.answer.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.net.URI; +import java.net.URL; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * 文件读取工具 + * @author readke + * + */ +public class FileUtils { + private static final Logger log = LogManager.getLogger(FileUtils.class); + public static File readFile(){ + + File file = null; + BufferedReader br = null; + + try { + URL url = FileUtils.class.getClassLoader().getResource(ConfigUtils.getProperty("product.txt")); + log.info(url.getPath()); + URI uri = url.toURI(); + file = new File(uri); + + }catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + return file; + } + + public static void main(String[] args) { + readFile(); + } +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/MailUtils.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/MailUtils.java new file mode 100644 index 0000000000..6d08cd7968 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/MailUtils.java @@ -0,0 +1,49 @@ +package com.coderising.ood.answer.utils; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.coderising.ood.answer.entity.MailMessage; + +/** + * 邮件发送工具 + * @author readke + * + */ +public class MailUtils { + private static final Logger log = LogManager.getLogger(MailUtils.class); + + private static final String SMTP_SERVER = ConfigUtils.getProperty("smtp.server"); + private static final String ALT_SMTP_SERVER = ConfigUtils.getProperty("alt.smtp.server"); + + public static void sendMail(MailMessage email){ + try{ + sendMail(email, SMTP_SERVER); + log.info("使用主服务器发送邮件"); + log.info("发送成功"); + }catch (Exception e) { + try{ + sendMail(email, ALT_SMTP_SERVER); + log.info("使用备用服务器发送邮件"); + }catch (Exception e1){ + log.error("发送失败"); + } + } + } + + public static void sendMail(MailMessage email,String server) throws Exception{ + sendMail(email.getFromAddr(), email.getToAddr(), + server, email.getSubject(), email.getContent()); + } + + public static void sendMail(String from,String to,String server,String subject,String content) throws Exception{ + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(from).append("\n"); + buffer.append("To:").append(to).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(content).append("\n"); + System.out.println(buffer.toString()); + } + + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/ProductUtils.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/ProductUtils.java new file mode 100644 index 0000000000..1b854bfeb7 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/answer/utils/ProductUtils.java @@ -0,0 +1,52 @@ +package com.coderising.ood.answer.utils; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.coderising.ood.answer.entity.Product; + +/** + * 产品工具 + * @author readke + * + */ +public class ProductUtils { + private static final Logger log = LogManager.getLogger(ProductUtils.class); + + public static List getList(File file){ + List list = null; + BufferedReader br = null; + + try { + list = new ArrayList<>(); + br = new BufferedReader(new FileReader(file)); + while(br.ready()){ + Product p = new Product(); + String temp = br.readLine(); + String[] data = temp.split(" "); + p.setpId(data[0]); + p.setpDec(data[1]); + list.add(p); + } + + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return list; + } + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java new file mode 100644 index 0000000000..f328c1816a --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/Configuration.java @@ -0,0 +1,23 @@ +package com.coderising.ood.srp; +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + static Map configurations = new HashMap<>(); + static{ + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * @param key + * @return + */ + public String getProperty(String key) { + + return configurations.get(key); + } + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/ConfigurationKeys.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/ConfigurationKeys.java new file mode 100644 index 0000000000..8695aed644 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/ConfigurationKeys.java @@ -0,0 +1,9 @@ +package com.coderising.ood.srp; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java new file mode 100644 index 0000000000..82e9261d18 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/DBUtil.java @@ -0,0 +1,25 @@ +package com.coderising.ood.srp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class DBUtil { + + /** + * 应该从数据库读, 但是简化为直接生成。 + * @param sql + * @return + */ + public static List query(String sql){ + + List userList = new ArrayList(); + for (int i = 1; i <= 3; i++) { + HashMap userInfo = new HashMap(); + userInfo.put("NAME", "User" + i); + userInfo.put("EMAIL", "aa@bb.com"); + userList.add(userInfo); + } + + return userList; + } +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java new file mode 100644 index 0000000000..9f9e749af7 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/MailUtil.java @@ -0,0 +1,18 @@ +package com.coderising.ood.srp; + +public class MailUtil { + + public static void sendEmail(String toAddress, String fromAddress, String subject, String message, String smtpHost, + boolean debug) { + //假装发了一封邮件 + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(toAddress).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(message).append("\n"); + System.out.println(buffer.toString()); + + } + + +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java new file mode 100644 index 0000000000..781587a846 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/PromotionMail.java @@ -0,0 +1,199 @@ +package com.coderising.ood.srp; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +public class PromotionMail { + + + protected String sendMailQuery = null; + + + protected String smtpHost = null; + protected String altSmtpHost = null; + protected String fromAddress = null; + protected String toAddress = null; + protected String subject = null; + protected String message = null; + + protected String productID = null; + protected String productDesc = null; + + private static Configuration config; + + + + private static final String NAME_KEY = "NAME"; + private static final String EMAIL_KEY = "EMAIL"; + + + public static void main(String[] args) throws Exception { + + File f = new File("C:\\coderising\\workspace_ds\\ood-example\\src\\product_promotion.txt"); + boolean emailDebug = false; + + PromotionMail pe = new PromotionMail(f, emailDebug); + + } + + + public PromotionMail(File file, boolean mailDebug) throws Exception { + + //读取配置文件, 文件中只有一行用空格隔开, 例如 P8756 iPhone8 + readFile(file); + + + config = new Configuration(); + + setSMTPHost(); + setAltSMTPHost(); + + + setFromAddress(); + + + setLoadQuery(); + + sendEMails(mailDebug, loadMailingList()); + + + } + + + + + protected void setProductID(String productID) + { + this.productID = productID; + + } + + protected String getproductID() + { + return productID; + } + + protected void setLoadQuery() throws Exception { + + sendMailQuery = "Select name from subscriptions " + + "where product_id= '" + productID +"' " + + "and send_mail=1 "; + + + System.out.println("loadQuery set"); + } + + + protected void setSMTPHost() + { + smtpHost = config.getProperty(ConfigurationKeys.SMTP_SERVER); + } + + + protected void setAltSMTPHost() + { + altSmtpHost = config.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + + } + + + protected void setFromAddress() + { + fromAddress = config.getProperty(ConfigurationKeys.EMAIL_ADMIN); + } + + protected void setMessage(HashMap userInfo) throws IOException + { + + String name = (String) userInfo.get(NAME_KEY); + + subject = "您关注的产品降价了"; + message = "尊敬的 "+name+", 您关注的产品 " + productDesc + " 降价了,欢迎购买!" ; + + + + } + + + protected void readFile(File file) throws IOException // @02C + { + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(file)); + String temp = br.readLine(); + String[] data = temp.split(" "); + + setProductID(data[0]); + setProductDesc(data[1]); + + System.out.println("产品ID = " + productID + "\n"); + System.out.println("产品描述 = " + productDesc + "\n"); + + } catch (IOException e) { + throw new IOException(e.getMessage()); + } finally { + br.close(); + } + } + + private void setProductDesc(String desc) { + this.productDesc = desc; + } + + + protected void configureEMail(HashMap userInfo) throws IOException + { + toAddress = (String) userInfo.get(EMAIL_KEY); + if (toAddress.length() > 0) + setMessage(userInfo); + } + + protected List loadMailingList() throws Exception { + return DBUtil.query(this.sendMailQuery); + } + + + protected void sendEMails(boolean debug, List mailingList) throws IOException + { + + System.out.println("开始发送邮件"); + + + if (mailingList != null) { + Iterator iter = mailingList.iterator(); + while (iter.hasNext()) { + configureEMail((HashMap) iter.next()); + try + { + if (toAddress.length() > 0) + MailUtil.sendEmail(toAddress, fromAddress, subject, message, smtpHost, debug); + } + catch (Exception e) + { + + try { + MailUtil.sendEmail(toAddress, fromAddress, subject, message, altSmtpHost, debug); + + } catch (Exception e2) + { + System.out.println("通过备用 SMTP服务器发送邮件失败: " + e2.getMessage()); + } + } + } + + + } + + else { + System.out.println("没有邮件发送"); + + } + + } +} diff --git a/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..b7a974adb3 --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/724222786/ood/ood-assignment/src/main/java/log4j2.xml b/students/724222786/ood/ood-assignment/src/main/java/log4j2.xml new file mode 100644 index 0000000000..6fc38d8b1b --- /dev/null +++ b/students/724222786/ood/ood-assignment/src/main/java/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/students/727171008/src/com/coderising/ood/ocp/Formatter.java b/students/727171008/src/com/coderising/ood/ocp/Formatter.java new file mode 100644 index 0000000000..07391dacab --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/Formatter.java @@ -0,0 +1,5 @@ +package com.coderising.ood.ocp; + +public interface Formatter { + String formate(String msg); +} diff --git a/students/727171008/src/com/coderising/ood/ocp/FormatterFactory.java b/students/727171008/src/com/coderising/ood/ocp/FormatterFactory.java new file mode 100644 index 0000000000..4d6cc9603e --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/FormatterFactory.java @@ -0,0 +1,14 @@ +package com.coderising.ood.ocp; + +public class FormatterFactory { + public Formatter createFormatter(int type) { + Formatter formatter = null; + if (type == 1) { + formatter = new RawFormatter(); + } + if (type == 2) { + formatter = new HtmlFormatter(); + } + return formatter; + } +} diff --git a/students/727171008/src/com/coderising/ood/ocp/HtmlFormatter.java b/students/727171008/src/com/coderising/ood/ocp/HtmlFormatter.java new file mode 100644 index 0000000000..6d3d76f58e --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/HtmlFormatter.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +public class HtmlFormatter implements Formatter { + + @Override + public String formate(String msg) { + + return null; + } + +} diff --git a/students/727171008/src/com/coderising/ood/ocp/LogTestDrive.java b/students/727171008/src/com/coderising/ood/ocp/LogTestDrive.java new file mode 100644 index 0000000000..d96987e6d4 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/LogTestDrive.java @@ -0,0 +1,20 @@ +package com.coderising.ood.ocp; + +public class LogTestDrive { + + public static void main(String[] args) { + FormatterFactory ff = new FormatterFactory(); + SenderFactory sf = new SenderFactory(); + + Formatter formatter = ff.createFormatter(1); + Sender sender = sf.createSender(1); + + Logger logger = new Logger(formatter, sender); + String msg = "此处应该从文本读取?或者html读取?"; + logger.log(msg); + + System.out.println("end"); + + } + +} diff --git a/students/727171008/src/com/coderising/ood/ocp/Logger.java b/students/727171008/src/com/coderising/ood/ocp/Logger.java new file mode 100644 index 0000000000..a02cf8658c --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/Logger.java @@ -0,0 +1,15 @@ +package com.coderising.ood.ocp; + +public class Logger { + private Formatter formatter; + private Sender sender; + + public Logger(Formatter formatter, Sender sender) { + this.formatter = formatter; + this.sender = sender; + } + + public void log(String msg) { + sender.send(formatter.formate(msg)); + } +} diff --git a/students/727171008/src/com/coderising/ood/ocp/MailSenderImp.java b/students/727171008/src/com/coderising/ood/ocp/MailSenderImp.java new file mode 100644 index 0000000000..ab79fe070b --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/MailSenderImp.java @@ -0,0 +1,12 @@ +package com.coderising.ood.ocp; + +public class MailSenderImp implements Sender { + + @Override + public String send(String msg) { + + return "Raw data "; + + } + +} diff --git a/students/727171008/src/com/coderising/ood/ocp/PrintSenderImp.java b/students/727171008/src/com/coderising/ood/ocp/PrintSenderImp.java new file mode 100644 index 0000000000..22a4c8db2b --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/PrintSenderImp.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +public class PrintSenderImp implements Sender { + + @Override + public String send(String msg) { + + return "print "; + } + +} diff --git a/students/727171008/src/com/coderising/ood/ocp/RawFormatter.java b/students/727171008/src/com/coderising/ood/ocp/RawFormatter.java new file mode 100644 index 0000000000..762917e981 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/RawFormatter.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class RawFormatter implements Formatter { + + @Override + public String formate(String msg) { + return null; + } + +} diff --git a/students/727171008/src/com/coderising/ood/ocp/SMSSenderImp.java b/students/727171008/src/com/coderising/ood/ocp/SMSSenderImp.java new file mode 100644 index 0000000000..6aaa16f23e --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/SMSSenderImp.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +public class SMSSenderImp implements Sender { + + @Override + public String send(String msg) { + + return "SMS data "; + } + +} diff --git a/students/727171008/src/com/coderising/ood/ocp/Sender.java b/students/727171008/src/com/coderising/ood/ocp/Sender.java new file mode 100644 index 0000000000..4c54985454 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/Sender.java @@ -0,0 +1,5 @@ +package com.coderising.ood.ocp; + +public interface Sender { + String send(String msg); +} diff --git a/students/727171008/src/com/coderising/ood/ocp/SenderFactory.java b/students/727171008/src/com/coderising/ood/ocp/SenderFactory.java new file mode 100644 index 0000000000..96663989cf --- /dev/null +++ b/students/727171008/src/com/coderising/ood/ocp/SenderFactory.java @@ -0,0 +1,17 @@ +package com.coderising.ood.ocp; + +public class SenderFactory { + public Sender createSender(int type) { + Sender sender = null; + if(type == 1) { + sender = new MailSenderImp(); + } + if (type == 2) { + sender = new SMSSenderImp(); + } + if (type == 3) { + sender = new PrintSenderImp(); + } + return sender; + } +} diff --git a/students/727171008/src/com/coderising/ood/srp/Configuration.java b/students/727171008/src/com/coderising/ood/srp/Configuration.java new file mode 100644 index 0000000000..5a52efee25 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/Configuration.java @@ -0,0 +1,26 @@ +package com.coderising.ood.srp; + +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + static Map configurations = new HashMap<>(); + static { + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * + * @param key + * @return + */ + public String getProperty(String key) { + + return configurations.get(key); + } + +} diff --git a/students/727171008/src/com/coderising/ood/srp/ConfigurationKeys.java b/students/727171008/src/com/coderising/ood/srp/ConfigurationKeys.java new file mode 100644 index 0000000000..945db9004a --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/ConfigurationKeys.java @@ -0,0 +1,9 @@ +package com.coderising.ood.srp.good1; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + +} diff --git a/students/727171008/src/com/coderising/ood/srp/Mail.java b/students/727171008/src/com/coderising/ood/srp/Mail.java new file mode 100644 index 0000000000..8ecea4a35e --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/Mail.java @@ -0,0 +1,34 @@ +package com.coderising.ood.srp; + +import java.util.List; + +public class Mail { + private User user; + + public Mail(User user) { + this.user = user; + } + + public String getAddress() { + return user.getEMailAddress(); + } + + public String getSubjcet() { + return "您关注的商品降价了!"; + } + + public String getBody() { + return "尊敬的用户: " + user.getName() + ", 您关注的商品: " + this.buildProductDescList(); + } + + private String buildProductDescList() { + List products = user.getSubscribedProducts(); + + return null; + } + + public String getSubject() { + + return null; + } +} diff --git a/students/727171008/src/com/coderising/ood/srp/MailSender.java b/students/727171008/src/com/coderising/ood/srp/MailSender.java new file mode 100644 index 0000000000..48c29ac877 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/MailSender.java @@ -0,0 +1,35 @@ +package com.coderising.ood.srp; + +public class MailSender { + + private String fromAddress; + private String smtpHost; + private String altSmtpHost; + + public MailSender(Configuration config) { + this.fromAddress = config.getProperty(ConfigurationKeys.EMAIL_ADMIN); + this.smtpHost = config.getProperty(ConfigurationKeys.SMTP_SERVER); + this.altSmtpHost = config.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + } + + public void sendMail(Mail mail) { + try { + sendEmail(mail, this.smtpHost); + } catch (Exception e) { + try { + sendEmail(mail, this.altSmtpHost); + } catch (Exception ex) { + System.out.println("通过备用 SMTP服务器发送邮件失败: " + ex.getMessage()); + } + + } + } + + private void sendEmail(Mail mail, String smtpHost) { + + String toAddress = mail.getAddress(); + String subject = mail.getSubject(); + String msg = mail.getBody(); + // 发送邮件 + } +} diff --git a/students/727171008/src/com/coderising/ood/srp/Product.java b/students/727171008/src/com/coderising/ood/srp/Product.java new file mode 100644 index 0000000000..d04cdb97f4 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/Product.java @@ -0,0 +1,10 @@ +package com.coderising.ood.srp; + +public class Product { + private String id; + private String desc; + + public String getDesc() { + return desc; + } +} diff --git a/students/727171008/src/com/coderising/ood/srp/ProductService.java b/students/727171008/src/com/coderising/ood/srp/ProductService.java new file mode 100644 index 0000000000..5eea405243 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/ProductService.java @@ -0,0 +1,16 @@ +package com.coderising.ood.srp; + +import java.io.File; + +public class ProductService { + public Product getPromotionProduct() { + File f = new File("F:\\coding2017\\com\\codering\\ood\\src\\product_promotion.txt"); + Product product = readFile(f); + return product; + } + + private Product readFile(File file) { + + return null; + } +} diff --git a/students/727171008/src/com/coderising/ood/srp/PromotionJob.java b/students/727171008/src/com/coderising/ood/srp/PromotionJob.java new file mode 100644 index 0000000000..616335aa05 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/PromotionJob.java @@ -0,0 +1,24 @@ +package com.coderising.ood.srp; + +import java.util.List; + +public class PromotionJob { + + private ProductService productService = null; // 获取production service + private UserService userService = null;// 获取UserService + + public void run() { + + Configuration cfg = new Configuration(); + + Product p = productService.getPromotionProduct(); + + List users = userService.getUsers(p); //一次只读取了一件商品 + + MailSender mailSender = new MailSender(cfg); + + for (User user : users) { + mailSender.sendMail(new Mail(user)); + } + } +} diff --git a/students/727171008/src/com/coderising/ood/srp/User.java b/students/727171008/src/com/coderising/ood/srp/User.java new file mode 100644 index 0000000000..a79bc5c97a --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/User.java @@ -0,0 +1,26 @@ +package com.coderising.ood.srp; + +import java.util.List; + +public class User { + + private String name; + private String emailAddress; + + private List subscribedProducts; + + public String getName() { + + return name; + } + + public String getEMailAddress() { + + return emailAddress; + } + + public List getSubscribedProducts() { + + return this.subscribedProducts; + } +} diff --git a/students/727171008/src/com/coderising/ood/srp/UserService.java b/students/727171008/src/com/coderising/ood/srp/UserService.java new file mode 100644 index 0000000000..9bc682a229 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/UserService.java @@ -0,0 +1,11 @@ +package com.coderising.ood.srp; + +import java.util.List; + +public class UserService { + + public List getUsers(Product product) { + // 调用DAO相关的类从数据库中读取订阅产品的用户列表 + return null; + } +} diff --git a/students/727171008/src/com/coderising/ood/srp/product_promotion.txt b/students/727171008/src/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..b7a974adb3 --- /dev/null +++ b/students/727171008/src/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/769232552/season_two/src/main/java/work02/ocp/DateUtil.java b/students/769232552/season_two/src/main/java/work02/ocp/DateUtil.java new file mode 100644 index 0000000000..ab721d91aa --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/DateUtil.java @@ -0,0 +1,10 @@ +package work02.ocp; + +public class DateUtil { + + public static String getCurrentDateAsString() { + + return null; + } + +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/Formatter.java b/students/769232552/season_two/src/main/java/work02/ocp/Formatter.java new file mode 100644 index 0000000000..ce705806b5 --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/Formatter.java @@ -0,0 +1,7 @@ +package work02.ocp; + +public interface Formatter { + + String formatMsg(String msg); + +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/Logger.java b/students/769232552/season_two/src/main/java/work02/ocp/Logger.java new file mode 100644 index 0000000000..0f0ecd7ae0 --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/Logger.java @@ -0,0 +1,29 @@ +package work02.ocp; + +public class Logger { + + public final int RAW_LOG = 1; + public final int RAW_LOG_WITH_DATE = 2; + public final int EMAIL_LOG = 1; + public final int SMS_LOG = 2; + public final int PRINT_LOG = 3; + + int type = 0; + int method = 0; + + public Logger(int logType, int logMethod){ + this.type = logType; + this.method = logMethod; + } + + Sender sender; + Formatter formatter; + + public void log(String msg){ + + String logMsg = formatter.formatMsg(msg); + sender.send(logMsg); + + } +} + diff --git a/students/769232552/season_two/src/main/java/work02/ocp/MailSender.java b/students/769232552/season_two/src/main/java/work02/ocp/MailSender.java new file mode 100644 index 0000000000..1d13f449eb --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/MailSender.java @@ -0,0 +1,7 @@ +package work02.ocp; + +public class MailSender implements Sender { + public void send(String msg) { + MailUtil.send(msg); + } +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/MailUtil.java b/students/769232552/season_two/src/main/java/work02/ocp/MailUtil.java new file mode 100644 index 0000000000..62e26c25be --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/MailUtil.java @@ -0,0 +1,10 @@ +package work02.ocp; + +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/PrinterSender.java b/students/769232552/season_two/src/main/java/work02/ocp/PrinterSender.java new file mode 100644 index 0000000000..7511b9652f --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/PrinterSender.java @@ -0,0 +1,8 @@ +package work02.ocp; + + +public class PrinterSender implements Sender { + public void send(String msg) { + System.out.println(msg); + } +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/RawDateFormatter.java b/students/769232552/season_two/src/main/java/work02/ocp/RawDateFormatter.java new file mode 100644 index 0000000000..16db075e51 --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/RawDateFormatter.java @@ -0,0 +1,9 @@ +package work02.ocp; + +public class RawDateFormatter implements Formatter { + + public String formatMsg(String msg) { + String txtDate = DateUtil.getCurrentDateAsString(); + return txtDate + ": " + msg; + } +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/RawFormatter.java b/students/769232552/season_two/src/main/java/work02/ocp/RawFormatter.java new file mode 100644 index 0000000000..9ff801b9de --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/RawFormatter.java @@ -0,0 +1,8 @@ +package work02.ocp; + +public class RawFormatter implements Formatter { + + public String formatMsg(String msg) { + return msg; + } +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/SMSSender.java b/students/769232552/season_two/src/main/java/work02/ocp/SMSSender.java new file mode 100644 index 0000000000..9fa42a752f --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/SMSSender.java @@ -0,0 +1,8 @@ +package work02.ocp; + + +public class SMSSender implements Sender{ + public void send(String msg) { + SMSUtil.send(msg); + } +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/SMSUtil.java b/students/769232552/season_two/src/main/java/work02/ocp/SMSUtil.java new file mode 100644 index 0000000000..435e07300a --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/SMSUtil.java @@ -0,0 +1,10 @@ +package work02.ocp; + +public class SMSUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/769232552/season_two/src/main/java/work02/ocp/Sender.java b/students/769232552/season_two/src/main/java/work02/ocp/Sender.java new file mode 100644 index 0000000000..746ffdffb5 --- /dev/null +++ b/students/769232552/season_two/src/main/java/work02/ocp/Sender.java @@ -0,0 +1,8 @@ +package work02.ocp; + + +public interface Sender { + + void send(String msg); + +} \ No newline at end of file diff --git a/students/812350401/pom.xml b/students/812350401/pom.xml new file mode 100644 index 0000000000..8f2f890209 --- /dev/null +++ b/students/812350401/pom.xml @@ -0,0 +1,50 @@ + + 4.0.0 + + com.coderising + ood-assignment + 0.0.1-SNAPSHOT + jar + + ood-assignment + http://maven.apache.org + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + UTF-8 + + + + + + junit + junit + 4.12 + + + com.google.collections + google-collections + 1.0 + + + + + + aliyunmaven + http://maven.aliyun.com/nexus/content/groups/public/ + + + diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/CASSequence.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/CASSequence.java new file mode 100644 index 0000000000..144aa264ff --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/CASSequence.java @@ -0,0 +1,18 @@ +package com.coderising.myknowledgepoint.cas; + +import java.util.concurrent.atomic.AtomicInteger; + +public class CASSequence{ + + private AtomicInteger count = new AtomicInteger(0); + + public int next(){ + while(true){ + int current = count.get(); + int next = current +1; + if(count.compareAndSet(current, next)){ + return next; + } + } + } +} \ No newline at end of file diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/NoBlockingStack.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/NoBlockingStack.java new file mode 100644 index 0000000000..c03c096c78 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/NoBlockingStack.java @@ -0,0 +1,34 @@ +package com.coderising.myknowledgepoint.cas; + +import java.util.concurrent.atomic.AtomicReference; + +public class NoBlockingStack { + static class Node { + final E item; + Node next; + public Node(E item) { this.item = item; } + } + + AtomicReference> head = new AtomicReference>(); + + public void push(E item) { + Node newHead = new Node(item); + Node oldHead; + do { + oldHead = head.get(); + newHead.next = oldHead; + } while (!head.compareAndSet(oldHead, newHead)); + } + public E pop() { + Node oldHead; + Node newHead; + do { + oldHead = head.get(); + if (oldHead == null) + return null; + newHead = oldHead.next; + } while (!head.compareAndSet(oldHead,newHead)); + return oldHead.item; + } + +} diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/Sequence.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/Sequence.java new file mode 100644 index 0000000000..25909d0dd9 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/cas/Sequence.java @@ -0,0 +1,11 @@ +package com.coderising.myknowledgepoint.cas; + +public class Sequence{ + + private int value; + + public int next(){ + return value ++; + } + +} diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadlocal/Context.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadlocal/Context.java new file mode 100644 index 0000000000..a9b18ddaf4 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadlocal/Context.java @@ -0,0 +1,21 @@ +package com.coderising.myknowledgepoint.threadlocal; + +import java.util.HashMap; +import java.util.Map; + +public class Context { + + private static final ThreadLocal txThreadLocal + = new ThreadLocal(); + + public static void setTransactionID(String txID) { + txThreadLocal.set(txID); + + } + + public static String getTransactionId() { + return txThreadLocal.get(); + } + +} + diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadlocal/TransactionManager.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadlocal/TransactionManager.java new file mode 100644 index 0000000000..2cf9170578 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadlocal/TransactionManager.java @@ -0,0 +1,22 @@ +package com.coderising.myknowledgepoint.threadlocal; + +public class TransactionManager { + private static final ThreadLocal context = new ThreadLocal(); + + public static void startTransaction() { + // logic to start a transaction + // ... + String txID = null; + context.set(txID); + } + + public static String getTransactionId() { + return context.get(); + } + + public static void endTransaction() { + // logic to end a transaction + // … + context.remove(); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/BlockingQueue.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/BlockingQueue.java new file mode 100644 index 0000000000..d6e9ec5104 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/BlockingQueue.java @@ -0,0 +1,36 @@ +package com.coderising.myknowledgepoint.threadpool; + +import java.util.LinkedList; +import java.util.List; + +public class BlockingQueue { + + private List queue = new LinkedList(); + private int limit = 10; + + public BlockingQueue(int limit) { + this.limit = limit; + } + + public synchronized void enqueue(Object item) throws InterruptedException { + while (this.queue.size() == this.limit) { + wait(); + } + if (this.queue.size() == 0) { + notifyAll(); + } + this.queue.add(item); + } + + public synchronized Object dequeue() throws InterruptedException { + while (this.queue.size() == 0) { + wait(); + } + if (this.queue.size() == this.limit) { + notifyAll(); + } + + return this.queue.remove(0); + } + +} diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/DriveThreadPool.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/DriveThreadPool.java new file mode 100644 index 0000000000..015317af41 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/DriveThreadPool.java @@ -0,0 +1,25 @@ +package com.coderising.myknowledgepoint.threadpool; + +/** + * Created by thomas_young on 26/6/2017. + */ +public class DriveThreadPool { + + public static void main(String[] args) throws Exception { + Task task = ()-> { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + System.out.println("I'm killed!"); + } + System.out.println("haha"); + }; + + ThreadPool pool = new ThreadPool(5, 2); + for (int i=1; i<10; i++) { + pool.execute(task); + } + pool.stop(); + + } +} diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/Task.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/Task.java new file mode 100644 index 0000000000..418d672f78 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/Task.java @@ -0,0 +1,5 @@ +package com.coderising.myknowledgepoint.threadpool; + +public interface Task { + void execute(); +} diff --git a/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/ThreadPool.java b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/ThreadPool.java new file mode 100644 index 0000000000..96472822e2 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myknowledgepoint/threadpool/ThreadPool.java @@ -0,0 +1,48 @@ +package com.coderising.myknowledgepoint.threadpool; + +import java.util.ArrayList; +import java.util.List; + + +public class ThreadPool { + + private BlockingQueue taskQueue = null; + private List threads = new ArrayList<>(); + private boolean isStopped = false; + + /** + * 线程池实例化的时候,线程就都启动了 + * @param numOfThreads + * @param maxNumOfTasks + */ + public ThreadPool(int numOfThreads, int maxNumOfTasks){ + taskQueue = new BlockingQueue(maxNumOfTasks); + + for(int i=0; i configurations = new HashMap<>(); + static{ + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * @param key + * @return + */ + public String getProperty(String key) { + + return configurations.get(key); + } + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/ConfigurationKeys.java b/students/812350401/src/main/java/com/coderising/myood/srp/ConfigurationKeys.java new file mode 100644 index 0000000000..0ec546beee --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/ConfigurationKeys.java @@ -0,0 +1,9 @@ +package com.coderising.myood.srp; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/DBUtil.java b/students/812350401/src/main/java/com/coderising/myood/srp/DBUtil.java new file mode 100644 index 0000000000..bf0db8a811 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/DBUtil.java @@ -0,0 +1,25 @@ +package com.coderising.myood.srp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class DBUtil { + + /** + * 应该从数据库读, 但是简化为直接生成。 + * @param sql + * @return + */ + public static List query(String sql){ + + List userList = new ArrayList(); + for (int i = 1; i <= 3; i++) { + HashMap userInfo = new HashMap(); + userInfo.put("NAME", "User" + i); + userInfo.put("EMAIL", "aa@bb.com" + i); + userList.add(userInfo); + } + + return userList; + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/EmailParam.java b/students/812350401/src/main/java/com/coderising/myood/srp/EmailParam.java new file mode 100644 index 0000000000..71b5d30b40 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/EmailParam.java @@ -0,0 +1,49 @@ +package com.coderising.myood.srp; + + +/** + * Created by thomas_young on 20/6/2017. + */ +public class EmailParam { + private String smtpHost = null; + private String altSmtpHost = null; + private static Configuration config = new Configuration(); + private String fromAddress = null; + + protected void setFromAddress() + { + fromAddress = config.getProperty(ConfigurationKeys.EMAIL_ADMIN); + } + + private void loadEmailConfig() { + setFromAddress(); + setSMTPHost(); + setAltSMTPHost(); + } + + public EmailParam() { + loadEmailConfig(); + } + + public String getSmtpHost() { + return smtpHost; + } + + private void setSMTPHost() + { + smtpHost = config.getProperty(ConfigurationKeys.SMTP_SERVER); + } + + public String getAltSmtpHost() { + return altSmtpHost; + } + + public String getFromAddress() { + return fromAddress; + } + + private void setAltSMTPHost() + { + altSmtpHost = config.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/MailService.java b/students/812350401/src/main/java/com/coderising/myood/srp/MailService.java new file mode 100644 index 0000000000..ec5809ba74 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/MailService.java @@ -0,0 +1,116 @@ +package com.coderising.myood.srp; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by thomas_young on 20/6/2017. + */ +public class MailService { + private static final String NAME_KEY = "NAME"; + private static final String EMAIL_KEY = "EMAIL"; + private static String fromAddress; + private static EmailParam emailParam; + + static { + emailParam = new EmailParam(); + fromAddress = emailParam.getFromAddress(); + } + + public void sendMails(boolean debug) throws Exception { + ProductInfo productInfo = new ProductInfo(); + UserDao userDao = new UserDao(); + List userInfos = userDao.loadMailingList(productInfo.getProductID()); + List mailInfos = convertToMails(userInfos, productInfo); + System.out.println("开始发送邮件"); + for (MailInfo mail: mailInfos) { + sendOneMail(mail, debug); + } + + } + + private void sendOneMail(MailInfo mail, boolean debug) { + try { + MailUtil.sendEmail( + mail.getToAddress(), + fromAddress, + mail.getSubject(), + mail.getMessage(), + emailParam.getSmtpHost(), debug); + } catch (Exception e) { + + try { + MailUtil.sendEmail(mail.getToAddress(), + fromAddress, + mail.getSubject(), + mail.getMessage(), + emailParam.getAltSmtpHost(), + debug); + } catch (Exception e2) + { + System.out.println("通过备用 SMTP服务器发送邮件失败: " + e2.getMessage()); + } + } + } + + public static class MailInfo { + + public String getFromAddress() { + return fromAddress; + } + + public String getToAddress() { + return toAddress; + } + + public String getSubject() { + return subject; + } + + public String getMessage() { + return message; + } + + private String fromAddress = null; + private String toAddress = null; + private String subject = null; + private String message = null; + + + public MailInfo(String fromAddress, String toAddress, String subject, String message) { + this.fromAddress = fromAddress; + this.toAddress = toAddress; + this.subject = subject; + this.message = message; + } + } + + private List convertToMails(List userInfos, ProductInfo productInfo) throws IOException { + List mailInfos = new LinkedList<>(); + if (userInfos != null) { + Iterator iter = userInfos.iterator(); + while (iter.hasNext()) { + MailInfo mailInfo = configureEMail((HashMap) iter.next(), productInfo); + if (mailInfo != null) { + mailInfos.add(mailInfo); + } + } + } + return mailInfos; + } + + private MailInfo configureEMail(HashMap userInfo, ProductInfo productInfo) throws IOException + { + String toAddress = (String) userInfo.get(EMAIL_KEY); + if (toAddress.length() > 0) { + String name = (String) userInfo.get(NAME_KEY); + String subject = "您关注的产品降价了"; + String message = "尊敬的 "+name+", 您关注的产品 " + productInfo.getProductDesc() + " 降价了,欢迎购买!" ; + return new MailInfo(fromAddress, toAddress, subject, message); + } + return null; + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/MailUtil.java b/students/812350401/src/main/java/com/coderising/myood/srp/MailUtil.java new file mode 100644 index 0000000000..25a0f64583 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/MailUtil.java @@ -0,0 +1,18 @@ +package com.coderising.myood.srp; + + +public class MailUtil { + + public static void sendEmail(String toAddress, String fromAddress, String subject, String message, String smtpHost, + boolean debug) { + //假装发了一封邮件 + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(toAddress).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(message).append("\n"); + System.out.println(buffer.toString()); + } + + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/ProductInfo.java b/students/812350401/src/main/java/com/coderising/myood/srp/ProductInfo.java new file mode 100644 index 0000000000..1cca0338ec --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/ProductInfo.java @@ -0,0 +1,65 @@ +package com.coderising.myood.srp; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +/** + * Created by thomas_young on 20/6/2017. + */ +public class ProductInfo { + private String productID = null; + private String productDesc = null; + + private static File f = new File("/Users/thomas_young/Documents/code/liuxintraining/coding2017/students/812350401/src/main/java/com/coderising/myood/srp/product_promotion.txt"); + + public ProductInfo() { + try { + readFileSetProperty(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 读取配置文件, 文件中只有一行用空格隔开, 例如 P8756 iPhone8 + * @throws IOException + */ + private void readFileSetProperty() throws IOException + { + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(f)); + String temp = br.readLine(); + String[] data = temp.split(" "); + + setProductID(data[0]); + setProductDesc(data[1]); + + System.out.println("产品ID = " + productID + "\n"); + System.out.println("产品描述 = " + productDesc + "\n"); + + } catch (IOException e) { + throw new IOException(e.getMessage()); + } finally { + br.close(); + } + } + + public String getProductID() { + return productID; + } + + public void setProductID(String productID) { + this.productID = productID; + } + + public String getProductDesc() { + return productDesc; + } + + public void setProductDesc(String productDesc) { + this.productDesc = productDesc; + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/PromotionMail.java b/students/812350401/src/main/java/com/coderising/myood/srp/PromotionMail.java new file mode 100644 index 0000000000..b6ecd6fc41 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/PromotionMail.java @@ -0,0 +1,8 @@ +package com.coderising.myood.srp; + +public class PromotionMail { + public static void main(String[] args) throws Exception { + MailService mailService = new MailService(); + mailService.sendMails(true); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/UserDao.java b/students/812350401/src/main/java/com/coderising/myood/srp/UserDao.java new file mode 100644 index 0000000000..d5f421a952 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/UserDao.java @@ -0,0 +1,26 @@ +package com.coderising.myood.srp; + +import java.util.List; + +/** + * Created by thomas_young on 21/6/2017. + */ +public class UserDao { + private String sendMailQuery = null; + + private void setLoadQuery(String productID) throws Exception { + + sendMailQuery = "Select name from subscriptions " + + "where product_id= '" + productID +"' " + + "and send_mail=1 "; + + + System.out.println("loadQuery set"); + } + + public List loadMailingList(String productID) throws Exception { + setLoadQuery(productID); + return DBUtil.query(this.sendMailQuery); + } + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Configuration.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Configuration.java new file mode 100644 index 0000000000..b187686fc0 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Configuration.java @@ -0,0 +1,26 @@ +package com.coderising.myood.srp.goodSrp; + +import com.coderising.myood.srp.ConfigurationKeys; + +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + static Map configurations = new HashMap<>(); + static{ + configurations.put(com.coderising.myood.srp.ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(com.coderising.myood.srp.ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * @param key + * @return + */ + public String getProperty(String key) { + + return configurations.get(key); + } + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/ConfigurationKeys.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/ConfigurationKeys.java new file mode 100644 index 0000000000..c69fa86cbf --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/ConfigurationKeys.java @@ -0,0 +1,9 @@ +package com.coderising.myood.srp.goodSrp; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/DBUtil.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/DBUtil.java new file mode 100644 index 0000000000..4d8403d525 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/DBUtil.java @@ -0,0 +1,25 @@ +package com.coderising.myood.srp.goodSrp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class DBUtil { + + /** + * 应该从数据库读, 但是简化为直接生成。 + * @param sql + * @return + */ + public static List query(String sql){ + + List userList = new ArrayList(); + for (int i = 1; i <= 3; i++) { + HashMap userInfo = new HashMap(); + userInfo.put("NAME", "User" + i); + userInfo.put("EMAIL", "aa@bb.com" + i); + userList.add(userInfo); + } + + return userList; + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Mail.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Mail.java new file mode 100644 index 0000000000..04472df8bc --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Mail.java @@ -0,0 +1,32 @@ +package com.coderising.myood.srp.goodSrp; + +import com.coderising.myood.srp.goodSrp.template.MailBodyTemplate; +import com.coderising.myood.srp.goodSrp.template.TextMailBodyTemplate; + +import java.util.List; +import java.util.stream.Collectors; + +public class Mail { + + private User user; + MailBodyTemplate mailBodyTemplate; + public Mail(User u){ + this.user = u; + } + public String getAddress(){ + return user.getEMailAddress(); + } + public String getSubject(){ + return "您关注的产品降价了"; + } + public String getBody(){ + mailBodyTemplate = new TextMailBodyTemplate(user.getName(), buildProductDescList(), getAddress()); + return mailBodyTemplate.render(); + } + private String buildProductDescList() { + List products = user.getSubscribedProducts(); + //.... 实现略... + return products.stream().map(Object::toString) + .collect(Collectors.joining(", ")); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/MailSender.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/MailSender.java new file mode 100644 index 0000000000..70d2595e47 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/MailSender.java @@ -0,0 +1,35 @@ +package com.coderising.myood.srp.goodSrp; + +/** + * Created by thomas_young on 24/6/2017. + */ +public class MailSender { + private String fromAddress ; + private String smtpHost; + private String altSmtpHost; + + public MailSender(Configuration config){ + this.fromAddress = config.getProperty(ConfigurationKeys.EMAIL_ADMIN); + this.smtpHost = config.getProperty(ConfigurationKeys.SMTP_SERVER); + this.altSmtpHost = config.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + } + + public void sendMail(Mail mail){ + try{ + sendEmail(mail, this.smtpHost); + }catch(Exception e){ + try{ + sendEmail(mail, this.altSmtpHost); + }catch (Exception ex){ + System.out.println("通过备用 SMTP服务器发送邮件失败: " + ex.getMessage()); + } + + } + } + + private void sendEmail(Mail mail, String smtpHost){ + //发送邮件 + System.out.println("开始发送邮件"); + MailUtil.sendEmail(mail, smtpHost, fromAddress); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/MailUtil.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/MailUtil.java new file mode 100644 index 0000000000..77a26d8318 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/MailUtil.java @@ -0,0 +1,16 @@ +package com.coderising.myood.srp.goodSrp; + +public class MailUtil { + + public static void sendEmail(Mail mail, String smtpHost, String fromAddress) { + //假装发了一封邮件 + System.out.println("使用smtpHost为"+smtpHost); + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(mail.getAddress()).append("\n"); + buffer.append("Subject:").append(mail.getSubject()).append("\n"); + buffer.append("Content:").append(mail.getBody()).append("\n"); + + System.out.println(buffer.toString()); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Product.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Product.java new file mode 100644 index 0000000000..9373690bd7 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/Product.java @@ -0,0 +1,34 @@ +package com.coderising.myood.srp.goodSrp; + + + +public class Product { + + private String id; + private String desc; + public String getDescription(){ + return desc; + } + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + @Override + public String toString() { + return desc; + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/ProductService.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/ProductService.java new file mode 100644 index 0000000000..26853bc4d3 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/ProductService.java @@ -0,0 +1,38 @@ +package com.coderising.myood.srp.goodSrp; + + +import java.io.*; +import java.util.LinkedList; +import java.util.List; + +public class ProductService { + private static File f = new File("/Users/thomas_young/Documents/code/liuxintraining/coding2017/students/812350401/src/main/java/com/coderising/myood/srp/product_promotion.txt"); + public List getPromotionProducts() { + //从文本文件中读取文件列表 + String line; + List products = new LinkedList<>(); + try (BufferedReader br = new BufferedReader(new FileReader(f))) { + while ((line = br.readLine()) != null) { + Product p =parseGenProduct(line); + products.add(p); + } + } catch (IOException e) { + e.printStackTrace(); + } + return products; + } + + private Product parseGenProduct(String line) { + String[] data = line.split(" "); + String productID = data[0]; + String productDesc = data[1]; + System.out.println("产品ID = " + productID); + System.out.println("产品描述 = " + productDesc + "\n"); + Product p = new Product(); + p.setDesc(productDesc); + p.setId(productID); + return p; + } + + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/PromotionJob.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/PromotionJob.java new file mode 100644 index 0000000000..5b3ce7a1de --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/PromotionJob.java @@ -0,0 +1,29 @@ +package com.coderising.myood.srp.goodSrp; + +import java.util.List; + +public class PromotionJob { + + private ProductService productService = new ProductService() ; //获取production service + private UserService userService = new UserService() ;// 获取UserService + + public void run(){ + + Configuration cfg = new Configuration(); + + List ps = productService.getPromotionProducts(); + + List users = userService.getUsers(ps); + + + MailSender mailSender = new MailSender(cfg); + + for(User user : users){ + mailSender.sendMail(new Mail(user)); + } + } + + public static void main(String[] args) { + new PromotionJob().run(); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/User.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/User.java new file mode 100644 index 0000000000..65383587d1 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/User.java @@ -0,0 +1,39 @@ +package com.coderising.myood.srp.goodSrp; + +import java.util.List; + +/** + * Created by thomas_young on 24/6/2017. + */ +public class User { + private String name; + private String emailAddress; + + private List subscribedProducts; + + public String getName(){ + return name; + } + public String getEMailAddress() { + return emailAddress; + } + public List getSubscribedProducts(){ + return this.subscribedProducts; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public void setSubscribedProducts(List subscribedProducts) { + this.subscribedProducts = subscribedProducts; + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/UserService.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/UserService.java new file mode 100644 index 0000000000..152d253ae3 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/UserService.java @@ -0,0 +1,26 @@ +package com.coderising.myood.srp.goodSrp; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * Created by thomas_young on 24/6/2017. + */ +public class UserService { + + public List getUsers(List ps) { + List users = new LinkedList<>(); + String sql = "Select name from subscriptions where send_mail=1"; + System.out.println("loadQuery set\n"); + List userInfoList = DBUtil.query(sql); + for (Object userInfo: userInfoList) { + User user = new User(); + user.setName(((Map)userInfo).get("NAME")); + user.setEmailAddress(((Map)userInfo).get("EMAIL")); + user.setSubscribedProducts(ps); + users.add(user); + } + return users; + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/template/MailBodyTemplate.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/template/MailBodyTemplate.java new file mode 100644 index 0000000000..2ff179ac7c --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/template/MailBodyTemplate.java @@ -0,0 +1,5 @@ +package com.coderising.myood.srp.goodSrp.template; + +public interface MailBodyTemplate { + String render(); +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/template/TextMailBodyTemplate.java b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/template/TextMailBodyTemplate.java new file mode 100644 index 0000000000..b43561a04d --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/goodSrp/template/TextMailBodyTemplate.java @@ -0,0 +1,20 @@ +package com.coderising.myood.srp.goodSrp.template; + + +public class TextMailBodyTemplate implements MailBodyTemplate { + String productDescription; + String name; + String toAdress; + public TextMailBodyTemplate(String name, String productDescription, String toAdress){ + this.productDescription = productDescription; + this.name = name; + this.toAdress = toAdress; + } + + @Override + public String render() { + //使用某种模板技术实现Render + return "尊敬的 "+ name +", 您关注的产品 " + productDescription + " 降价了,欢迎购买!" ; + } + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/srp/product_promotion.txt b/students/812350401/src/main/java/com/coderising/myood/srp/product_promotion.txt new file mode 100644 index 0000000000..0c0124cc61 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file diff --git a/students/812350401/src/main/java/com/coderising/myood/uml/Dice.java b/students/812350401/src/main/java/com/coderising/myood/uml/Dice.java new file mode 100644 index 0000000000..a48f7114ee --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/uml/Dice.java @@ -0,0 +1,17 @@ +package com.coderising.myood.uml; + +import com.google.common.collect.ImmutableList; + +import java.util.Random; + +/** + * Created by thomas_young on 27/6/2017. + */ +public class Dice { + + private ImmutableList values = ImmutableList.of(1, 2, 3, 4, 5, 6); + + public int roll() { + return values.get(new Random().nextInt(values.size())); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/uml/DiceGame.java b/students/812350401/src/main/java/com/coderising/myood/uml/DiceGame.java new file mode 100644 index 0000000000..386550fd67 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/uml/DiceGame.java @@ -0,0 +1,44 @@ +package com.coderising.myood.uml; + +/** + * Created by thomas_young on 27/6/2017. + */ +public class DiceGame { + private Player player1, player2; + private Dice dice1, dice2; + private static int WIN_POINT = 7; + + public void start() { + assert player1 != null; + assert player2 != null; + assert dice1 != null; + assert dice2 != null; + int player1Point; + int player2Point; + do { + player1Point = player1.roll(dice1, dice2); + player2Point = player2.roll(dice1, dice2); + System.out.print(player1 + " roll " + player1Point + ", "); + System.out.println(player2 + " roll " + player2Point + "."); + if (player1Point == player2Point) { + continue; + } + if (player1Point == WIN_POINT) { + System.out.println(player1 + " win!"); + break; + } + if (player2Point == WIN_POINT) { + System.out.println(player2 + " win!"); + break; + } + } while (true); + } + + public DiceGame(Player aPlayer1, Player aPlayer2, Dice aDice1, Dice aDice2) { + player1 = aPlayer1; + player2 = aPlayer2; + dice1 = aDice1; + dice2 = aDice2; + } + +} diff --git a/students/812350401/src/main/java/com/coderising/myood/uml/GameTest.java b/students/812350401/src/main/java/com/coderising/myood/uml/GameTest.java new file mode 100644 index 0000000000..ee36709326 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/uml/GameTest.java @@ -0,0 +1,15 @@ +package com.coderising.myood.uml; + +/** + * Created by thomas_young on 27/6/2017. + */ +public class GameTest { + public static void main(String[] args) { + Player player1 = new Player("player1"); + Player player2 = new Player("player2"); + Dice dice1 = new Dice(); + Dice dice2 = new Dice(); + DiceGame game = new DiceGame(player1, player2, dice1, dice2); + game.start(); + } +} diff --git a/students/812350401/src/main/java/com/coderising/myood/uml/Player.java b/students/812350401/src/main/java/com/coderising/myood/uml/Player.java new file mode 100644 index 0000000000..2add582970 --- /dev/null +++ b/students/812350401/src/main/java/com/coderising/myood/uml/Player.java @@ -0,0 +1,23 @@ +package com.coderising.myood.uml; + +/** + * Created by thomas_young on 27/6/2017. + */ +public class Player { + private String name; + + public Player(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + public int roll(Dice dice1, Dice dice2) { + int first = dice1.roll(); + int second = dice2.roll(); + return first + second; + } +} diff --git "a/students/812350401/src/main/java/com/coderising/myood/uml/\346\212\225\351\252\260\345\255\220\346\227\266\345\272\217\345\233\276.png" "b/students/812350401/src/main/java/com/coderising/myood/uml/\346\212\225\351\252\260\345\255\220\346\227\266\345\272\217\345\233\276.png" new file mode 100644 index 0000000000..578894269d Binary files /dev/null and "b/students/812350401/src/main/java/com/coderising/myood/uml/\346\212\225\351\252\260\345\255\220\346\227\266\345\272\217\345\233\276.png" differ diff --git "a/students/812350401/src/main/java/com/coderising/myood/uml/\346\212\225\351\252\260\345\255\220\347\261\273\345\233\276.png" "b/students/812350401/src/main/java/com/coderising/myood/uml/\346\212\225\351\252\260\345\255\220\347\261\273\345\233\276.png" new file mode 100644 index 0000000000..587726bd61 Binary files /dev/null and "b/students/812350401/src/main/java/com/coderising/myood/uml/\346\212\225\351\252\260\345\255\220\347\261\273\345\233\276.png" differ diff --git "a/students/812350401/src/main/java/com/coderising/myood/uml/\350\264\255\347\211\251\347\275\221\347\253\231\347\224\250\344\276\213\345\233\276.png" "b/students/812350401/src/main/java/com/coderising/myood/uml/\350\264\255\347\211\251\347\275\221\347\253\231\347\224\250\344\276\213\345\233\276.png" new file mode 100644 index 0000000000..46addc0408 Binary files /dev/null and "b/students/812350401/src/main/java/com/coderising/myood/uml/\350\264\255\347\211\251\347\275\221\347\253\231\347\224\250\344\276\213\345\233\276.png" differ diff --git a/students/919442958/README.md b/students/919442958/README.md new file mode 100644 index 0000000000..d96760c4ae --- /dev/null +++ b/students/919442958/README.md @@ -0,0 +1 @@ +这是919442958的作业。1234 12 \ No newline at end of file diff --git a/students/996108220/src/com/coderising/ood/ocp/DateUtil.java b/students/996108220/src/com/coderising/ood/ocp/DateUtil.java new file mode 100644 index 0000000000..13369f5684 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/DateUtil.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +public class DateUtil { + + + public static String getCurrentDateAsString() { + + return null; + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/EmailLog.java b/students/996108220/src/com/coderising/ood/ocp/EmailLog.java new file mode 100644 index 0000000000..20eb93ac9d --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/EmailLog.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +public class EmailLog implements LogMethod{ + int method = 1; + @Override + public void logBehavior(String logMsg) { + + MailUtil.send(logMsg); + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/LogMethod.java b/students/996108220/src/com/coderising/ood/ocp/LogMethod.java new file mode 100644 index 0000000000..69677d8c89 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/LogMethod.java @@ -0,0 +1,6 @@ +package com.coderising.ood.ocp; + +public interface LogMethod { + int method = 0; + public abstract void logBehavior(String logMsg); +} diff --git a/students/996108220/src/com/coderising/ood/ocp/LogType.java b/students/996108220/src/com/coderising/ood/ocp/LogType.java new file mode 100644 index 0000000000..bd6de81087 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/LogType.java @@ -0,0 +1,6 @@ +package com.coderising.ood.ocp; + +public interface LogType { + int type = 0; + public abstract String getLogMsg(String msg) ; +} diff --git a/students/996108220/src/com/coderising/ood/ocp/Logger.java b/students/996108220/src/com/coderising/ood/ocp/Logger.java new file mode 100644 index 0000000000..e0105f9b23 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/Logger.java @@ -0,0 +1,19 @@ +package com.coderising.ood.ocp; + +public class Logger { + + public LogType logType; + public LogMethod logMethod; + + public Logger(LogType logType, LogMethod logMethod){ + this.logType = logType; + this.logMethod = logMethod; + } + public void log(String msg){ + + String logMsg = logType.getLogMsg(msg); + logMethod.logBehavior(logMsg); + + } +} + diff --git a/students/996108220/src/com/coderising/ood/ocp/MailUtil.java b/students/996108220/src/com/coderising/ood/ocp/MailUtil.java new file mode 100644 index 0000000000..59d77649a2 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/MailUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class MailUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/PrintLog.java b/students/996108220/src/com/coderising/ood/ocp/PrintLog.java new file mode 100644 index 0000000000..b2391ecd52 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/PrintLog.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp; + +public class PrintLog implements LogMethod{ + int method = 3; + @Override + public void logBehavior(String logMsg) { + System.out.println(logMsg); + + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/RawLog.java b/students/996108220/src/com/coderising/ood/ocp/RawLog.java new file mode 100644 index 0000000000..0ac45244c8 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/RawLog.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class RawLog implements LogType{ + int type = 1; + @Override + public String getLogMsg(String msg) { + return msg; + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/RawLogWithData.java b/students/996108220/src/com/coderising/ood/ocp/RawLogWithData.java new file mode 100644 index 0000000000..280fb3b54f --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/RawLogWithData.java @@ -0,0 +1,12 @@ +package com.coderising.ood.ocp; + +public class RawLogWithData implements LogType{ + int type = 2; + @Override + public String getLogMsg(String msg) { + String txtDate = DateUtil.getCurrentDateAsString(); + String logMsg = txtDate + ": " + msg; + return logMsg; + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/SMSUtil.java b/students/996108220/src/com/coderising/ood/ocp/SMSUtil.java new file mode 100644 index 0000000000..fab4cd01b7 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/SMSUtil.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class SMSUtil { + + public static void send(String logMsg) { + // TODO Auto-generated method stub + + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/SmsLog.java b/students/996108220/src/com/coderising/ood/ocp/SmsLog.java new file mode 100644 index 0000000000..e61938d844 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/SmsLog.java @@ -0,0 +1,10 @@ +package com.coderising.ood.ocp; + +public class SmsLog implements LogMethod{ + int method = 2; + @Override + public void logBehavior(String logMsg) { + SMSUtil.send(logMsg); + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/good/Formatter.java b/students/996108220/src/com/coderising/ood/ocp/good/Formatter.java new file mode 100644 index 0000000000..b6e2ccbc16 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/good/Formatter.java @@ -0,0 +1,7 @@ +package com.coderising.ood.ocp.good; + +public interface Formatter { + + String format(String msg); + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/good/FormatterFactory.java b/students/996108220/src/com/coderising/ood/ocp/good/FormatterFactory.java new file mode 100644 index 0000000000..3c2009a674 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/good/FormatterFactory.java @@ -0,0 +1,13 @@ +package com.coderising.ood.ocp.good; + +public class FormatterFactory { + public static Formatter createFormatter(int type){ + if(type == 1){ + return new RawFormatter(); + } + if (type == 2){ + return new HtmlFormatter(); + } + return null; + } +} diff --git a/students/996108220/src/com/coderising/ood/ocp/good/HtmlFormatter.java b/students/996108220/src/com/coderising/ood/ocp/good/HtmlFormatter.java new file mode 100644 index 0000000000..3d375f5acc --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/good/HtmlFormatter.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.good; + +public class HtmlFormatter implements Formatter { + + @Override + public String format(String msg) { + + return null; + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/good/Logger.java b/students/996108220/src/com/coderising/ood/ocp/good/Logger.java new file mode 100644 index 0000000000..f206472d0d --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/good/Logger.java @@ -0,0 +1,18 @@ +package com.coderising.ood.ocp.good; + +public class Logger { + + private Formatter formatter; + private Sender sender; + + public Logger(Formatter formatter,Sender sender){ + this.formatter = formatter; + this.sender = sender; + } + public void log(String msg){ + sender.send(formatter.format(msg)) ; + } + + +} + diff --git a/students/996108220/src/com/coderising/ood/ocp/good/RawFormatter.java b/students/996108220/src/com/coderising/ood/ocp/good/RawFormatter.java new file mode 100644 index 0000000000..7f1cb4ae30 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/good/RawFormatter.java @@ -0,0 +1,11 @@ +package com.coderising.ood.ocp.good; + +public class RawFormatter implements Formatter { + + @Override + public String format(String msg) { + + return null; + } + +} diff --git a/students/996108220/src/com/coderising/ood/ocp/good/Sender.java b/students/996108220/src/com/coderising/ood/ocp/good/Sender.java new file mode 100644 index 0000000000..aaa46c1fb7 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/ocp/good/Sender.java @@ -0,0 +1,7 @@ +package com.coderising.ood.ocp.good; + +public interface Sender { + + void send(String msg); + +} diff --git a/students/996108220/src/com/coderising/ood/srp/Configuration.java b/students/996108220/src/com/coderising/ood/srp/Configuration.java new file mode 100644 index 0000000000..f328c1816a --- /dev/null +++ b/students/996108220/src/com/coderising/ood/srp/Configuration.java @@ -0,0 +1,23 @@ +package com.coderising.ood.srp; +import java.util.HashMap; +import java.util.Map; + +public class Configuration { + + static Map configurations = new HashMap<>(); + static{ + configurations.put(ConfigurationKeys.SMTP_SERVER, "smtp.163.com"); + configurations.put(ConfigurationKeys.ALT_SMTP_SERVER, "smtp1.163.com"); + configurations.put(ConfigurationKeys.EMAIL_ADMIN, "admin@company.com"); + } + /** + * 应该从配置文件读, 但是这里简化为直接从一个map 中去读 + * @param key + * @return + */ + public String getProperty(String key) { + + return configurations.get(key); + } + +} diff --git a/students/996108220/src/com/coderising/ood/srp/ConfigurationKeys.java b/students/996108220/src/com/coderising/ood/srp/ConfigurationKeys.java new file mode 100644 index 0000000000..8695aed644 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/srp/ConfigurationKeys.java @@ -0,0 +1,9 @@ +package com.coderising.ood.srp; + +public class ConfigurationKeys { + + public static final String SMTP_SERVER = "smtp.server"; + public static final String ALT_SMTP_SERVER = "alt.smtp.server"; + public static final String EMAIL_ADMIN = "email.admin"; + +} diff --git a/students/996108220/src/com/coderising/ood/srp/DBUtil.java b/students/996108220/src/com/coderising/ood/srp/DBUtil.java new file mode 100644 index 0000000000..683ce1712e --- /dev/null +++ b/students/996108220/src/com/coderising/ood/srp/DBUtil.java @@ -0,0 +1,38 @@ +package com.coderising.ood.srp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class DBUtil { + static ProductUtil productUtil=new ProductUtil(); + /** + * 应该从数据库读, 但是简化为直接生成。 + * @param sql + * @return + */ + public static List query(String sql){ + + List userList = new ArrayList(); + for (int i = 1; i <= 3; i++) { + HashMap userInfo = new HashMap(); + userInfo.put("NAME", "User" + i); + userInfo.put("EMAIL", "aa@bb.com"); + userList.add(userInfo); + } + + return userList; + } + protected static List loadMailingList() throws Exception { + + String sendMailQuery = LoadQuery(); + return DBUtil.query(sendMailQuery); + } + protected static String LoadQuery() throws Exception { + String productID = productUtil.getProductID(); + System.out.println("loadQuery set"); + return "Select name from subscriptions " + + "where product_id= '" + productID +"' " + + "and send_mail=1 "; + + } +} diff --git a/students/996108220/src/com/coderising/ood/srp/MailUtil.java b/students/996108220/src/com/coderising/ood/srp/MailUtil.java new file mode 100644 index 0000000000..38ad395d83 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/srp/MailUtil.java @@ -0,0 +1,74 @@ +package com.coderising.ood.srp; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class MailUtil { + + private static Configuration config=new Configuration(); ; + private static ProductUtil productUtil = new ProductUtil(); + private static final String NAME_KEY = "NAME"; + private static final String EMAIL_KEY = "EMAIL"; + + protected static void sendEmail(String userName,String toAddress,String smtpHost,Boolean debug) throws IOException + { + String subject = "您关注的产品降价了"; + String message = "尊敬的 "+userName+", 您关注的产品 " + productUtil.getProductDesc() + " 降价了,欢迎购买!" ; + String fromAddress=config.getProperty(ConfigurationKeys.EMAIL_ADMIN); + StringBuilder buffer = new StringBuilder(); + buffer.append("From:").append(fromAddress).append("\n"); + buffer.append("To:").append(toAddress).append("\n"); + buffer.append("Subject:").append(subject).append("\n"); + buffer.append("Content:").append(message).append("\n"); + System.out.println(buffer); + } + + + + private static void sendEmail(String userName,String toAddress,Boolean debug) { + try + { + String smtpHost=config.getProperty(ConfigurationKeys.SMTP_SERVER); + sendEmail( userName,toAddress,smtpHost, debug); + } + catch (Exception e) + { + + try { + String altSmtpHost=config.getProperty(ConfigurationKeys.ALT_SMTP_SERVER); + sendEmail( userName,toAddress,altSmtpHost, debug); + + } catch (Exception e2) + { + System.out.println("通过备用 SMTP服务器发送邮件失败: " + e2.getMessage()); + } + } + } + + protected static void sendEMails(boolean debug,List mailingList) throws IOException + { + + System.out.println("开始发送邮件"); + + + if (mailingList != null) { + Iterator iter = mailingList.iterator(); + while (iter.hasNext()) { + HashMap userInfo = (HashMap)iter.next(); + String userName = userInfo.get(NAME_KEY); + String toAddress = userInfo.get(EMAIL_KEY); + sendEmail( userName, toAddress, debug); + } + } + + else { + System.out.println("没有邮件发送"); + } + + } + + +} diff --git a/students/996108220/src/com/coderising/ood/srp/ProductUtil.java b/students/996108220/src/com/coderising/ood/srp/ProductUtil.java new file mode 100644 index 0000000000..be40fd203c --- /dev/null +++ b/students/996108220/src/com/coderising/ood/srp/ProductUtil.java @@ -0,0 +1,39 @@ +package com.coderising.ood.srp; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +public class ProductUtil { + private String productConfigPath="D:\\JavaCoding\\students\\996108220\\src" + + "\\com\\coderising\\ood\\srp\\product_promotion.txt"; + + private String[] readFile() throws IOException // @02C + { + File file=new File(productConfigPath); + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(file)); + String temp = br.readLine(); + String[] data = temp.split(" ");; + return data; + + } catch (IOException e) { + throw new IOException(e.getMessage()); + } finally { + br.close(); + } + } + + public String getProductID() throws IOException { + String[] data= readFile(); + return data[0]; + } + + public String getProductDesc() throws IOException { + String[] data= readFile(); + return data[1]; + } + +} diff --git a/students/996108220/src/com/coderising/ood/srp/PromotionMail.java b/students/996108220/src/com/coderising/ood/srp/PromotionMail.java new file mode 100644 index 0000000000..2795a54b2a --- /dev/null +++ b/students/996108220/src/com/coderising/ood/srp/PromotionMail.java @@ -0,0 +1,49 @@ + package com.coderising.ood.srp; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class PromotionMail { + + //读取用户信息 + + private static final String NAME_KEY = "NAME"; + private static final String EMAIL_KEY = "EMAIL"; + + + public static void main(String[] args) throws Exception { + + boolean emailDebug = false; + PromotionMail pe = new PromotionMail(); + List userInfo = DBUtil.loadMailingList(); + List mailingList = pe.filterUserInfo(userInfo); + MailUtil.sendEMails(emailDebug, mailingList); + } + + + + + protected List filterUserInfo(List userList) throws IOException + { + + if (userList != null) { + Iterator iter = userList.iterator(); + while (iter.hasNext()) { + HashMap userInfo = (HashMap)iter.next(); + String userName = userInfo.get(NAME_KEY); + String toAddress = userInfo.get(EMAIL_KEY); + if (toAddress.length() <= 0) + userInfo.remove(userInfo); + } + } + return userList; + + } + + + + +} diff --git a/students/996108220/src/com/coderising/ood/srp/product_promotion.txt b/students/996108220/src/com/coderising/ood/srp/product_promotion.txt new file mode 100644 index 0000000000..0c0124cc61 --- /dev/null +++ b/students/996108220/src/com/coderising/ood/srp/product_promotion.txt @@ -0,0 +1,4 @@ +P8756 iPhone8 +P3946 XiaoMi10 +P8904 Oppo_R15 +P4955 Vivo_X20 \ No newline at end of file