/v3.2/nimbits-model/src/com/nimbits/client/model/diagram/DiagramModel.java

http://nimbits-server.googlecode.com/ · Java · 143 lines · 93 code · 32 blank · 18 comment · 0 complexity · a2aa4f617a915311965cfee5f99a6a2f MD5 · raw file

  1. /*
  2. * Copyright (c) 2010 Tonic Solutions LLC.
  3. *
  4. * http://www.nimbits.com
  5. *
  6. *
  7. * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  8. *
  9. * http://www.gnu.org/licenses/gpl.html
  10. *
  11. * Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  12. */
  13. package com.nimbits.client.model.diagram;
  14. import com.nimbits.client.model.ClientType;
  15. import com.nimbits.client.model.common.CommonFactoryLocator;
  16. import java.io.Serializable;
  17. /**
  18. * Created by bsautner
  19. * User: benjamin
  20. * Date: 5/20/11
  21. * Time: 4:07 PM
  22. */
  23. public class DiagramModel implements Serializable, Diagram {
  24. private boolean fullScreenView;
  25. private boolean readOnly;
  26. private long id;
  27. private long categoryFk;
  28. private int protectionLevel;
  29. private String uuid;
  30. private long userFk;
  31. private String blobKey;
  32. private String name;
  33. public ClientType getClientType() {
  34. return clientType;
  35. }
  36. public void setClientType(ClientType clientType) {
  37. this.clientType = clientType;
  38. }
  39. private ClientType clientType;
  40. public DiagramModel(final long ownerFk) {
  41. this.userFk = ownerFk;
  42. }
  43. public boolean isFullScreenView() {
  44. return fullScreenView;
  45. }
  46. public void setFullScreenView(final boolean fullScreenView) {
  47. this.fullScreenView = fullScreenView;
  48. }
  49. public String getUuid() {
  50. return uuid;
  51. }
  52. public void setUuid(final String uuid) {
  53. this.uuid = uuid;
  54. }
  55. public void setProtectionLevel(final int protectionLevel) {
  56. this.protectionLevel = protectionLevel;
  57. }
  58. public DiagramModel() {
  59. }
  60. public DiagramModel(final long userFk, final String blogKey, final String name) {
  61. this.userFk = userFk;
  62. this.blobKey = blogKey;
  63. this.name = name;
  64. this.protectionLevel = 0;
  65. }
  66. public DiagramModel(final Diagram diagram) {
  67. this.userFk = diagram.getUserFk();
  68. this.blobKey = diagram.getBlobKey();
  69. this.name = diagram.getName().getValue();
  70. this.categoryFk = diagram.getCategoryFk();
  71. this.id = diagram.getId();
  72. this.protectionLevel = diagram.getProtectionLevel();
  73. this.uuid = diagram.getUuid();
  74. this.readOnly = diagram.isReadOnly();
  75. }
  76. @Override
  77. public long getId() {
  78. return this.id;
  79. }
  80. @Override
  81. public long getUserFk() {
  82. return this.userFk;
  83. }
  84. @Override
  85. public String getBlobKey() {
  86. return blobKey;
  87. }
  88. @Override
  89. public DiagramName getName() {
  90. return CommonFactoryLocator.getInstance().createDiagramName(name);
  91. }
  92. @Override
  93. public long getCategoryFk() {
  94. return categoryFk;
  95. }
  96. @Override
  97. public void setCategoryFk(final long id) {
  98. this.categoryFk = id;
  99. }
  100. @Override
  101. public void setReadOnly(final boolean readOnly) {
  102. this.readOnly = readOnly;
  103. }
  104. @Override
  105. public int getProtectionLevel() {
  106. return this.protectionLevel;
  107. }
  108. public boolean isReadOnly() {
  109. return readOnly;
  110. }
  111. }