(LoadContext context, CDOMObject obj)
| 134 | } |
| 135 | |
| 136 | @Override |
| 137 | public String[] unparse(LoadContext context, CDOMObject obj) |
| 138 | { |
| 139 | Changes<PersistentTransitionChoice<?>> grantChanges = |
| 140 | context.getObjectContext().getListChanges(obj, ListKey.ADD); |
| 141 | Collection<PersistentTransitionChoice<?>> addedItems = grantChanges.getAdded(); |
| 142 | if (addedItems == null || addedItems.isEmpty()) |
| 143 | { |
| 144 | // Zero indicates no Token |
| 145 | return null; |
| 146 | } |
| 147 | List<String> addStrings = new ArrayList<>(); |
| 148 | for (TransitionChoice<?> container : addedItems) |
| 149 | { |
| 150 | SelectableSet<?> cs = container.getChoices(); |
| 151 | if (cs.getName().equals(getTokenName()) && LANGUAGE_CLASS.equals(cs.getChoiceClass())) |
| 152 | { |
| 153 | Formula f = container.getCount(); |
| 154 | if (f == null) |
| 155 | { |
| 156 | context.addWriteMessage("Unable to find " + getFullName() + " Count"); |
| 157 | return null; |
| 158 | } |
| 159 | if (f.isStatic() && f.resolveStatic().doubleValue() <= 0) |
| 160 | { |
| 161 | context.addWriteMessage("Count in " + getFullName() + " must be > 0"); |
| 162 | return null; |
| 163 | } |
| 164 | if (!cs.getGroupingState().isValid()) |
| 165 | { |
| 166 | context.addWriteMessage("Non-sensical " + getFullName() |
| 167 | + ": Contains ANY and a specific reference: " + cs.getLSTformat()); |
| 168 | return null; |
| 169 | } |
| 170 | StringBuilder sb = new StringBuilder(); |
| 171 | if (!FormulaFactory.ONE.equals(f)) |
| 172 | { |
| 173 | sb.append(f).append(Constants.PIPE); |
| 174 | } |
| 175 | sb.append(cs.getLSTformat()); |
| 176 | addStrings.add(sb.toString()); |
| 177 | |
| 178 | // assoc.getAssociation(AssociationKey.CHOICE_MAXCOUNT); |
| 179 | } |
| 180 | } |
| 181 | return addStrings.toArray(new String[0]); |
| 182 | } |
| 183 | |
| 184 | @Override |
| 185 | public Class<CDOMObject> getTokenClass() |
nothing calls this directly
no test coverage detected