Exemplo n.º 1
0
 public String generateNumberForTechnologyInOrder(final Entity order, final Entity technology) {
   StringBuffer number = new StringBuffer();
   if (technology == null) {
     number.append(
         numberGeneratorService.generateNumber(
             TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGY));
   } else {
     number.append(technology.getStringField(TechnologyFields.NUMBER));
   }
   number.append(" - ");
   number.append(order.getStringField(OrderFields.NUMBER));
   return number.toString();
 }
Exemplo n.º 2
0
 public Entity createDocument(
     UserService userService, NumberGeneratorService numberGeneratorService) {
   DataDefinition documentDD =
       dataDefinitionService.get(
           MaterialFlowResourcesConstants.PLUGIN_IDENTIFIER,
           MaterialFlowResourcesConstants.MODEL_DOCUMENT);
   Entity document = documentDD.create();
   document.setField(DocumentFields.TIME, new Date());
   document.setField(DocumentFields.USER, userService.getCurrentUserEntity().getId());
   document.setField(DocumentFields.STATE, DocumentState.DRAFT.getStringValue());
   document.setField(
       DocumentFields.NUMBER,
       numberGeneratorService.generateNumber(
           MaterialFlowResourcesConstants.PLUGIN_IDENTIFIER,
           MaterialFlowResourcesConstants.MODEL_DOCUMENT));
   document.setField(DocumentFields.POSITIONS, Lists.newArrayList());
   return document;
 }